posquit0 / Awesome-CV

:page_facing_up: Awesome CV is LaTeX template for your outstanding job application
LaTeX Project Public License v1.3c
23.29k stars 4.82k forks source link

Empty Space if Role is not entered in cventry. #327

Open micullen opened 4 years ago

micullen commented 4 years ago

I saw recently that a PR was merged to remove whitespace if position 5 is not entered. As showing the code below:

% Usage: \cventry{<position>}{<title>}{<location>}{<date>}<description>}
\newcommand*{\cventry}[5]{%
  \vspace{-2.0mm}
  \setlength\tabcolsep{0pt}
  \setlength{\extrarowheight}{0pt}
  \begin{tabular*}{\textwidth}{@{\extracolsep{\fill}} L{\textwidth - 4.5cm} R{4.5cm}}
    \ifempty{#2#3}
      {\entrypositionstyle{#1} & \entrydatestyle{#4} \\}
      {\entrytitlestyle{#2} & \entrylocationstyle{#3} \\
      \entrypositionstyle{#1} & \entrydatestyle{#4}}
    \ifempty{#5}{}{\\\multicolumn{2}{L{\textwidth}}{\descriptionstyle{#5}}}
  \end{tabular*}%
}

However, I often don't enter a role, for Projects etc where I completed everything, and i am left with space in between the title and items as seen in the picture below. image

This project picture above was done by the code below

\cventry
    {}% Role
    {Quantitative Techniques Research}
    % Event
    {Everywhere} % Location
    {Current} % Date(s)
    {
      \begin{cvitems} % Description(s)
        \item {Investigated different ways to process market data to optimise trading algorithms resulting in findings of a higher serial correlation.}
        \item{Researched a mathematical solution to Ornstein-Uhlenbeck as an abstraction of market oscillations for market-making techniques.}
      \end{cvitems}
    }

As you can see, Role is empty, yet still a whitespace. I have tried modifying the cventry code myself to remove the whitespace using a similar technique used by \ifempty{#5}{}{\\\multicolumn{2}{L{\textwidth}}{\descriptionstyle{#5}}}

but to no avail. Is this something that is possible to get around?

Thanks

yxcho commented 4 years ago

I am having trouble removing the white space between title and descriptions upon empty position as well. Would really appreciate some help, thanks

micullen commented 4 years ago

I received help from stack overflow with this one. You can replace the \cventry code with this

% Define an entry of cv information % Usage: \cventry{<position>}{<title>}{<location>}{<date>}{<description>} \renewcommand*{\cventry}[5]{% \vspace{-2.0mm} \setlength\tabcolsep{0pt} \setlength{\extrarowheight}{0pt} \begin{tabular*}{\textwidth}{@{\extracolsep{\fill}} L{\textwidth - 4.5cm} R{4.5cm}} \ifempty{#2#3} {\entrypositionstyle{#1} & \entrydatestyle{#4} \\} {\entrytitlestyle{#2} & \entrylocationstyle{#3} \\ \entrypositionstyle{#1} & \entrydatestyle{#4} \\} \multicolumn{2}{L{\textwidth}}{\ifempty{#1}{\vskip-1.2\baselineskip}{}\descriptionstyle{#5}} \end{tabular*}% }

and that removes the whitespace

yxcho commented 4 years ago

That helps, thank you!

StevenSalazarM commented 4 years ago

Hello, thank you for your solution for empty role. However it seems to add a empty space if there is only one single item in cvitems. Any idea how to fix that? When I have two items it works fine

Screenshot_33 Screenshot_32

The code I used for cventry is:

\newcommand*{\cventry}[5]{%
  \vspace{-2.0mm}
  \setlength\tabcolsep{0pt}
  \setlength{\extrarowheight}{0pt}
  \begin{tabular*}{\textwidth}{@{\extracolsep{\fill}} L{\textwidth - 4.5cm} R{4.5cm}}
    \ifempty{#2#3}
      {\entrypositionstyle{#1} & \entrydatestyle{#4} \\}
      {\entrytitlestyle{#2} & \entrylocationstyle{#3} \\
      \entrypositionstyle{#1} & \entrydatestyle{#4} \\}
\if\relax\detokenize{#5}\relax\else % THIS LINE ADDED TO CHECK IF LAST ARGUMENT IS EMPTY
       \multicolumn{2}{L{\textwidth}}{\ifempty{#1}{\vskip-1.2\baselineskip}{}\descriptionstyle{#5}}% ONLY DO THIS IF #5 IS NOT EMPTY
    \fi % END OF THE IF STATEMENT
  \end{tabular*}%
}

The code for the images is:

  \cventry
    {} % Role
    {OpenCL Wrapper {} [\underline{\href{https://www.google.com/}{Google}}]} % Event
    {Milan, Italy} % Location
    {Nov. 2019 - Feb 2020} % Date(s)
    {
      \begin{cvitems} % Description(s)
        \item {asd}
      \end{cvitems}
    }

Edit:

I managed to solve this by adding \ifempty{#1#3}. Thanks anyway

minsung-k commented 4 years ago

Do you know how to make another eventry.

I want to use the original version and make another version too

fulcus commented 2 years ago

The PR in question is https://github.com/posquit0/Awesome-CV/pull/428

fulcus commented 2 years ago

@StevenSalazarM happy to see a (former?) polimi student :) Would you mind updating the PR with your fix?