# Textsize changes with \par

This is somehow a follow-on post of Newline linespacing problems within a table cell.

What i want to do is having different font styles in one table cell. I've learnt so far that a local size change {\small this is a small style\par} should always be terminated by \par so that the line-spacing (\baselineskip) gets adjusted well. So far so good. This works as expected, every \par does a linebreak and adjusts the linespacing. The problem is, that the last \par in a table cell adds a newline to the text which is in this case not wanted.

My question would be if there does exist another latex command which has the same effect as \par on the line-spacing but does not add a newline? Or some other workaround would be highly appreciated!

Here is a small example (it is based heavily on the code from my previous post):

\documentclass[11pt,paper=a4,11pt,parskip=half,draft]{scrartcl}

\usepackage[utf8x]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}

\usepackage{longtable}
\usepackage{tabularx}
\usepackage{ragged2e}
\usepackage{xcolor}
\usepackage{ifthen}

\usepackage{blindtext}

\definecolor{darkblue}{HTML}{212650}

% https://tex.stackexchange.com/a/218826/46403
\newcommand{\cvitemdate}[1]{\sffamily #1}
\newcommand{\cvitemplace}[1]{\sffamily\itshape\footnotesize #1}
\newcommand{\cviteminfo}[1]{\scriptsize #1}

% formating info text
\newcommand{\cvitem}[5]{%
% 1st column
{\cvitemdate{#1}} &%
% 2nd column - first textline
% 2nd column - second textline
\ifthenelse{\equal{#3}{}}{}{%
{\cvitemplace{#3}\par}%
}%
\ifthenelse{\equal{#5}{}}{\vspace{6pt}}{\vspace{3pt}}%
% 2nd column - third textline
\ifthenelse{\equal{#4}{}}{}{%
{\cviteminfo{#4}\par}%
}%
\ifthenelse{\equal{#5}{}}{}{\vspace{3pt}}%
% 2nd column - fourth textline
\ifdefined\isfull%
\ifthenelse{\equal{#5}{}}{}{%
{\cviteminfo{#5}\par}%
}%
\else\fi%
%\vspace*{-\baselineskip}
\tabularnewline%
}

% https://tex.stackexchange.com/a/7348/46403
% ragged2e packages provides text hyphenation in columns
\newcolumntype{L}[1]{>{\raggedright\hspace{0pt}\arraybackslash}p{#1}}   % left with dimension

\newcommand{\colwidth}[1]{%
\dimexpr #1\textwidth-2\tabcolsep%
}%

\begin{document}

\begin{longtable}[!htbp]{|@{}L{\colwidth{0.2}}|L{\colwidth{0.8}}@{}|}

\hline
\cvitem{Itemdate 1}
{Itemplace 1}
{\textbf{Iteminfo 1.1}: \blindtext[1]}
{\textbf{Iteminfo 1.2}: \blindtext[1]}

\hline
\cvitem{Itemdate 2}
{Itemplace 2}
{}
{}

\hline
\cvitem{Itemdate 3}
{}
{}
{}
\hline

\end{longtable}

\end{document}


Online available at https://www.overleaf.com/2032147yzdvhq#/5128620/

Do you want something like this?

I've replaced your definition of \cvitem with this one:

\newcommand{\cvitem}[5]{%
{\cvitemdate{#1}} &%
\ifthenelse{\equal{#3}{}}%
{\vspace*{-\baselineskip}}%
{{\cvitemplace{#3}\par}
\ifthenelse{\equal{#4}{}}%
{\vspace*{-\baselineskip}}%
{{\vspace{6pt}\cviteminfo{#4}\par}
\ifthenelse{\equal{#5}{}}%
{}%
{\ifdefined\isfull\vspace{3pt}{\cviteminfo{#5}\par}\fi%
}%
\vspace*{-\baselineskip}%
}%
}%
\vspace*{-\baselineskip}%
\tabularnewline%
}


Complete MWE:

\documentclass[11pt,paper=a4,11pt,parskip=half,draft]{scrartcl}

\usepackage[utf8x]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}

\usepackage{longtable}
\usepackage{tabularx}
\usepackage{ragged2e}
\usepackage{xcolor}
\usepackage{ifthen}

\usepackage{blindtext}

\definecolor{darkblue}{HTML}{212650}

\newcommand\isfull

% http://tex.stackexchange.com/a/218826/46403
\newcommand{\cvitemdate}[1]{\sffamily #1}
\newcommand{\cvitemplace}[1]{\sffamily\itshape\footnotesize #1}
\newcommand{\cviteminfo}[1]{\scriptsize #1}

% formatting info text
\newcommand{\cvitem}[5]{%
{\cvitemdate{#1}} &%
\ifthenelse{\equal{#3}{}}%
{\vspace*{-\baselineskip}}%
{{\cvitemplace{#3}\par}
\ifthenelse{\equal{#4}{}}%
{\vspace*{-\baselineskip}}%
{{\vspace{6pt}\cviteminfo{#4}\par}
\ifthenelse{\equal{#5}{}}%
{}%
{\ifdefined\isfull\vspace{3pt}{\cviteminfo{#5}\par}\fi%
}%
\vspace*{-\baselineskip}%
}%
}%
\vspace*{-\baselineskip}%
\tabularnewline%
}

% http://tex.stackexchange.com/a/7348/46403
% ragged2e packages provides text hyphenation in columns
\newcolumntype{L}[1]{>{\raggedright\hspace{0pt}\arraybackslash}p{#1}}   % left with dimension

\newcommand{\colwidth}[1]{%
\dimexpr #1\textwidth-2\tabcolsep%
}%

\begin{document}

\begin{longtable}[!htbp]{|@{}L{\colwidth{0.2}}|L{\colwidth{0.8}}@{}|}

\hline
\cvitem{Itemdate 1}
{Itemplace 1}
{\textbf{Iteminfo 1.1}: \blindtext[1]}
{\textbf{Iteminfo 1.2}: \blindtext[1]}

\hline
\cvitem{Itemdate 2}
{Itemplace 2}
{\textbf{Iteminfo 2.1}: \blindtext[1]}
{}

\hline
\cvitem{Itemdate 3}
{Itemplace 3}
{}
{}

\hline
\cvitem{Itemdate 4}
{}
{}
{}
\hline

\end{longtable}

\end{document}


## EDIT

If any between the 3rd, the 4th and the 5th argument can be empty, then replace the above code with:

\newcommand{\cvitem}[5]{%
{\cvitemdate{#1}} &%
\ifthenelse{\equal{#3}{}}
{}
{{\cvitemplace{#3}\par}}%
\ifthenelse{\equal{#4}{}}
{}
{{\vspace{6pt}\cviteminfo{#4}\par}}%
\ifthenelse{\equal{#5}{}}%
{}%
{\ifdefined\isfull\vspace{3pt}{\cviteminfo{#5}\par}\fi}%
\vspace*{-\baselineskip}%
\vspace*{-\baselineskip}%
\tabularnewline%
}

• Great stuff! This is exactly the solution to my problem! Thanks for your help! – hetsch Dec 21 '14 at 10:48
• @hetsch I've simplified the code. Take a look. – karlkoeller Dec 21 '14 at 15:31
• This one looks even better! Thanks again for the refactoring. Where I'm struggling since the first version is that if no 4th argument is passed to the definition the 5th argument is not shown. The third, fourth and fifth argument should be optional ones. Maybe you have an idea where to start? – hetsch Dec 21 '14 at 15:50
• I have got it, somehow. You can find the code at overleaf.com/2032147yzdvhq#/5128620. Your code with  {\vspace*{-\baselineskip}} was the key. – hetsch Dec 21 '14 at 16:27
• @hetsch Your code gives errors. See the edit in my answer for a solution. – karlkoeller Dec 21 '14 at 17:05