我有一個關於 itemize 範例中項目符號對齊的問題,這裡有一個簡短的範例。基本上我有一個帶有插入表格的 \item ,我希望項目符號位於表格的頂部
有什麼辦法可以實現這一點嗎?
\begin{itemize}
\item \begin{tabular}{c p{11.4cm}} 04.2014 - 05.2014: & teeeeeeeeeeeeeeeeeeessssssssssssssssssssstttttttttttttttttttttt
pppppppppphhhhhhhhhhaaaaaaaaaasssssssssseeeeeeeeeeeee \end{tabular}
\end{itemize}
答案1
打字
\begin{itemize}
\item \begin{tabular}[t]{c p{11.4cm}} 04.2014 - 05.2014: & teeeeeeeeeeeeeeeeeeessssssssssssssssssssstttttttttttttttttttttt
pppppppppphhhhhhhhhhaaaaaaaaaasssssssssseeeeeeeeeeeee \end{tabular}
\end{itemize}
可以解決問題,但我的印像是您使用了錯誤的工具來完成這項工作。
試試這個:
\documentclass{article}
\usepackage{enumitem}
\usepackage{microtype}
\usepackage{lipsum} % just for the example
\newenvironment{cvitemize}
{\begin{itemize}[leftmargin=\citemwd,labelwidth=\citemwd,labelsep=0pt]}
{\end{itemize}}
\newlength{\citemwd}
\AtBeginDocument{%
\settowidth{\citemwd}{\textbullet\ 00.0000--00.0000:\ }%
}
\newcommand{\citem}[1]{%
\item[\textbullet\ #1:\ ]%
}
\begin{document}
\lipsum[2]
\begin{cvitemize}
\citem{04.2014--05.2014} \lipsum*[3]
\end{cvitemize}
\lipsum[4]
\end{document}
答案2
有一個可選參數用於tabular
指定垂直位置。 t
指定頂行的基線應與周圍的文字對齊。
\documentclass{article}
\begin{document}
\begin{itemize}
\item \begin{tabular}[t]{c p{11.4cm}} 04.2014 - 05.2014: & teee
eeeeeee eeeeeeee essssss ssssssss ssssssst ttttttt ttttttttt ttttt
pp pppp pppphhh hhhhhh haaaaa aaaaas ssssss ssseee eeeeee
eeee \end{tabular}
\end{itemize}
\end{document}
如果沒有選項,則tabular
相對於周圍的文字垂直居中。透過此b
選項,使用表格最後一行的基線;請注意p
,該列將成為該條目行的基線,因此在您的情況下,這將產生與您要求的相同的對齊方式:
\documentclass{article}
\begin{document}
\begin{itemize}
\item \begin{tabular}[t]{c p{5cm}} 04.2014 - 05.2014: & teee
eeeeeee eeeeeeee essssss ssssssss ssssssst ttttttt ttttttttt ttttt
pp pppp pppphhh hhhhhh haaaaa aaaaas ssssss ssseee eeeeee
eeee \end{tabular}
\item \begin{tabular}{c p{5cm}} 04.2014 - 05.2014: & teee
eeeeeee eeeeeeee essssss ssssssss ssssssst ttttttt ttttttttt ttttt
pp pppp pppphhh hhhhhh haaaaa aaaaas ssssss ssseee eeeeee
eeee \end{tabular}
\item \begin{tabular}[b]{c p{5cm}} 04.2014 - 05.2014: & teee
eeeeeee eeeeeeee essssss ssssssss ssssssst ttttttt ttttttttt ttttt
pp pppp pppphhh hhhhhh haaaaa aaaaas ssssss ssseee eeeeee
eeee \end{tabular}
\end{itemize}
\end{document}
答案3
您可以使用listliketab
套件:表格環境,其中第一列可以模擬任何清單環境:
\documentclass[11pt, a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{lipsum}
\usepackage[showframe, nomarginpar, textwidth = 15cm]{geometry}
\usepackage{listliketab}
\newcommand{\tabitem}{\textbullet}
\pagestyle{empty}
\begin{document}
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur dic- tum gravida mauris. Nam arcu libero, nonummy eget, consectetuer id, vulputate a, magna. Donec vehicula augue eu neque. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Mauris ut leo. Cras viverra metus rhoncus sem.Nulla et lectus vestibulum urna fringilla ultrices. Phasellus eu tellus sit amet tortor gravida placerat. Integer sapien est, iaculis in, pretium quis, viverra ac, nunc. Praesent eget sem vel leo ultrices bibendum. Aenean faucibus. Morbi dolor nulla, malesuada eu, pulvinar at, mollis ac, nulla. Curabitur auctor semper nulla. Donec varius orci eget risus. Duis nibh mi, congue eu, accumsan eleifend, sagittis quis, diam. Duis eget orci sit amet orci dignissim rutrum.
\storestyleof{itemize}
\begin{listliketab}
\begin{tabular}{Lc p{8cm}}
\tabitem & 04.2014 - 05.2014: & Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur dic- tum gravida mauris. Nam arcu libero, nonummy eget, consectetuer id, vulputate a, magna.
\end{tabular}
\end{listliketab}
\end{document}