1

I want to create a document that allows to write into the names of new members joining our club. As these entries are numbered, I figured I made a command generating a command ("entry" in my example) that generates these twopage columns.

To match the size of the page, I used p{0.[13]5\textwidth} in a tabular environment, but the sizes dont match. Even though the widths add up, the table does not match the size of the page, but is smaller. I'm aware of this question(Tabular with p type columns to fill page width), but the solution did not help me, as it made the table even smaller. Additionally, the ratios don't match the desired values at all.

I inserted my file below:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

\usepackage{tabularx}
\usepackage{graphicx}
\usepackage{adjustbox}

\setlength{\parindent}{0cm}


\newcommand{\points}[1]{#1\dots}
\newcommand{\lmulcol}[2]{\multicolumn{#1}{|l|}{\points{#2}}}
\newcommand{\colfour}[1]{\lmulcol{4}{#1}}
\newcommand{\colthree}[1]{\lmulcol{3}{#1}}
\newcommand{\coltwo}[1]{\lmulcol{2}{#1}}
\newcommand{\colone}[1]{\points{#1}}



\newcommand{\entry}[1]{
\textbf{\Large{#1}}

\vspace{3em}
\begin{tabular}{|p{0.15\textwidth}|
                 p{0.35\textwidth}|
                 p{0.35\textwidth}|
                 p{0.15\textwidth}|}
%\begin{tabular}{|p{\dimexpr 0.15\linewidth-2\tabcolsep}|
%                 p{\dimexpr 0.35\linewidth-2\tabcolsep}|
%                 p{\dimexpr 0.35\linewidth-2\tabcolsep}|
%                 p{\dimexpr 0.15\linewidth-2\tabcolsep}|}
\colfour{Name:}\\
\colfour{Forename:}\\
\coltwo{Date of Birth:} & \coltwo{Place of Birth:}\\
\colone{Adress:} & \colthree{} \\
& \colthree{}\\

\hline

\colone{Reference1:} & \coltwo{} & \colone{Page}\\
\colone{References:} & \coltwo{1} & \colone{Page}\\
                     & \coltwo{2} & \colone{Page}\\
                     & \coltwo{3} & \colone{Page}\\
                     & \coltwo{4} & \colone{Page}\\

\end{tabular}
}


\begin{document}


\entry{601}

TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT 
TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT 
TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT 
TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT 
TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT 
TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT 
TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT 
TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT 
TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT 
TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT 
TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT 
TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT 
TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT
\end{document}

The block of TEXT is to show that textwidth is actually larger.
I also added the table as I get it: I also added the table as I get it

  • 1
    you have \tabcolsep space on either side of each column plus the \tabrulewidth space taken up by each vertical rule, you have only taken account of \tabcolsep – David Carlisle Mar 6 '18 at 23:02
  • I just added comment that to show, that the solution of the linked thread did not work; this image was created without the \tabcolsep-command. It's edited correctly now – Tarirah Mar 6 '18 at 23:12
1

The main issue is that almost all your p column width specifications were over-written by multicolumn{..}{l} settings so the table was set to the natural content width.

Here I add an extra line to show the difference if your real example could have more text then that solves it, otherwise you need to fiddle a bit more to hide the extra |

enter image description here

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

\usepackage{tabularx}
\usepackage{graphicx}
\usepackage{adjustbox}

\setlength{\parindent}{0cm}

\newlength\mylen

\newcommand{\points}[1]{#1\dots}
\newcommand{\lmulcol}[2]{\multicolumn{#1}{|l|}{\points{#2}}}
\newcommand{\colfour}[1]{\lmulcol{4}{#1}}
\newcommand{\colthree}[1]{\lmulcol{3}{#1}}
\newcommand{\coltwo}[1]{\lmulcol{2}{#1}}
\newcommand{\colone}[1]{\points{#1}}



\newcommand{\entry}[1]{%
{\Large\textbf{\Large #1}\par}%\textbf{\Large{#1}}

\vspace{3em}

\setlength\mylen{\dimexpr\linewidth-8\tabcolsep-5\arrayrulewidth}
\begin{tabular}{|p{\dimexpr 0.15\mylen}|
                 p{\dimexpr 0.35\mylen}|
                 p{\dimexpr 0.35\mylen}|
                 p{\dimexpr 0.15\mylen}|}
\colfour{Name:}\\
\colfour{Forename:}\\
\coltwo{Date of Birth:} & \coltwo{Place of Birth:}\\
\colone{Adress:} & \colthree{} \\
& \colthree{}\\

\hline

\colone{Reference1:} & \coltwo{} & \colone{Page}\\
\colone{References:} & \coltwo{1} & \colone{Page}\\
                     & \coltwo{2} & \colone{Page}\\
                     & \coltwo{3} & \colone{Page}\\
                     & \coltwo{4} & \colone{Page}\\
\ &\ &\ &\ 
\end{tabular}
}


\begin{document}


\entry{601}

TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT 
TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT 
TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT 
TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT 
TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT 
TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT 
TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT 
TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT 
TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT 
TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT 
TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT 
TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT 
TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT
\end{document}
  • Thank you! Is there any way to keep the outer margins and let the inner be computed "automagically"? – Tarirah Mar 6 '18 at 23:51
  • 1
    @Tarirah probably (you may not need a table at all) but the layout isn't that clear do any of the entries need multi-line paragraphs, that is do you need p columns at all? – David Carlisle Mar 7 '18 at 0:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.