左对齐、居中对齐和右对齐一行分别由三部分组成

左对齐、居中对齐和右对齐一行分别由三部分组成

我有一份这样的文件

\textbf{Company Name}, \textit{Position} \hfill{City, State} \hfill Jan 2018--May 2018
\begin{itemize}
    \item Some bullet point
\end{itemize}
\textbf{Longer Company Name}, \textit{Position} \hfill{City, State} \hfill Jan 2018--May 2018

在此处输入图片描述

我希望该City, State部分居中对齐(或者如果不居中,则在不同条目之间一致对齐)。也许tabular可以,但我不知道如何将itemize其放入tabular并允许其跨越整条线。

答案1

您可以将left、centre 和rcomponent 设置为适当对齐\makebox的零宽度:

在此处输入图片描述

\documentclass{article}

\usepackage[margin=1in]{geometry}% Just for this example

\begin{document}

\textbf{Company Name}, \textit{Position} \hfill{City, State} \hfill Jan 2018--May 2018

\begin{itemize}
  \item Some bullet point
\end{itemize}

\textbf{Longer Company Name}, \textit{Position} \hfill{City, State} \hfill Jan 2018--May 2018

\noindent\hrulefill

\makebox[0pt][l]{\textbf{Company Name}, \textit{Position}}\hfill
\makebox[0pt][c]{City, State}\hfill
\makebox[0pt][r]{Jan 2018--May 2018}

\begin{itemize}
  \item Some bullet point
\end{itemize}

\makebox[0pt][l]{\textbf{Longer Company Name}, \textit{Position}}\hfill
\makebox[0pt][c]{City, State}\hfill
\makebox[0pt][r]{Jan 2018--May 2018}

\end{document}

答案2

使用包tabularxenumitem

在此处输入图片描述

\documentclass{article}
\usepackage{tabularx}
\newcolumntype{M}{>{\csname @minipagetrue\endcsname}X}
\usepackage{enumitem}
\newlist{tabitem}{itemize}{1}   % <-- defined new list
\setlist[tabitem]{nosep,        % <-- new list setup
                  leftmargin=*,
                  label=$\bullet$,
                  after=\vspace{-\baselineskip}
                  }

\begin{document}
\begin{tabularx}{\linewidth}{@{} 
    >{\raggedright\arraybackslash}M c 
    >{\raggedleft\arraybackslash}M @{}}
\textbf{Company Name}, \textit{Position} 
 \begin{tabitem}
    \item Some bullet point
\end{tabitem}           
        & City, State   & Jan 2018--May 2018    \\
\textbf{Longer Company Name}, \textit{Position} 
        & City, State   & Jan 2018--May 2018
\end{tabularx}
\end{document}

相关内容