2

enter image description here

I would like to create "description cards" like these in latex with tables. But I haven't found a good way to create them.

The basic idea is to create a variable column header (more than 2, in case its needed) with a big textbox below, which ideally supports images.

Whats a good way to do this?

1
  • 1
    Try with tabularx (2 X columns and a \multicolumn{2} for the lower part).
    – Bernard
    Aug 15, 2020 at 9:41

3 Answers 3

3

Probably the following can help get you started. Details such as spacing and alignment can of course be adjusted to suit your needs.

enter image description here

\documentclass{article}
\usepackage{graphicx}
\usepackage{lipsum} % for dummy text
\begin{document}
\noindent
\begin{tabular}{*{2}{|p{\dimexpr 0.5\textwidth-2\tabcolsep}}|}
\hline
\bfseries text & \bfseries other text\\
\hline
\multicolumn{2}{|p{\dimexpr \textwidth-2\tabcolsep}|}{\lipsum[1]}\\
\hline
\end{tabular}

\noindent
\begin{tabular}{*{2}{|p{\dimexpr 0.5\textwidth-2\tabcolsep}}|}
\hline
\bfseries text & \bfseries other text\\
\hline
\multicolumn{2}{|p{\dimexpr \textwidth-2\tabcolsep}|}{\includegraphics[width=2cm]{example-image}

\lipsum[1]}
\\
\hline
\end{tabular}

\noindent
\begin{tabular}{*{4}{|p{\dimexpr 0.25\textwidth-2\tabcolsep}}|}
\hline
\bfseries text & \bfseries other text &\bfseries text & \bfseries other text\\
\hline
\multicolumn{4}{|p{\dimexpr \textwidth-2\tabcolsep}|}{\lipsum[1]}\\
\hline
\end{tabular}
\end{document}
4

enter image description here


\documentclass{article}
\usepackage{makecell,tabularx}
\setcellgapes{3pt}
\makegapedcells
\setlength\parindent{0pt}

\usepackage{lipsum}

\begin{document}
\begin{tabularx}{\linewidth}{|X|X|}
    \hline
text text   &   text text text  \\
    \hline
\multicolumn{2}{|>{\hsize=\dimexpr2\hsize+2\tabcolsep+\arrayrulewidth}X|}
            {\lipsum[1]}        \\
    \hline
\end{tabularx}
\end{document}
3

Here's a solution that creates a macro called \mergedtab which takes three arguments.

enter image description here

\documentclass{article}
\usepackage{lipsum}
\usepackage{tabularx}
\newcolumntype{Y}{>{\hsize=\dimexpr2\hsize+2\tabcolsep+\arrayrulewidth\relax}X}

\newcommand{\mergedtab}[3]{%
   \par\bigskip\noindent
   \begingroup
   \setlength\extrarowheight{2pt}
   \frenchspacing
   \begin{tabularx}{\textwidth}{|X|X|}
   \hline
   #1 & #2 \\
   \hline
   \multicolumn{2}{|Y|}{#3} \\
   \hline
   \end{tabularx}\endgroup\par\bigskip}
  
\begin{document}
\mergedtab{Donaudampf\dots}{/naval/rivers/donau/\dots}{\lipsum[2]}
\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .