2

I'm working on writing my resume in a LaTeX and hoping to implement some commands to automate section styles (though I am by no means planning to write an entire class). For example, I'd like to include some simple commands for contact information in the preamble that I could then use to build up the header. It would ideally look something like this (I've included resume_config.tex at the bottom of this post):

% =============================================================================
%                                   Preamble
% =============================================================================
% Checks for correct LaTeX usage (no out of data packages, poor syntax etc.)
\RequirePackage[l2tabu,orthodox]{nag}
% -----------------------------------------------------------------------------
\documentclass[letterpaper,11pt]{article}
\input{resume_config.tex}

% =============================================================================
%                                    Inputs
% =============================================================================
\name{C. Gonzalez}
\email{myemail@gmail.com}
\address{000 E 0th St, Austin, TX 12345}
\phone{(000)111-2222}

% =============================================================================
%                                     Body
% =============================================================================
\begin{document}
\makeheader
% \input{resume_education.tex}
% \input{resume_publications.tex}
\input{resume_experience.tex}
% \input{resume_coursework.tex}
% \input{resume_technical.tex}
% \input{resume_other.tex}
\end{document}

I've been studying the .cls file of a template (awesome-cv) and found that they seem to implement this sort of thing with the following code:

% Define writer's address
% Usage: \address{<address>}
\newcommand*{\address}[1]{\def\@address{#1}}

My question is, what does this code mean exactly? First, from what I've read, it sounds like \def is the same thing as \newcommand*, no? Second, is \@varname{#1} syntax for defining a variable, as in \@varname = #1? I've read elsewhere on tex.stackexchange and can't seem to figure out exactly what \@ is used for. Third, the compiler doesn't seem to like that I'm using these commands before \begin{document}, but I'm unsure if that is related....

All of that said, for my use, would it be the same to just write the following in my "Inputs" section?

\def\@name{C. Gonzalez}
\def\@email{myemail@gmail.com}
\def\@address{000 E 0th St, Austin, TX 12345}
\def\@phone{(000)111-2222}

resume_config.tex:

% ----------------------------------------------------------- Load packages ---
% geometry - easier to change margine and page setup
\usepackage[letterpaper,margin=1in]{geometry}
\usepackage{amsfonts,amssymb,amsmath,amsthm}
\usepackage[english]{babel}
\usepackage{booktabs}
\usepackage[usenames,dvipsnames]{color}
% multirow - merge table cells vertically (\multirow{nrows}{width}{content})
\usepackage{multirow}
\usepackage{graphicx}
\usepackage{subcaption}
\usepackage{microtype}
\usepackage{siunitx}
\usepackage[colorlinks=true,linkcolor=blue,citecolor=blue,pdfborder={0 0 0}]{hyperref}
\usepackage{enumitem}
\usepackage{titlesec}

% --------------------------------------------------------- Change commands ---
\renewcommand{\arraystretch}{1.1}


% --------------------------------------------------------- Config booktabs ---
\newcolumntype{L}[1]{>{\raggedright\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{C}[1]{>{\centering\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{R}[1]{>{\raggedleft\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}


% --------------------------------------------------------- Config titlesec ---
% Used for sections of resume (education, experience etc.)
\titleformat{\section}  % Customise the \section command 
  {\Large\raggedright}  % Make the \section headers large (\Large) and left aligned (\raggedright)
  {}{0em}               % Can be used to give a prefix to all sections, like 'Section ...'
  {}                    % Can be used to insert code before the heading
  [\titlerule]          % Inserts a horizontal line after the heading

% Used for subsections of resume (experience 1, experience 2 etc.)
\titleformat{\subsection}
  {\large\raggedright}
  {}{0em}
  {}


% ------------------------------------------------------------ Add commands ---
% Basic Information    
\newcommand{\name}[1]{\def\@name{#1}}
\newcommand{\address}[1]{\def\@address{#1}}
\newcommand{\email}[1]{\def\@email{#1}}
\newcommand{\phone}[1]{\def\@phone{#1}}

\newcommand{\makeheader}[1]{
  \centerline{\Huge{\name}}} \\
  \centerline{\Large{\address \textperiodcentered \email \textperiodcentered \phone}}
}

% Create a subsection with a date (written so that date will not show in table of contents)
\newcommand{\datedsubsection}[2]{%
  \subsection[#1]{#1 \hfill #2}%
}
  • 1
    0) Welcome! 1) The difference between \def and \newcommand is explained here. 2) For variable, I think this post should be of some help. 3) Without a minimal piece of code that we can compile (a MWE), it's hard to tell. Bonus : Your question sort of mix too many things. What do you want exactly? Have a look at this post to know how LaTeX can handle CV. – Clément Mar 11 '16 at 4:40
  • 1
    Thanks for the response. 1) I've viewed this post but it didn't clarify to me why the writer of awesome-cv chose the syntax he did in the snippet I included. 2) I've also viewed this post but it seems like quite a bit more complex of a question - the poster is more focused on writing checks to inspect his variable; the responder seems to drift over my question as an aside as it relates to his question - I don't think I'm nearly as advanced of a user as the poster so I'm not sure exactly how to digest it. 3) I've updated the post to include resume_config.tex, hopefully making it MWE. – Collin Gonzalez Mar 11 '16 at 5:01
  • There really is no use (imho) in using macros for the adress/head/whatever in a CV. awesome.cv is full of conditionals to test if a variable is set or not. Stuff like that is needed for blind generation of a CV. If you want to create a CV of your own style it on your own. You know if you have/need a github account on your CV. – Johannes_B Mar 11 '16 at 6:52
  • 2
    awesome-cv is yet another class/template in the jungle of useless templates. The concept of a template got extremely confused with respect to LaTeX. I am not happy with the current situation. – Johannes_B Mar 11 '16 at 6:56

Browse other questions tagged or ask your own question.