I have this code block in my .cls file -
\newcommand{\ExperienceEntry}[5]{
\noindent\makebox[\width][l]{#1} \hfill
\makebox[\width][l]{#2} \\
\noindent\makebox[\width][l]{#3} \hfill \\
\indent
\makebox[\width][l]{\textit{#4}} \vspace{5pt}\\
\noindent
\parbox[t][\height][c]{\textwidth}{\small{#5}}
\vspace{-1pt}
}
How do I make the 3rd argument (#3
) optional? By optional I mean if I leave it empty {}
, I do not want a gaping space in my document.
For example this is what happens:
This is the .tex code -
and this is the generated document -
I found some relevant documentation about different behaviour depending on the arguments supplied -
Different command definitions with and without optional argument
Optional argument for newcommand?
but i wasn't sure how to use it in my case.
https://stackoverflow.com/questions/1812214/latex-optional-arguments seems most relevant but here one has to define a default behavior whereas I want the default behavior to be to ignore the argument.
#2
. By the way,\makebox[\width][l]{abc}
is a complicated way to say\mbox{abc}
.\mbox
tip! I edited the question to show an example of the generated gap.\noindent
that does nothing mid paragraph. Note it is confusing to call this an optional parameter as latex optional parameters are marked with[]
not{}
and can be omitted entirely not by using an empty argument.