How to handle input strings in tables, when the input string has line breaks in it?
Use a \Longunderstack
or a \Longstack
.
EDITED to handle case where a macro containing the data is to be set in a stack (per the OP's comments). In this case, the line
\setDocName{Video Endoscope \& Imaging Module \\DVT Support Manual}
places the data in the variable \@setDocName
. At a later point, the contents of \@setDocName
are to be set in a \Longunderstack
.
\documentclass{article}
\usepackage{tabularx,stackengine}
\setstackEOL{\\}
\makeatletter
\def\setDocName#1{\def\@setDocName{#1}}
\newcommand{\DocName}{%
\def\tmp{\Longunderstack[l]}%
\expandafter\tmp\expandafter{\@setDocName}%
}
\makeatother
\begin{document}
\setDocName{Video Endoscope \& Imaging Module \\DVT Support Manual}
\newlength{\headerwidth}
\setlength{\headerwidth}{\textwidth}
%This table holds the document name.
\hspace{-6mm}
\begin{tabularx}{\headerwidth}{|c|X|c|} \hline
%& \\
\footnotesize \sffamily{\textbf{Dokument-/Dateiname:}} & \\
\footnotesize \sffamily{\textbf{Document-/File-Name:}} & \DocName \\
\hline
\end{tabularx}
\end{document}