![如何指定水平空间大小](https://linux22.com/image/310451/%E5%A6%82%E4%BD%95%E6%8C%87%E5%AE%9A%E6%B0%B4%E5%B9%B3%E7%A9%BA%E9%97%B4%E5%A4%A7%E5%B0%8F.png)
我正在学习pdfLaTeX
,我试过了\hfill
,但它会\hfill
在右侧的行后添加文本。更具体地说,我想制作如附图所示的内容
。
答案1
这可以非常方便地通过左对齐的底层堆栈来处理。
\documentclass{scrreprt}
\usepackage{stackengine,lipsum}
\setstackEOL{\cr}
\def\stackalignment{l}
\begin{document}
\lipsum[1]
\bigskip
\noindent\Longunderstack{
[Name]\cr
[Designation]\cr
Address Line 1.,\cr
Address Line 2.,\cr
Address Line 3.
}
\hfill
\Longunderstack{
[Name]\cr
[Designation]\cr
Address Line 1.,\cr
Address Line 2.
}
\end{document}
答案2
使用tabular
\documentclass{article}
\usepackage{lipsum}
\begin{document}
{\centering\LARGE\bfseries Certificate \par}
\lipsum[1-2]
\vfill
\begin{tabular}[t]{l}
Name\\
Designation\\
Address\\
Address\\
Address
\end{tabular}
\hfill
\begin{tabular}[t]{l}
Name\\
Designation\\
Address\\
Address\\
Address
\end{tabular}
\end{document}
答案3
这是一个解决方案。我用它\quad
来在表格中的名称左右插入一些空格。如果没有它们,表格将与文本边框对齐。这只是个人喜好问题。这\hfill
会将表格推到左侧和右侧,这样您就不必为中间的空白指定明确的宽度。
\documentclass{article}
\pagestyle{empty}
\begin{document}
\begin{center}
\textbf{Certificate}
\end{center}
\bigskip
\noindent Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam
nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed
diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum.
Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor
sit amet.
\bigskip
\noindent\leavevmode
\quad
\begin{tabular}{l}
Short\\
Designation\\
Address Line 1\\
Address Line 2\\
Address Line 3\\
\end{tabular}
\hfill
\begin{tabular}{l}
First Middle Longname\\
Designation\\
Address Line 1\\
Address Line 2\\
Address Line 3\\
\end{tabular}
\quad
\end{document}