我下载了一个简历模板。它在 ShareLaTeX 和 WriteLaTeX 中成功编译。但在我的 TeXLive 发行版中,我遇到了错误。
以下是代码:
% (c) 2002 Matthew Boedicker <[email protected]> (original author) http://mboedick.org
% (c) 2003-2007 David J. Grant <davidgrant-at-gmail.com> http://www.davidgrant.ca
% (c) 2008 Nathaniel Johnston <[email protected]> http://www.nathanieljohnston.com
%
% (c) 2012 Scott Clark <[email protected]> cam.cornell.edu/~sc932
%
%This work is licensed under the Creative Commons Attribution-Noncommercial-Share Alike 2.5 License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/2.5/ or send a letter to Creative Commons, 543 Howard Street, 5th Floor, San Francisco, California, 94105, USA.
\documentclass[letterpaper,11pt]{article}
\newlength{\outerbordwidth}
\pagestyle{empty}
\raggedbottom
\raggedright
\usepackage[svgnames]{xcolor}
\usepackage{framed}
\usepackage{tocloft}
%-----------------------------------------------------------
%Edit these values as you see fit
\setlength{\outerbordwidth}{3pt} % Width of border outside of title bars
\definecolor{shadecolor}{gray}{0.75} % Outer background color of title bars (0 = black, 1 = white)
\definecolor{shadecolorB}{gray}{0.93} % Inner background color of title bars
%-----------------------------------------------------------
%Margin setup
\setlength{\evensidemargin}{-0.25in}
\setlength{\headheight}{0in}
\setlength{\headsep}{0in}
\setlength{\oddsidemargin}{-0.25in}
\setlength{\paperheight}{11in}
\setlength{\paperwidth}{8.5in}
\setlength{\tabcolsep}{0in}
\setlength{\textheight}{9.5in}
\setlength{\textwidth}{7in}
\setlength{\topmargin}{-0.3in}
\setlength{\topskip}{0in}
\setlength{\voffset}{0.1in}
%-----------------------------------------------------------
%Custom commands
\newcommand{\resitem}[1]{\item #1 \vspace{-2pt}}
\newcommand{\resheading}[1]{\vspace{8pt}
\parbox{\textwidth}{\setlength{\FrameSep}{\outerbordwidth}
\begin{shaded}
\setlength{\fboxsep}{0pt}\framebox[\textwidth][l]{\setlength{\fboxsep}{4pt}\fcolorbox{shadecolorB}{shadecolorB}{\textbf{\sffamily{\mbox{~}\makebox[6.762in][l]{\large #1} \vphantom{p\^{E}}}}}}
\end{shaded}
}\vspace{-5pt}
}
\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}
\begin{tabular*}{7in}{l@{\extracolsep{\fill}}r}
\textbf{\Large Your Name} & \textbf{\today} \\
Short description of you & E-mail \\
Adress & Homepage \\
\end{tabular*}
\\
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\resheading{Education}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{itemize}
\item \ressubheading{University Name}{City, Country}{BSc, MSc, PhD, or something else}{2009 - 2013}
\begin{itemize}
\resitem{Additional description nr 1}
\resitem{Additional description nr 2}
\end{itemize}
\item \ressubheading{Other University Name}{City, Country}{BSc, MSc, PhD, or something else}{2004 - 2009}
\end{itemize}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\resheading{Some important section}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{enumerate}
\item First item
\item Second item
\end{enumerate}
\begin{itemize}
\item First item
\item Second item
\end{itemize}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\resheading{Awards, Grants \& Honours}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\vspace{-2pt}
\begin{center}\begin{tabular*}{6.6in}{l@{\extracolsep{\fill}}r}
\multicolumn{2}{c}{Nobel Prize \cftdotfill{\cftdotsep} 2013}\\
\multicolumn{2}{c}{Big grant \cftdotfill{\cftdotsep} 2010-2013}\\
\vphantom{E}
\end{tabular*}
\end{center}\vspace*{-16pt}
\end{document}
我收到的错误是:
--TeX said--
\cftdotfill #1->\def \@tempa
{#1}\def \@tempb {\cftnodots} \ifx \@tempa .... l.77
--TeX said--
<inserted text>
\inaccesible
l77
答案1
有更好的方法来获取固定宽度的s - 这是当前模板的主要问题。我已经替换了withtabular
的使用,由tabular*
tabularx
tabularx
包裹(还有一些array
披萨):
% (c) 2002 Matthew Boedicker <[email protected]> (original author) http://mboedick.org
% (c) 2003-2007 David J. Grant <davidgrant-at-gmail.com> http://www.davidgrant.ca
% (c) 2008 Nathaniel Johnston <[email protected]> http://www.nathanieljohnston.com
%
% (c) 2012 Scott Clark <[email protected]> cam.cornell.edu/~sc932
%
%This work is licensed under the Creative Commons Attribution-Noncommercial-Share Alike 2.5 License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/2.5/ or send a letter to Creative Commons, 543 Howard Street, 5th Floor, San Francisco, California, 94105, USA.
\documentclass[letterpaper,11pt]{article}
\newlength{\outerbordwidth}
\pagestyle{empty}
\raggedbottom
\raggedright
\usepackage[svgnames]{xcolor}
\usepackage{framed,tabularx,array}
\usepackage{tocloft}
%-----------------------------------------------------------
%Edit these values as you see fit
\setlength{\outerbordwidth}{3pt} % Width of border outside of title bars
\definecolor{shadecolor}{gray}{0.75} % Outer background color of title bars (0 = black, 1 = white)
\definecolor{shadecolorB}{gray}{0.93} % Inner background color of title bars
%-----------------------------------------------------------
%Margin setup
\setlength{\evensidemargin}{-0.25in}
\setlength{\headheight}{0in}
\setlength{\headsep}{0in}
\setlength{\oddsidemargin}{-0.25in}
\setlength{\paperheight}{11in}
\setlength{\paperwidth}{8.5in}
\setlength{\tabcolsep}{0in}
\setlength{\textheight}{9.5in}
\setlength{\textwidth}{7in}
\setlength{\topmargin}{-0.3in}
\setlength{\topskip}{0in}
\setlength{\voffset}{0.1in}
%-----------------------------------------------------------
%Custom commands
\newcommand{\resitem}[1]{\item #1 \vspace{-2pt}}
\newcommand{\resheading}[1]{\vspace{8pt}
\parbox{\textwidth}{\setlength{\FrameSep}{\outerbordwidth}
\begin{shaded}
\setlength{\fboxsep}{0pt}\framebox[\textwidth][l]{\setlength{\fboxsep}{4pt}\fcolorbox{shadecolorB}{shadecolorB}{\textbf{\sffamily{\mbox{~}\makebox[6.762in][l]{\large #1} \vphantom{p\^{E}}}}}}
\end{shaded}
}\vspace{-5pt}
}
\newcommand{\ressubheading}[4]{
\begin{tabularx}{6.5in}{X<{\cftdotfill{\cftsecdotsep}}@{}r}
\textbf{#1} & #2 \\
\textit{#3} & \textit{#4} \\
\end{tabularx}\vspace{-6pt}}
%-----------------------------------------------------------
\begin{document}
\begin{tabularx}{7in}{Xr}
\textbf{\Large Your Name} & \textbf{\today} \\
Short description of you & E-mail \\
Adress & Homepage \\
\end{tabularx}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\resheading{Education}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{itemize}
\item \ressubheading{University Name}{City, Country}{BSc, MSc, PhD, or something else}{2009 - 2013}
\begin{itemize}
\resitem{Additional description nr 1}
\resitem{Additional description nr 2}
\end{itemize}
\item \ressubheading{Other University Name}{City, Country}{BSc, MSc, PhD, or something else}{2004 - 2009}
\end{itemize}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\resheading{Some important section}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{enumerate}
\item First item
\item Second item
\end{enumerate}
\begin{itemize}
\item First item
\item Second item
\end{itemize}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\resheading{Awards, Grants \& Honours}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\vspace{-2pt}
\begin{center}\begin{tabular*}{6.6in}{l@{\extracolsep{\fill}}r}
\multicolumn{2}{c}{Nobel Prize \cftdotfill{\cftdotsep} 2013}\\
\multicolumn{2}{c}{Big grant \cftdotfill{\cftdotsep} 2010-2013}\\
\vphantom{E}
\end{tabular*}
\end{center}\vspace*{-16pt}
\end{document}
答案2
我收到错误信息:
! Undefined control sequence.
\cftdotfill #1->\def \@tempa
{#1}\def \@tempb {\cftnodots }\ifx \@tempa \@te...
...
\cftdotfill
是宏中表列规范的一部分\ressubheading
:
\begin{tabular*}{6.5in}{l@{\cftdotfill{\cftsecdotsep}\extracolsep{\fill}}r}
它在那里被扩展,\edef
并且由于未在扩展上下文中执行的分配而中断。
可以通过以下方法修复此问题\cftdotfill
:
\usepackage{tocloft}
\usepackage{etoolbox}
\robustify\cftdotfill