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{\cvitemhead}[1]{\sffamily\textcolor{darkblue}{\bfseries #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
{\cvitemhead{#2}\par}%
% 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}
{Itemhead 1}
{Itemplace 1}
{\textbf{Iteminfo 1.1}: \blindtext[1]}
{\textbf{Iteminfo 1.2}: \blindtext[1]}
\hline
\cvitem{Itemdate 2}
{Itemhead 2}
{Itemplace 2}
{}
{}
\hline
\cvitem{Itemdate 3}
{Itemhead 3}
{}
{}
{}
\hline
\end{longtable}
\end{document}
Online available at https://www.overleaf.com/2032147yzdvhq#/5128620/