我有 3 个命令用于方便访问,即resumeBulletStart
、resumeBullet
和resumeBulletEnd
。使用这些命令时编译失败。但是,当我将相同的内容复制为顺序代码时,它可以编译。
\documentclass[letterpaper, 11pt]{article}
\usepackage{tabularx}
\newcommand{\resumeBulletStart}{
\begin{tabularx}{\textwidth}{| X | r |}
}
\newcommand{\resumeBullet}[2]{
\begin{itemize}
\item \small{#1}
\item \small{#2}
\end{itemize}
& \small{\textit{#2}} \\
}
\newcommand{\resumeBulletEnd}{
\end{tabularx}
}
\begin{document}
\centering
%%%% Using Command %%%%
\resumeBulletStart
\resumeBullet{one}{two}
\resumeBulletEnd
%%%% Not Using Command %%%%
% \begin{tabularx}{\textwidth}{| X | r |}
% \begin{itemize}
% \item \small{one}
% \item \small{one}
% \end{itemize}
% & \small{\textit{two}} \\
% \end{tabularx}
\end{document}
我究竟做错了什么?
答案1
感谢评论,我解决了我的问题。@campa和@Werner 的这个回答<3
\documentclass[letterpaper, 11pt]{article}
\usepackage{tabularx}
\newcommand{\resumeBullet}[2]{
\begin{itemize}
\item \small{#1}
\item \small{#2}
\end{itemize}
& \small{\textit{#2}} \\
}
\newenvironment{resumeBullets}
{\tabularx{\textwidth}{| X | r |}}
{\endtabularx}
\begin{document}
\centering
\begin{resumeBullets}
\resumeBullet{one}{two}
\end{resumeBullets}
\end{document}