xwatermark 和 refstepcounter 的奇怪列表格式

xwatermark 和 refstepcounter 的奇怪列表格式

我发现和的一些奇怪的行为xwatermark\refstepcounter无法解释。我创建了一个列表,第一个项目的缩进是正确的,但其他所有项目的缩进都太多了。如果改为\stepcounter使用,它又可以正常工作了。如果xwatermark未加载包也是如此。问题不在于如何修复它,而是为什么会发生这种情况。包不应该以任何方式影响布局。我完全无法理解xwatermark与的连接。\refstepcounter

\documentclass{article}
\setlength{\parindent}{0pt}
\newcounter{num}
\newcommand{\ta}{\refstepcounter{num} \makebox[10mm][l]{\Roman{num})}test\\
  \hspace*{185,5mm}
  \begin{minipage}{15mm}
  \end{minipage}
}
\usepackage{xwatermark}
\begin{document}
  Test

  \ta
  \ta
  \ta
\end{document}

只有第一个项目正确对齐,并加载了 xwatermark 或改用了 refstepcounter

     *File List*
 article.cls    2007/10/19 v1.4h Standard LaTeX document class
  size10.clo    2007/10/19 v1.4h Standard LaTeX file (size option)
xwatermark.sty    2012/10/23 v1.5.2d A dynamic watermarking scheme (Ahmed Musa)

catoptions.sty    2012/11/22 v0.2.7f Securing catcodes and parsing options (AM)

  fix-cm.sty    2006/09/13 v1.1m fixes to LaTeX
  ts1enc.def    2001/06/05 v3.0e (jk/car/fm) Standard LaTeX file
 picture.sty    2009/10/11 v1.3 Dimens for picture macros (HO)
graphicx.sty    1999/02/16 v1.0f Enhanced LaTeX Graphics (DPC,SPQR)
  keyval.sty    1999/03/16 v1.13 key=value parser (DPC)
graphics.sty    2009/02/05 v1.0o Standard LaTeX Graphics (DPC,SPQR)
    trig.sty    1999/03/16 v1.09 sin cos tan (DPC)
graphics.cfg    2010/04/23 v1.9 graphics configuration of TeX Live
  pdftex.def    2011/05/27 v0.06d Graphics/color for pdfTeX
infwarerr.sty    2010/04/08 v1.3 Providing info/warning/error messages (HO)
 ltxcmds.sty    2011/11/09 v1.22 LaTeX kernel commands for general use (HO)
atbegshi.sty    2011/10/05 v1.16 At begin shipout hook (HO)
   ifpdf.sty    2011/01/30 v2.3 Provides the ifpdf switch (HO)
fancyhdr.sty    
atveryend.sty    2011/06/30 v1.8 Hooks at the very end of document (HO)
 ltxkeys.sty    2012/11/17 v0.0.3c A robust key-value parser (AM) (Ahmed Musa)
  framed.sty    2011/10/22 v 0.96: framed or shaded text with page breaks
    Test.xwm
hyperref.sty    2012/11/06 v6.83m Hypertext links for LaTeX
hobsub-hyperref.sty    2012/05/28 v1.13 Bundle oberdiek, subset hyperref (HO)
hobsub-generic.sty    2012/05/28 v1.13 Bundle oberdiek, subset generic (HO)
  hobsub.sty    2012/05/28 v1.13 Construct package bundles (HO)
ifluatex.sty    2010/03/01 v1.3 Provides the ifluatex switch (HO)
  ifvtex.sty    2010/03/01 v1.5 Detect VTeX and its facilities (HO)
 intcalc.sty    2007/09/27 v1.1 Expandable calculations with integers (HO)
etexcmds.sty    2011/02/16 v1.5 Avoid name clashes with e-TeX commands (HO)
kvsetkeys.sty    2012/04/25 v1.16 Key value parser (HO)
kvdefinekeys.sty    2011/04/07 v1.3 Define keys (HO)
pdftexcmds.sty    2011/11/29 v0.20 Utility functions of pdfTeX for LuaTeX (HO)
pdfescape.sty    2011/11/25 v1.13 Implements pdfTeX's escape features (HO)
bigintcalc.sty    2012/04/08 v1.3 Expandable calculations on big integers (HO)
  bitset.sty    2011/01/30 v1.1 Handle bit-vector datatype (HO)
uniquecounter.sty    2011/01/30 v1.2 Provide unlimited unique counter (HO)
letltxmacro.sty    2010/09/02 v1.4 Let assignment for LaTeX macros (HO)
 hopatch.sty    2012/05/28 v1.2 Wrapper for package hooks (HO)
xcolor-patch.sty    2011/01/30 xcolor patch
refcount.sty    2011/10/16 v3.4 Data extraction from label references (HO)
 hycolor.sty    2011/01/30 v1.7 Color options for hyperref/bookmark (HO)
 ifxetex.sty    2010/09/12 v0.6 Provides ifxetex conditional
 auxhook.sty    2011/03/04 v1.3 Hooks for auxiliary files (HO)
kvoptions.sty    2011/06/30 v3.11 Key value format for package options (HO)
  pd1enc.def    2012/11/06 v6.83m Hyperref: PDFDocEncoding definition (HO)
hyperref.cfg    2002/06/06 v1.2 hyperref configuration of TeXLive
     url.sty    2013/09/16  ver 3.4  Verb mode for urls, etc.
 hpdftex.def    2012/11/06 v6.83m Hyperref driver for pdfTeX
rerunfilecheck.sty    2011/04/15 v1.7 Rerun checks for auxiliary files (HO)
supp-pdf.mkii
epstopdf-base.sty    2010/02/09 v2.5 Base part for package epstopdf
  grfext.sty    2010/08/19 v1.1 Manage graphics extensions (HO)
epstopdf-sys.cfg    2010/07/13 v1.3 Configuration of (r)epstopdf for TeX Live
 nameref.sty    2012/10/27 v2.43 Cross-referencing by name of section
gettitlestring.sty    2010/12/03 v1.4 Cleanup title references (HO)

答案1

问题很微妙。使用xwatermark,也会hyperref加载(实际上我不知道为什么)。由于hyperref重新定义了\refstepcounter,它后面的空格变得很重要,并且不会在换行符处被删除,因为它位于hyperref相对于步进计数器的锚点插入的节点之后。

解决方法:删除有问题的空间。

\newcommand{\ta}{\refstepcounter{num}\makebox[10mm][l]{\Roman{num})}test\\
  \hspace*{185,5mm}
  \begin{minipage}{15mm}
  \end{minipage}
}

相关内容