4

I need to explain the order of pages of an excel sheet, which takes in print as PDF eight pages. To this end I'd like to provide a picture of these eight pages and add text.

The tabular cells need to have the aspect ratio of a page, more or less.

My idea was to use a tabular with eight cells in two rows, enlarge the row height and to get dotted or dashed lines I use nicematrix.

The following code works, but unfortunately the last \\ leads to vertical dotted lines below the second and last row of the table.

Code:

\documentclass[pagesize, ngerman, fontsize=12pt, parskip=half]{scrartcl}
\usepackage[T1]{fontenc}\usepackage[utf8]{inputenc}
\usepackage{babel, libertine, nicematrix, ragged2e}

\begin{document}

\setlength\extrarowheight{100pt}

\begin{NiceTabular}{:>{\RaggedRight}p{3cm}:>{\RaggedRight}p{3cm}:>{\RaggedRight}p{3cm}:>{\RaggedRight}p{3cm}:}\hdottedline upper half, page 1 & upper half, page 2 & upper half, page 3 & upper half, page 4 \\hdottedline lower half, page 5 & lower half, page 6 & lower half, page 7 & lower half, page 8 \\hdottedline \end{NiceTabular}

\end{document}

Result:

nicematrix tabular pic

Obviously I don't want the dotted vertical lines below the second row. Howto?

By the way, how can I get the text of the first row printed in the top of the cells?

Keks Dose
  • 30,892

3 Answers3

3

You can draw all the lines using the \CodeAfter and a custom tikz dot pattern.

e

\documentclass[pagesize, ngerman, fontsize=12pt, parskip=half]{scrartcl}
\usepackage[T1]{fontenc}\usepackage[utf8]{inputenc}
\usepackage{babel, libertine, nicematrix, ragged2e}

\usepackage{tikz} % added <<<<<<<<<<

\tikzset{% dot pattern <<<<<<<<<<<< dots/.style={ color=blue, line width=1.3pt, line cap=round, dash pattern=on 0pt off 4.4pt } }

\newlength{\basewidth} \setlength{\basewidth}{0.2\textwidth} % width of the "pages"

\begin{document}

\setlength\extrarowheight{1.41\basewidth} % form factor of A4 page= 1.41
\begin{NiceTabular}{*{4}{p{\basewidth}}}
upper half, page  1 &amp; upper half, page  2 &amp; upper half, page  3 &amp; upper half, page  4 \\ 
lower half, page  5 &amp; lower half, page  6 &amp; lower half, page  7 &amp; lower half, page 8 \\
\CodeAfter
\tikz \draw [dots] (1-|1) -- (1-|5);
\tikz \draw [dots] (2-|1) -- (2-|5);
\tikz \draw [dots] (3-|1) -- (3-|5);
\tikz \draw [dots] (1-|1) -- (3-|1);
\tikz \draw [dots] (1-|2) -- (3-|2);
\tikz \draw [dots] (1-|3) -- (3-|3);
\tikz \draw [dots] (1-|4) -- (3-|4);
\tikz \draw [dots] (1-|5) -- (3-|5);

\end{NiceTabular}

\end{document}

Simon Dispa
  • 39,141
3

With use of the tabularray is no such problem:

\documentclass[pagesize, ngerman, fontsize=12pt, parskip=half]{scrartcl}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage{libertine}
\usepackage{tabularray}

\begin{document}

\begin{tblr}{hlines={dotted}, vlines={dotted},
             rows={abovesep+=100pt},
             colspec ={*{4}{X[l,b]}}
            } 

upper half, page 1 & upper half, page 2 & upper half, page 3 & upper half, page 4 \ lower half, page 5 & lower half, page 6 & lower half, page 7 & lower half, page 8 \ \end{tblr}

\end{document}

enter image description here

Addendum: From your answer can be concluded, that you meanwhile change desired table format as solution for your question. IN your answer present result can be simply and elegant reproduced by use of tabularray package without any additional packages and care for their order of loadings. Code is short, clear and can be simple customizable:

\documentclass[pagesize, ngerman, fontsize=12pt, parskip=half]{scrartcl}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage{libertine}
\usepackage{tabularray}

\begin{document}

\begin{tblr}{hlines={dashed}, vlines={dashed},
             rows={ht=42.426mm}, % 30 mm x sqrt{2}, 
             colspec ={*{4}{X[l,m, wd=30mm]}}
            }

Obere Hälfte, Blatt 1 & Obere Hälfte, Blatt 2 & Obere Hälfte, Blatt 3 & Obere Hälfte, Blatt 4 \ Obere Hälfte, Blatt 5 & Obere Hälfte, Blatt 6 & Obere Hälfte, Blatt 7 & Obere Hälfte, Blatt 8 \ \end{tblr}

\end{document}

enter image description here

Zarko
  • 296,517
1

While I was on a train yesterday, I figured out a solution using the package arydshln:

\documentclass[pagesize, ngerman, fontsize=12pt, parskip=half]{scrartcl}
\usepackage[T1]{fontenc}\usepackage[utf8]{inputenc}
\usepackage{babel, libertine, ragged2e}

%\usepackage{nicematrix}

\usepackage{array} \usepackage{arydshln}

\begin{document}

% \setlength\extrarowheight{100pt}

% \begin{NiceTabular}{:>{\RaggedRight}p{3cm}:>{\RaggedRight}p{3cm}:>{\RaggedRight}p{3cm}:>{\RaggedRight}p{3cm}:}\hdottedline % upper half, page 1 & upper half, page 2 & upper half, page 3 & upper half, page 4 \\hdottedline % lower half, page 5 & lower half, page 6 & lower half, page 7 & lower half, page 8 \\hdottedline % \end{NiceTabular}

\begin{tabular}[t]{:@{}m{0pt}>{\RaggedRight}p{3cm}:>{\RaggedRight}p{3cm}:>{\RaggedRight}p{3cm}:>{\RaggedRight}p{3cm}:}\hdashline \rule{0pt}{4.4cm} & Obere Hälfte, Blatt 1 & Obere Hälfte, Blatt 2 & Obere Hälfte, Blatt 3 & Obere Hälfte, Blatt 4 \\hdashline \rule{0pt}{4.4cm} & Untere Hälfte, Blatt 5 & Untere Hälfte, Blatt 6 & Untere Hälfte, Blatt 7 & Untere Hälfte, Blatt 8 \\hdashline \end{tabular} \end{document}

To get a fixed height I added an empty, 0pt-width column. First I added it at the end of the tabular. Result: ugly, because then the horizontal lines were longer than desired. So I moved it to become the first row. And it is an »m« row, so the text in the cells is printed vertically centered.

Second thing to pay attention to: array needs to be loaded before arydshln.

It really is nice to see that we have so many main line tabular packages.

arydshln solution

Keks Dose
  • 30,892