我想让一段普通文本下方有一行右对齐的文字,文字之间有自定义的垂直间距(0.5 厘米),但不知道该怎么做。我最好的猜测是:
A paragraph of ordinarily justified text blah blah blah followed
by a line which has a different alignment. \\[0.5cm] {\raggedleft
the right aligned text}
这不起作用。垂直间距没问题,但“右对齐文本”却向左对齐。
如果我将其改为
A paragraph of ordinarily justified text blah blah blah followed
by a line which has a different alignment. \\[0.5cm]
{\raggedleft the right aligned text}
那么对齐工作正常,但垂直间距远大于 0.5 厘米。有帮助吗?
答案1
据我所理解:
\documentclass{article}
\begin{document}
\newlength{\myskip}
\setlength{\myskip}{0.5cm}
\addtolength{\myskip}{-\baselineskip}
A paragraph of ordinarily justified text blah blah blah followed
by a line which has a different alignment. And some more and more text.
\vskip\myskip
\rightline{the right aligned text}
\end{document}
我假设基线之间的距离为 5 毫米,因此进行了修正。如果不是,您可以放置垂直跳跃而不进行此类操作。
答案2
可能有人会担心段落和右对齐文本之间的分页问题。以下是无分页版本:
\documentclass{article}
\begin{document}
A paragraph of ordinarily justified text blah blah blah followed
by a line which has a different alignment.\rule[-.5cm]{0cm}{.5cm}\\*
\null\hfill the right aligned text.
\end{document}
这样\rule[-.5cm]{0cm}{.5cm}
就创建了一个支柱:一个延伸到基线以下 0.5 厘米的零宽度规则。