在我正在撰写的文档中,我有一个类似于此的列表:
\begin{itemize}
\item \emph{c} before \emph{e} or \emph{i} is pronounced as in \emph{church}
\item \emph{g} before \emph{e} or \emph{i} is pronounced as in \emph{gin}
\end{itemize}
当然,有大量的重复文本。是否可以用一个字符“”来代替它,该字符居中并采用合适的宽度?
最终结果应如下所示:
c before e or i is pronounced as in church
g ” as in gin
答案1
你可以用包来得到类似的东西eqparbox
(两种变体):
\documentclass{article}
\usepackage{eqparbox}
\begin{document}
\begin{itemize}
\item \emph{c} \eqmakebox[NR]{before \emph{e} or \emph{i} is pronounced as in} \emph{church}
\item \emph{g} \eqmakebox[NR]{ — } \emph{gin}
\item \emph{g} \eqmakebox[NR][s]{ — — — } \emph{gin}
\end{itemize}
\end{document}
答案2
您可以测量文本的宽度,并将其用于仅包含引号的相同宽度的框。
\documentclass{article}
\begin{document}
\setbox0\hbox{before \emph{e} or \emph{i} is pronounced}
\begin{itemize}
\item \emph{c} before \emph{e} or \emph{i} is pronounced as in \emph{church}
\item \emph{g} \makebox[\the\wd0][c]{"} as in \emph{gin}
\end{itemize}
\end{document}
并且您可以使用宏来缩写它。
\documentclass{article}
\setbox0\hbox{before \emph{e} or \emph{i} is pronounced}
\newcommand{\pft}{\makebox[\the\wd0][c]{"}\ }
\begin{document}
\begin{itemize}
\item \emph{c} before \emph{e} or \emph{i} is pronounced as in \emph{church}
\item \emph{g} \pft as in \emph{gin}
\end{itemize}
\end{document}
答案3
您的建议是//
或<<
,每两个字符。为什么不是三个字符?
\newcommand{\QW}{before \emph{e} or \emph{i} is pronounced as in }
% ...
\item \emph{c} \QW \emph{church}
选择适合您的任何两个字母的宏名称。
当我写上述答案时,提问者“澄清”了这个问题。结果,澄清使这个对原始问题的回答无效。
编辑
这是对您修改后的问题的另一个(冗长的)回答。使用tabular
。
% repeatprob.tex SE 513244 avoid repeating text
\documentclass{article}
\begin{document}
\newcommand*{\MB}{$\bullet$}
\newcommand*{\RP}{------ '' ------}
% for even less text
\newcommand*{\Entry}[2]{\MB & \emph{#1} & \RP \emph{#2} \\}
\setlength{\tabcolsep}{1pt}
\begin{tabular}{cccl}
$\bullet$ & \emph{c} & before \emph{e} or \emph{i} is pronounced as in & \emph{church} \\
\MB & \emph{g} & '' & \emph{gin} \\
\MB & \emph{g} & \RP & \emph{gin} \\
\Entry{g}{gin}
\end{tabular}
\end{document}
GOM(脾气暴躁的老头)