![如何在应用 flushleft/flushright 时将一行居中](https://linux22.com/image/347337/%E5%A6%82%E4%BD%95%E5%9C%A8%E5%BA%94%E7%94%A8%20flushleft%2Fflushright%20%E6%97%B6%E5%B0%86%E4%B8%80%E8%A1%8C%E5%B1%85%E4%B8%AD.png)
答案1
您tabular
通常可以使用这种方式设置前言中的地址。
\documentclass{article}
\begin{document}
\begin{center}
\begin{tabular}{@{}l@{}}
Here is the first line.\\
Second line.
\end{tabular}
\end{center}
\begin{flushright}
\begin{tabular}{@{}c@{}}
Here is the first line.\\
Second line.
\end{tabular}
\end{flushright}
\end{document}
答案2
也许你希望右对齐居中线条。如果是这样,你可以使用varwidth
:
\documentclass{article}
\usepackage{varwidth}
\begin{document}
\begin{flushright}
\begin{varwidth}{\linewidth}\centering
Here is the first line.\\
Second line.
\end{varwidth}
\end{flushright}
\end{document}