为什么 \textit 在制表符中不能对多行起作用?

为什么 \textit 在制表符中不能对多行起作用?

如果我在环境中将斜体文本分为两行tabbing,则只有第一行是斜体,第二行是直立的。此外,编译时会出现错误。这是为什么?我该如何\textit在环境中使文本分为多行tabbing

我使用 LuaLaTEX。

以下是一个最小示例。它是宏中更抽象的部分,但我删除了一些东西并更改了文本以达到最大程度的简单性。

\documentclass{minimal}

\begin{document}
    \begin{tabbing}
        \textit{line being in italics \\
            line supposed to be in italics}
    \end{tabbing}            
\end{document}

第一行文本为斜体,第二行文本为直立

它显示了这些错误:

! Missing } inserted.
<inserted text> 
}
l.6             line supposed to be in italics}
                                             
I've inserted something that you may have forgotten.
(See the <inserted text> above.)
With luck, this will get me unwedged. But if you
really didn't forget anything, try typing `2' now; then
my insertion and my current dilemma will both disappear.

! Extra }, or forgotten \endgroup.
<recently read> \egroup 
        
l.6             line supposed to be in italics}
                                             
I've deleted a group-closing symbol because it seems to be
spurious, as in `$x}$'. But perhaps the } is legitimate and
you forgot something else, as in `\hbox{$x}'. In such cases
the way to recover is to insert both the forgotten and the
deleted material, e.g., by typing `I$}'.

答案1

您可以使用 解决 MWE tabto。对于宏中的代码列表,它可能是另一个历史记录。XY 问题?总是问正确的路径来达到你的最终目标,而不是为什么错误的路径会把你带到一个意想不到的地方。

平均能量损失

\documentclass{article}
\usepackage{lipsum,parskip} % just for dummy text
\usepackage{tabto}
\begin{document}
\lipsum[1][1-3]\par
\TabPositions{3cm, .6\linewidth}
   \tab {\itshape  line being \tab in italics \par
   \tab  line supposed        \tab to be in italics}  or not \par
   \tab just using            \tab one \verb+\itshape+\par    
\lipsum[2][1-3]
\end{document}

相关内容