左对齐和右对齐

左对齐和右对齐

我希望实现如下的对齐,array优先考虑环境:

abcde fghijk
lmnnnnn  opq
rstuvwxyz

因此,abcdelmnnnnn左对齐;fghijk和右对齐。和opq之间有一些空格。abcdefghijk

rstuvwxyz与前两行左对齐;将其放在其所在行的中央也是可以的……

有人可以帮忙吗?

答案1

我肯定误解了你的问题......

看一下这段代码:

\documentclass{report}
\usepackage{amsmath,array}

\begin{document}

\emph{Something like this (in math mode)?}

\vspace{10pt}

\(
\begin{array}{@{}l@{}r@{}}
\text{abcde}&\text{fghijk}\\
\text{lmnnnnn}&\text{opq}\\
\text{rstuvwxyz}
\end{array}
\)

\vspace{20pt}

\emph{or like this?}

\vspace{10pt}

\(
\begin{array}{@{}p{0.85cm}r@{}}
\text{abcde}&\text{fghijk}\\
\text{lmnnnnn}&\text{opq}\\
\text{rstuvwxyz}
\end{array}
\)

\vspace{20pt}

\emph{Or something like this (in text mode)?}

\vspace{10pt}

\begin{tabular}{@{}l@{}r@{}}
abcde&fghijk\\
lmnnnnn&opq\\
rstuvwxyz
\end{tabular}

\vspace{20pt}

\emph{or like this?}

\vspace{10pt}

\begin{tabular}{@{}p{0.85cm}r@{}}
abcde&fghijk\\
lmnnnnn&opq\\
rstuvwxyz
\end{tabular}

\end{document} 

在此处输入图片描述

相关内容