新命令中的 Hspace

新命令中的 Hspace

在附加的代码中,我想在新命令的定义中包含上下间距,而不使用空间。 这可能吗?

    \documentclass[a4paper,11pt,draft]{report}
    \usepackage[utf8]{inputenc}
    
    \newcommand\Tom {\noindent\hbox to35mm{Tom\hfil}\hangindent=35mm \hangafter=1 }
    \newcommand\Mary {\noindent\hbox to35mm{Mary\hfil}\hangindent=35mm \hangafter=1 }
    
    \begin{document}
    
    \Tom
    Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum is simply dummy text of the printing and typesetting industry.
    
    \hspace{10mm}
    
    \Mary
    Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum is simply dummy text of the printing and typesetting industry.
    
    \end{document}

答案1

搞笑:\hspace居然介绍了水平的空间。由于它的定义以及 TeX 基元在垂直模式下的行为,\hskip它看起来像是引入了垂直空间。

在宏中添加垂直空间。请注意,这\hangafter=1实际上没有做任何事情。

\documentclass[a4paper,11pt,draft]{report}
\usepackage[utf8]{inputenc}

\newcommand\Tom{\par\bigskip\noindent\hbox to35mm{Tom\hfil}\hangindent=35mm }
\newcommand\Mary{\par\bigskip\noindent\hbox to35mm{Mary\hfil}\hangindent=35mm }
    
\begin{document}

\Tom
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem
Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum
is simply dummy text of the printing and typesetting industry. Lorem Ipsum is
simply dummy text of the printing and typesetting industry.

\Mary
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem
Ipsum is simply dummy text of the printing and typesetting industry.
    
\end{document}

在此处输入图片描述

相关内容