3

Sorry I was not able to reproduce this problem outside Friggeri's CV template...

I am using Friggeri's CV template with the same friggeri-cv.cls (I have only changed all the Helvetica fonts to Arial). I want to use the "print" option that removes colors making everything grayscale.

With that purpose I want to include some conditionals inside the document. While I have successfully used the following structure in the preamble:

 \ifdefined\@cv@print 
 do this
 \else
 do that
 \fi

I cannot make it work inside the body of my document... is it even possible? I am new with conditionals, so I am quite lost here...

I have included the following MWE:

\documentclass[print]{friggeri-cv}%"BLACK&WHITE" should appear
%- or -%
%\documentclass[]{friggeri-cv}%"COLORS" should appear in red

\begin{document}
\header{name}{surname}
       {occupation}

% In the aside, each new line forces a line break
\begin{aside}
  \section{section}
    aaa
    bbb
\end{aside}


\section{section}
\begin{entrylist}
  \entry
    {2014}
    {\ifdefined\@cv@print
    BLACK\&WHITE
    \else
    {\addfontfeature{Color=red}COLOR}
    \fi}
    {more here}
    {and more text}
\end{entrylist}


\end{document}
  • You should use \ifcsname @cv@print\endcsname instead of \ifdefined\@cv@print, because @ is not a letter in the document body. – egreg Jun 9 '14 at 20:29
  • Great! Thanks @egreg!! Really useful to know that – DaniCee Jun 9 '14 at 20:33
2

\@cv@print is not available as a command name unless you have a \makeatletter declaration somewhere.

Either you say

\ifcsname @cv@print\endcsname

instead of

\ifdefined\@cv@print

or, better, you define in the preamble

\newif\ifdaniceeprint % starts out false
\makeatletter
\ifdefined\@cv@print
  \daniceeprint
\fi
\makeatother

and use \ifdaniceeprint instead of the conditional involving \@cv@print.

Even better, say

\makeatletter
\newcommand{\printconditional}{%
  \ifdefined\@cv@print
    \expandafter\@firstoftwo
  \else
    \expandafter\@secondoftwo
  \fi}
 \makeatother

in the preamble and use

\begin{entrylist}
  \entry
    {2014}
    {\printconditional{BLACK\&WHITE}{{\addfontfeature{Color=red}COLOR}}}
    {more here}
    {and more text}
\end{entrylist}

in the document body.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.