[Tex/LaTex] \vline for a table

rulestables

I am using the tabular environment with 3 columns in LaTeX. I want to separate column 1 from columns 2 and 3 using a vertical line.

Right now I can only create a vertical line in each row separately, and the result is that the lines do not match up from row to row.

\begin{table}{ht}
\caption{Model Input Information: Materials}
\centering
\begin{tabular}{c c c}
\hline\hline
Available Materials \vline & Material Input Parameters & Description \\
\hline

Fused Silica (delta eV = 9) & alpha & Avalanche Coefficient [$cm{^2}$/J] \\
Fused Silica (delta eV = 7.5) & delta eV & Material Band Gap [eV] \\
GaAs & me & Effective Electron Mass [kg] \\
ZnSe & n0 & Linear Refractive Index \\
Ge & n2 & Non-Linear Refractive Index \\
$HfO_2$ & T & Effective Decay Constant [fs] \\
$TiO_2$ & & \\
$Ta_2O_5$ & & \\
$Al_2O_3$ & & \\
$SiO_2$ & & \\

\hline
\end{tabular}
\label{table:MaterialInputs}
\end{table}

That \vline I have in the first row is there to show how I was trying to do it originally.

Best Answer

A | in the table format specification means a vertical rule:

\documentclass{article}

\begin{document}

\begin{table}[ht]
\caption{Model Input Information: Materials}
\centering
\begin{tabular}{c | c | c}
\hline\hline
Available Materials & Material Input Parameters & Description \\
\hline

Fused Silica (delta eV = 9) & alpha & Avalanche Coefficient [$cm{^2}$/J] \\
Fused Silica (delta eV = 7.5) & delta eV & Material Band Gap [eV] \\
GaAs & me & Effective Electron Mass [kg] \\
ZnSe & n0 & Linear Refractive Index \\
Ge & n2 & Non-Linear Refractive Index \\
$HfO_2$ & T & Effective Decay Constant [fs] \\
$TiO_2$ & & \\
$Ta_2O_5$ & & \\
$Al_2O_3$ & & \\
$SiO_2$ & & \\

\hline
\end{tabular}
\label{table:MaterialInputs}
\end{table}

\end{document}

enter image description here

Some remarks:

  1. I'd suggest you not to use vertical rules, and use the features from the booktabs package.

  2. To properly typeset chemical compounds, you can use a variety of packages. In the example below I used \ce from mhchem.

  3. To appropriately typeset units, I'd suggest the siunitx packge.

  4. Notice also that the placement specifier should go inside square brackets, as in

     \begin{table}[ht]
    

An example code showing some of these suggestions:

\documentclass{article}
\usepackage{booktabs}
\usepackage{siunitx}
\usepackage{mhchem}

\sisetup{per-mode = symbol}

\begin{document}

\begin{table}[ht]
\caption{Model Input Information: Materials}
\centering
\begin{tabular}{c  c  c}
\toprule
Available Materials & Material Input Parameters & Description \\
\midrule

Fused Silica (delta eV = 9) & alpha & Avalanche Coefficient [\si{\cm\squared\per\joule}] \\
Fused Silica (delta eV = 7.5) & delta eV & Material Band Gap [\si{\electronvolt}] \\
\ce{GaAs} & me & Effective Electron Mass [\si{\kilogram}] \\
\ce{ZnSe} & n0 & Linear Refractive Index \\
\ce{Ge} & n2 & Non-Linear Refractive Index \\
\ce{HfO_2} & T & Effective Decay Constant [fs] \\
\ce{TiO_2} & & \\
\ce{Ta_2O_5} & & \\
\ce{Al_2O_3} & & \\
\ce{SiO_2} & & \\

\bottomrule
\end{tabular}
\label{table:MaterialInputs}
\end{table}

\end{document}

enter image description here