datafile
我正在尝试从包含所有值/条目的文件中自动创建一份简历(或者任何其他愿意的文档) 。
以下是我在此项目中使用的个人文件:
CV.tex 读取 CV_data.tex 并使用 CV_formats.tex 在本例中创建简历。所有三个文件必须位于同一目录中,并且必须运行 CV.tex 来调用其他两个文件并构建最终文档。
我正在使用的简历类可以找到这里
简历
\input{CV_formats}
\begin{document}
\input{CV_data}
\end{document}
%% eof
CV_格式.tex
\documentclass{res}
%
% \usepackage[paper=letterpaper,left=1.0in,right=1.0in,top=1.0in,bottom=1.0in,]{geometry}
% \usepackage{res}
%
\usepackage{ifthen} %% if-then-else arguments
\usepackage{paralist,array} %% enhancements to array environment
\usepackage{float,multirow,longtable} %% multipage tables, multirow cells
\usepackage{lscape,rotating} %% allows for landscape tables and figures
\usepackage{color,url} %% allows for colors and easy formatting of URL's
\usepackage{amsmath,amssymb} %% AMS math macros; esp. \text{} in math environment
%%%%%%%%
\usepackage{fancyhdr}
\pagestyle{fancy}
\usepackage[T1]{fontenc}
%\usepackage{helvetica} % uses helvetica postscript font (download helvetica.sty)
%\usepackage{newcent} % uses new century schoolbook postscript font
\newsectionwidth{0pt} % So the text is not indented under section headings
\usepackage{fancyhdr} % use this package to get a 2 line header
\renewcommand{\headrulewidth}{0pt} % suppress line drawn by default by fancyhdr
\setlength{\headheight}{22pt} % allow room for 2-line header
\setlength{\headsep}{24pt} % space between header and text
\setlength{\headheight}{24pt} % allow room for 2-line header
\pagestyle{fancy} % set pagestyle for document
% \usepackage{hyperref}
\rhead{ {\it My.Name.GoesHere}\\{\it p. \thepage} } % put text in header (right side)
\cfoot{} % the foot is empty
\topmargin=-0.5in % start text higher on the page
%% =============================================================================
\def\output#1{\def\outp@t{#1}} %% output format specifier
%% --- SET OUTPUT FORMAT -----
\output{CV}
%% =============================================================================
%
%% =========================================
%% definition of data names
\def\name#1{\def\n@me{#1}}
\def\raddress#1{\def\r@ddress{#1}}
\def\waddress#1{\def\w@ddress{#1}}
\def\educationa#1{\def\educ@tiona{#1}}
\def\educationb#1{\def\educ@tionb{#1}}
\def\educationc#1{\def\educ@tionc{#1}}
\def\institutea#1{\def\in@titutea{#1}}
\def\instituteb#1{\def\in@tituteb{#1}}
\def\institutec#1{\def\in@titutec{#1}}
%
% \def\gpa1#1{\def\gp@1{#1}}
% \def\gpa2#1{\def\gp@2{#1}}
% \def\gpa3#1{\def\gp@3{#1}}
\def\dissertationa#1{\def\dissert@tiona{#1}}
\def\dissertationb#1{\def\dissert@tionb{#1}}
\def\dissertationc#1{\def\dissert@tionc{#1}}
\def\skillsa#1{\def\skill@a{#1}}
\def\skillsb#1{\def\skill@b{#1}}
\def\skillsc#1{\def\skill@c{#1}}
% \def\sponsornote#1{\def\spons@rnote{#1}}
% \def\status#1{\def\st@tus{#1}}
% \def\investigator#1{\def\investig@tor{#1}}
% \def\CoI#1{\def\Co@I{#1}}
% \def\location#1{\def\loc@tion{#1}}
% \def\note#1{\def\n@te{#1}}
%%% initialize data names
\name{}
\raddress{}
\waddress{}
\educationa{}
\educationb{}
\educationc{}
\institutea{}
\instituteb{}
\institutec{}
% \gpa1{}
% \gpa2{}
% \gpa3{}
\dissertationa{}
\dissertationb{}
\dissertationc{}
\skillsa{}
\skillsb{}
\skillsc{}
%% ------------------------------------------
%%%
\newcommand{\ms}{\rule[-0.5ex]{0pt}{3.5ex}}
\newcommand{\ws}{\rule[-1.5ex]{0pt}{5ex}}
%% ==========================================
%% CV format for table descriptions
%\newcommand{\FormFperiod}{Performance Period: }
%% -------------------------------------
\begin{resume}
\newcommand{\CVentry}{
\thispagestyle{empty} % this page has no header
\name{\n@me\\ [12pt] }% the \\[12pt] adds a blank line after name
\address{{\bf \w@ddress}}
\address{{\bf \r@ddress}}
\vspace{0.2in}
\section{\centerline{EDUCATION}}
\vspace{8pt}
{\sl \textbf{\educ@tiona, \in@titutea}}\\
\textbf{\dissert@tiona} \\
{Skills:} \skill@a
{\sl \textbf{\educ@tionb}}\\
\textbf{\dissert@tionb} \\
{Skills:} \skill@b
{\sl \textbf{\educ@tionc}}\\
\textbf{\dissert@tionc} \\
{Skills:} \skill@c
%% reset variables
\name{}
\raddress{}
\waddress{}
\educationa{}
\educationb{}
\educationc{}
\institutea{}
\instituteb{}
\institutec{}
% \gpa1{}
% \gpa2{}
% \gpa3{}
\dissertationa{}
\dissertationb{}
\dissertationc{}
\skillsa{}
\skillsb{}
\skillsc{}
}
\end{resume}
\ifthenelse{\equal{\outp@t}{CV}}{% true condition
\def\entry{\CVentry}
}{}% leave false condition blank
%% eof
CV_数据.tex
%% ==========================================
\name{My.Name}
\raddress{Res address}
\waddress{Work address}
\educationa{PhD}
\educationb{MS}
\educationc{BE}
\institutea{MTU}
\instituteb{MTU}
\institutec{VTU}
% \gpa1{}
% \gpa2{}
% \gpa3{}
\dissertationa{P1}
\dissertationb{P2}
\dissertationc{P3}
\skillsa{s1}
\skillsb{s2}
\skillsc{s3}
% \entry
%% end data
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
当我跑步时简历它似乎没有生成我的完整文档并跳过了所有“地址”,“教育”,“机构”,“论文”的详细信息。
我在实施过程中遗漏了什么?这是基于之前同事的实施而构建的,他无法询问!:(
答案1
您的文件中有 3 个主要错误:
在 中
CV_formats.tex
,删除\begin{resume}
和\end{resume}
。您不能使用 之前未定义的环境\begin{document}
,简历由该命令排版。在in
\CVentry
后添加该命令,然后\input{CV_data}
CV.tex
由于您使用
@
字符作为中的命令名称的一部分CV_formats.tex
,因此您需要\makeatletter
在第一行之前使用@
(即\def\output#1{\def\outp@t{#1}}
)写入并\makeatother
在文件末尾添加。
结果: