Making Vertical Lines in Table - Latex

In summary, the conversation discusses how to create a vertical line in a table using latex codes. The original code is missing a continuous vertical line, but this can be fixed by adding an extra empty column.
  • #1
Rajini
621
4
Dear all,
I want to make a vertical line in table..
I use this following latex codes
Code:
\begin{table}[h]
\caption{Some caption.}\label{namelab}
\vspace{2mm}
\centering
\begin{tabular}[width=1\textwidth]{ll|cccc}
\hline\hline
\multicolumn{2}{c}{2~col} & par~1 & par~2 & par~3 & par~4\\
\hline
1 & at RT                 & 56   & d1    & 0.25 & 0.3\\
  & 4.2~K                 & 59   & d2    & 0.25 & 0.2\\
\hline\hline
\end{tabular}
\end{table}
When i compiled it i got a good table..but the vertical line is not continuous..please see the figure attached..no line after '2 col'.
Thanks for your help
 

Attachments

  • table.bmp
    127.1 KB · Views: 521
Physics news on Phys.org
  • #2
yeah i don't think it works well, you can fix it by adding another column, empty:

Code:
\begin{table}[h]
\caption{Some caption.}\label{namelab}
\vspace{2mm}
\centering
\begin{tabular}[width=1\textwidth]{lll|cccc}
\hline\hline
\multicolumn{2}{c}{2~col}&& par~1 & par~2 & par~3 & par~4\\
\hline
1 & at RT               && 56   & d1    & 0.25 & 0.3\\
  & 4.2~K               && 59   & d2    & 0.25 & 0.2\\
\hline\hline
\end{tabular}
\end{table}
 
  • #3
oh..thanks..
simple trick!
 

1. How do I create vertical lines in a table using Latex?

To create vertical lines in a table in Latex, you can use the vertical bar symbol (|) in the table's column specification. For example, if you want a table with 3 columns, with 2 vertical lines separating them, your column specification would be "c|c|c".

2. Can I customize the thickness of the vertical lines in my table?

Yes, you can customize the thickness of the vertical lines by using the \vline command instead of the vertical bar symbol. You can specify the thickness in the command, for example, \vline[2pt] will create a vertical line with a thickness of 2 points.

3. How do I remove vertical lines from a specific column in a table?

To remove vertical lines from a specific column in a table, you can use the "c" column specifier instead of the vertical bar symbol. This will create a column without any vertical lines.

4. Is it possible to add vertical lines to only certain rows in a table?

Yes, you can add vertical lines to only certain rows in a table by using the \cline command. This command takes two parameters - the starting and ending columns for the vertical lines. For example, \cline{2-4} will add vertical lines from column 2 to column 4 in a table.

5. How can I change the color of the vertical lines in my table?

To change the color of the vertical lines in your table, you can use the \arrayrulecolor command. This command takes one parameter - the color you want to use. For example, \arrayrulecolor{blue} will make all the vertical lines in your table blue.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
9
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
7
Views
7K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
5K
Back
Top