我有这个代码
\documentclass[letterpaper,10.5pt]{article}
\usepackage[svgnames]{xcolor}
\usepackage{tocloft}
\usepackage[colorlinks=true]{hyperref}
\newcommand{\ressubheading}[4]{
\begin{tabular*}{6.5in}{l@{\cftdotfill{\cftsecdotsep}\extracolsep{\fill}}r}
\textbf{#1} & #2 \\
\textit{#3} & \textit{#4} \\
\end{tabular*}\vspace{-6pt}}
\begin{document}
\ressubheading{AAA}{Oct 2022 - current}{BBBB}
\end{document}
返回以下错误
! Missing control sequence inserted.
<inserted text>
\inaccessible
l.19
Please don't say `\def cs{...}', say `\def\cs{...}'.
I've inserted an inaccessible control sequence so that your
definition will be completed without mixing me up too badly.
You can recover graciously from this error, if you're
careful; see exercise 27.2 in The TeXbook.
! Missing control sequence inserted.
<inserted text>
\inaccessible
l.19
Please don't say `\def cs{...}', say `\def\cs{...}'.
I've inserted an inaccessible control sequence so that your
definition will be completed without mixing me up too badly.
You can recover graciously from this error, if you're
careful; see exercise 27.2 in The TeXbook.
Runaway argument?
{
! Paragraph ended before \text@command was complete.
<to be read again>
\par
l.19
I suspect you've forgotten a `}', causing me to apply this
control sequence to too much text. How can we recover?
My plan is to forget the whole thing and hope for the best.
! Missing { inserted.
<inserted text>
{
l.19
I've put in what seems to be necessary to fix
the current column of the current alignment.
Try to go on, since this might almost work.
Overfull \hbox (139.75499pt too wide) in paragraph at lines 19--20
有什么想法吗?谢谢
答案1
添加\usepackage{array}
以便 tocloft 命令在表格前言中是安全的,并使用您定义的命令缺少的第 4 个参数。删除不正确的10.5pt
选项。
\documentclass[letterpaper]{article}
\usepackage{array}
\usepackage[svgnames]{xcolor}
\usepackage{tocloft}
\usepackage[colorlinks=true]{hyperref}
\newcommand{\ressubheading}[4]{%
\begin{tabular*}{6.5in}{l@{\cftdotfill{\cftsecdotsep}\extracolsep{\fill}}r}
\textbf{#1} & #2 \\
\textit{#3} & \textit{#4} \\
\end{tabular*}\vspace{-6pt}}
\begin{document}
\ressubheading{AAA}{Oct 2022 - current}{BBBB}{}
\end{document}