multicolumn spacing with dotfill in table

I am trying to create a fill in form, I was trying to use a table to achieve my goal but when I use multicolumn I get three problems

1. The dots don't start at the same location when I use multicolumn in the next cell. The first and 3rd row, for example, do not start at the same location as the 2nd and 4th row.

2. I was trying to make one cell longer while making the other cell shorter (by the same distance) in the same row (3rd row in this case) but that didn't work as you can see...

3. The 1st and 3rd row are not of equal length even though the p columns in row 3 should add up to the same width (0.55+0.05+0.15=0.75) as the multicolumn one in row 1 (0.75).

example:

\documentclass[10pt]{article}

\begin{document}

\begin{center}
\begin{tabular}{ p{0.15\linewidth} p{0.35\linewidth} p{0.05\linewidth} p{0.35\linewidth} }
Naam & \multicolumn{3}{ p{0.75\linewidth} }{\dotfill} \\
Datum & \dotfill & Tijd & \dotfill \\
Straat & \multicolumn{1}{p{0.55\linewidth}}{\dotfill} & Nr & \multicolumn{1}{p{0.15\linewidth}}{\dotfill} \\
Postcode & \dotfill & Tel & \dotfill \\
\end{tabular}
\end{center}

\end{document}


The total width of your tabular environment isn't 1\linewidth, but 1\linewidth+8\tabcolsep, i.e., quite a bit more than\linewidth.

As the overall width of the tabular material is supposed to be equal to \linewidth, I suggest you use a tabularx environment and let LaTeX calculate the relative columnwidths. To set the widths of the four X columns suitably, note that 0.6:1.4 = 0.15:0.35.

\documentclass[10pt]{article}
\usepackage{tabularx}
\begin{document}
\noindent
\begin{tabularx}{\linewidth}{ @{}
*{2}{ >{\hsize=0.6\hsize}X >{\hsize=1.4\hsize}X } @{}}
Naam    & \multicolumn{3}{l@{}}{\dotfill} \\
Datum   & \dotfill & Tijd & \dotfill \\
Straat  & \dotfill & Nr   & \dotfill \\
Postcode& \dotfill & Tel  & \dotfill \\
\end{tabularx}
\end{document}

• thank you for your answer, but even in your example. It still did not solve my first problem. The dots in the second, third and fourth row do not start at the same "x-coordinate" as the first row. The dots start a little bit earlier in your example in the first row (and also extend a bit further compared to the other rows). – LinG Jun 3 '17 at 20:18
• @LinG - You're right. Not sure what the cause is. It's not the use of tabularx; the same issue occurs if the relative column widths are calculated explicitly and four p columns are used instead of four X` columns. – Mico Jun 3 '17 at 20:41
• @Mico How can I make \dotfill automatically? – minhthien_2016 Jun 15 '18 at 5:41
• @minhthien_2016 - Please post a new query. – Mico Jun 15 '18 at 6:02