答案1
您可以使用enumitem
包来定义新的列表类型。在这里,我subdescription
基于 定义了一个列表环境itemize
。在此环境中(和仅有的(此处)\item
命令被重新定义为采用强制参数(示例中的年份)和可选参数(如果给出,则将放置在强制参数下)。如果使用可选参数,则预计描述至少为两行。如果不是这种情况,可选参数将与下一个项目重叠。
\documentclass{article}
\usepackage{enumitem}
\newlist{subdescription}{itemize}{1}
\setlist[subdescription]{
labelwidth=9mm,
before=\changeitem,
after={\renewcommand{\item}{\olditem}}
}
\newcommand*{\changeitem}{%
\let\olditem\item
\renewcommand{\item}[2][]{\olditem[\stackitem{##2}{##1}]}
}
\newcommand*{\stackitem}[2]{%
\textbullet \textbf{#1}%
\ifx#2{}\else%
\makebox[0pt][r]{%
\raisebox{-\baselineskip}[0pt][0pt]{#2}%
}%
\fi%
}
\begin{document}
\begin{subdescription}
\item[(09)]{1939}
German invasion of Poland. In two weeks polish resistance is broken by the Wehrmacht.
\item{1939} Beginning of the war.
\item{1945} End of the war.
\end{subdescription}
\end{document}
答案2
使用enumitem
包:
\documentclass{article}
\usepackage{enumitem} % itemize and enumerate options
\begin{document}
\begin{itemize}
\item[1939-09] German invasion of Poland. In two weeks Polish resistance is broken by the Wehrmacht.
\end{itemize}
\end{document}
此方法不允许09
位于下方1939
。如果这是必要的,您可以使用tabular
环境:
\documentclass{article}
\begin{document}
\begin{tabular}{ll}
1939 & German invasion of Poland. In two weeks Polish resistance is broken by \\
(09) & the Wehrmacht. \\
\end{tabular}
\end{document}
答案3
我为其定义了对齐方式description
的环境和风格的解决方案:multiline
parright
\documentclass{article}
\usepackage{showframe}
\renewcommand{\ShowFrameLinethickness}{0.3pt}
\usepackage{calc}
\usepackage{enumitem} % itemize and enumerate options
\SetLabelAlign{parright}{\strut\smash{\parbox[t]\labelwidth{{}\raggedleft#1}}}
\begin{document}
\begin{description}[labelwidth=\widthof{\bfseries0000},style=multiline, align =parright, leftmargin=\labelwidth+0.5em]
\item[1939 -09] German invasion of Poland. In two weeks Polish resistance is broken by the Wehrmacht.
\end{description}
\end{document}