LaTeX forum ⇒ Graphics, Figures & TablesVertical lines breaking in table

Information and discussion about graphics, figures & tables in LaTeX documents.
Robert270706
Posts: 3
Joined: Thu Apr 04, 2024 9:07 am

Vertical lines breaking in table

Postby Robert270706 » Thu Apr 18, 2024 9:08 am

Hi there
I am trying to make a table where "Kriterier" (which means Criteria) and "Ideer" (which means Ideas) to be on seperate lines inside the same box and point toward the row besides it and the column down under respectively.
But when i do the vertical lines break at the top for some reason

This is my latex and also the command "\textrarrow" is just an enclosed rightarrow i have created as a command
\begin{table}[h]
\centering
\begin{tabular}{ |p{4cm}||p{3cm}|p{3cm}|p{3cm}|  }
 \hline
 \multicolumn{4}{|c|}{Idesi} \\
 \hline
 Kriterier \textrarrow  \\ Ideer $\downarrow$ & ISO ALPHA 2 Code &ISO ALPHA 3 Code&ISO numeric Code\\
 \hline
 Afghanistan   & AF    &AFG&   004\\
 Aland Islands&   AX  & ALA   &248\\
 Albania &AL & ALB&  008\\
 Algeria    &DZ & DZA&  012\\
 American Samoa&   AS  & ASM&016\\
 Andorra& AD  & AND   &020\\
 Angola& AO  & AGO&024\\
 \hline
\end{tabular}
\end{table}


Is there anyway to make the vertical lines connect at the top and still keep Criterias and Ideas on seperate lines?
Last edited by Stefan Kottwitz on Thu Apr 18, 2024 9:50 am, edited 1 time in total.
Reason: code marked

Recommended reading 2021:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics
User avatar
Stefan Kottwitz
Site Admin
Posts: 10169
Joined: Mon Mar 10, 2008 9:44 pm

Vertical lines breaking in table

Postby Stefan Kottwitz » Thu Apr 18, 2024 9:51 am

Hi Robert,

the line was ended right after "Kriterier". you can change it this way, filling it up to the end:

Kriterier \textrarrow & \multicolumn{3}{c|}{} \\


Stefan
LaTeX.org admin

User avatar
Stefan Kottwitz
Site Admin
Posts: 10169
Joined: Mon Mar 10, 2008 9:44 pm

Vertical lines breaking in table

Postby Stefan Kottwitz » Thu Apr 18, 2024 9:55 am

By the way, p columns use full justification, so the cell's content can look a bit stretched. You could make it flushleft/raggedright like the following, using the array package:

\documentclass[a4paper,14pt,oneside]{article}
\usepackage{textcomp}
\usepackage{array}
\begin{document}
\begin{table}[h]
\centering
\begin{tabular}{ |p{4cm}|*3{|>{\raggedright\arraybackslash}p{3cm}|} }
\hline
\multicolumn{4}{|c|}{Idesi} \\
\hline
Kriterier \textrightarrow & \multicolumn{3}{c|}{} \\
Ideer $\downarrow$ & ISO ALPHA 2 Code &ISO ALPHA 3 Code&ISO numeric Code\\
\hline
Afghanistan & AF &AFG& 004\\
Aland Islands& AX & ALA &248\\
Albania &AL & ALB& 008\\
Algeria &DZ & DZA& 012\\
American Samoa& AS & ASM&016\\
Andorra& AD & AND &020\\
Angola& AO & AGO&024\\
\hline
\end{tabular}
\end{table}
\end{document}


Stefan
LaTeX.org admin

Robert270706
Posts: 3
Joined: Thu Apr 04, 2024 9:07 am

Vertical lines breaking in table

Postby Robert270706 » Thu Apr 18, 2024 10:07 am

Thank you but the 3rd and 4th vertical line still doesnt go all the way up. Is there anyway to fix this?

User avatar
Stefan Kottwitz
Site Admin
Posts: 10169
Joined: Mon Mar 10, 2008 9:44 pm

Vertical lines breaking in table

Postby Stefan Kottwitz » Thu Apr 18, 2024 10:32 am

Ok, I saw the obvious gap at the right side, that's why my suggestion, but you can easily use & column separators so you have enough empty cells with borders:

Kriterier \textrarrow & & & \\


Stefan
LaTeX.org admin

FPantigny
Posts: 4
Joined: Wed Jul 26, 2023 10:37 pm

Vertical lines breaking in table

Postby FPantigny » Wed Apr 24, 2024 7:27 pm

For information, here is a way to create that table with {NiceTabular} of nicematrix. In this environment, the vertical rules are drawn even if the row is incomplete.

\documentclass[a4paper,14pt,oneside]{article}
\usepackage{nicematrix}

\begin{document}
\begin{table}[h]
\centering
\begin{NiceTabular}{ |p{4cm}*3{||p[l]{3cm}}|}
\Hline
\Block{1-4}{Idesi} \\
\Hline
Kriterier \textrightarrow \\
Ideer $\downarrow$ & ISO ALPHA 2 Code &ISO ALPHA 3 Code&ISO numeric Code\\
\Hline
Afghanistan & AF &AFG& 004\\
Aland Islands& AX & ALA &248\\
Albania &AL & ALB& 008\\
Algeria &DZ & DZA& 012\\
American Samoa& AS & ASM&016\\
Andorra& AD & AND &020\\
Angola& AO & AGO&024\\
\Hline
\end{NiceTabular}
\end{table}
\end{document}


Return to “Graphics, Figures & Tables”

Who is online

Users browsing this forum: No registered users and 9 guests