Longtable 段落单元格中使用宏进行奇怪格式

Longtable 段落单元格中使用宏进行奇怪格式

我在使用 longtable 与宏组合时遇到了意外行为。我使用宏处理字符串,并将结果输出到 longtable 的段落单元格中。在输出中,我看到宏输出前面有一个奇怪的间距。我将其与手动添加的宏输出进行比较,结果正常。下面是 MWE。

谢谢您的任何建议。

\documentclass{article}

\usepackage[a4paper,top=1.27cm,left=1cm,right=1cm,bottom=2cm]{geometry}
\usepackage{array}
\usepackage[demo]{graphicx}
\usepackage[utf8x]{inputenc}
\usepackage{longtable}
\usepackage{xstring}

\def\address{TEST1111 TEST1111 \\ TEST222 TEST222}

\newcommand{\fixAddress}{%
    \saveexpandmode\expandarg\exploregroups
\StrSubstitute{\address}{\noexpand\\}{\newline}[\addrGlobal]%
\restoreexpandmode\addrGlobal%
}%

    \newcommand{\fixAddressE}{%
    \saveexpandmode\expandarg\exploregroups
\StrSubstitute{\address}{\noexpand\\}{\newline}[\addrGlobal]%
\restoreexpandmode%
}%

\relax
\show\address
\fixAddressE
\show\addrGlobal

\begin{document}

    \begin{longtable}[l]{@{}>{\raggedleft}p{5cm}@{\hspace{12pt}}|@{\extracolsep{12pt}}p{13cm}@{}}
    Title &\tabularnewline
    Test1 & TEST1111 TEST1111 \protect \newline   TEST222 TEST222 \tabularnewline
\textbf{Heading} & \fixAddress \tabularnewline
\textbf{Heading2} & \addrGlobal \tabularnewline 
Test2 & TEST1111 TEST1111 \protect \newline   TEST222 TEST222 \tabularnewline
Description & \begin{itemize}  \item Lorem ipsum  \item ...\end{itemize}\tabularnewline
Text & \begin{itemize}  \item Further stuff  \item ...\end{itemize}\tabularnewline
\end{longtable}

\end{document}

编辑:我添加了输出(MikTex 2.9)。请注意不同的文本起始位置。 示例输出

EDIT2:\listfiles 输出:

*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)
geometry.sty    2010/09/12 v5.6 Page Geometry
keyval.sty    1999/03/16 v1.13 key=value parser (DPC)
ifpdf.sty    2011/01/30 v2.3 Provides the ifpdf switch (HO)
ifvtex.sty    2010/03/01 v1.5 Detect VTeX and its facilities (HO)
ifxetex.sty    2010/09/12 v0.6 Provides ifxetex conditional
geometry.cfg
array.sty    2008/09/09 v2.4c Tabular extension package (FMi)
graphicx.sty    1999/02/16 v1.0f Enhanced LaTeX Graphics (DPC,SPQR)
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    2007/01/18 v1.5 graphics configuration of teTeX/TeXLive
dvips.def    1999/02/16 v3.0i Driver-dependant file (DPC,SPQR)
inputenc.sty    2008/03/30 v1.1d Input encoding file
utf8x.def    2004/10/17 UCS: Input encoding UTF-8
ucs.sty    2004/10/17 UCS: Unicode input support
uni-global.def    2004/10/17 UCS: Unicode global data
longtable.sty    2004/02/01 v4.11 Multi-page Table package (DPC)
xstring.sty    2013/1/13  v1.7  String manipulations (C Tellechea)
ucsencs.def    2003/11/29 Fixes to fontencodings LGR, T3
omscmr.fd    1999/05/25 v2.5h Standard LaTeX font definitions

相关内容