4

I hope you can help me out as I've been struggling with this for quite a while.

I'm trying to add a vertical line before and after the multicolumn holding "Capacity [MW]" so the two lines (before "Spain" and after "Portugal") continues to the top - please see picture.

Table

My code is here. Please note, that I use the \usepackage{makecell}.

\begin{table}[htbp]
\caption{Assumed transmission capacity for the Balmorel model.}
\centering
\begin{tabular}{l|c|c|c|c}
\hline
\multicolumn{2}{c}{}            &\multicolumn{2}{c}{\thead{\textbf{Capacity [MW]}}} &\textbf{}\\
\hline
\textbf{Technology type}                &\textbf{Fuel}      &\textbf{Spain}       &\textbf{Portugal}                &\textbf{Efficiency}\\
\hline
 PT $\rightarrow$ ES                    & 2954              & 3500              & 3500                          &5\% \\
 ES $\rightarrow$ PT                    & 2085              & 4200              & 4200                          &5\% \\
\hline 
 FR $\rightarrow$ ES                    & 450               & 2800              & 8000                          &5\% \\ 
 ES $\rightarrow$ FR                    & 325               & 2500              & 8000                          &5\% \\
\hline
\end{tabular}
\label{tab:transcap}
\end{table}

Thanks in advance!

1
  • Hi esdd, Nice. That works! Appreciate your help!
    – Henryh
    Commented Dec 6, 2016 at 15:42

1 Answer 1

4

You can add a | to multicolumn commands (\multicolumn{2}{c|}) like this

\documentclass{article} 
\usepackage{makecell}

\begin{document}
\begin{table}[htbp]
\caption{Assumed transmission capacity for the Balmorel model.}
\centering
\begin{tabular}{l|c|c|c|c}
\hline
\multicolumn{2}{c|}{}            &\multicolumn{2}{c|}{\thead{\textbf{Capacity [MW]}}} &\textbf{}\\
\hline
\textbf{Technology type}                &\textbf{Fuel}      &\textbf{Spain}       &\textbf{Portugal}                &\textbf{Efficiency}\\
\hline
 PT $\rightarrow$ ES                    & 2954              & 3500              & 3500                          &5\% \\
 ES $\rightarrow$ PT                    & 2085              & 4200              & 4200                          &5\% \\
\hline 
 FR $\rightarrow$ ES                    & 450               & 2800              & 8000                          &5\% \\ 
 ES $\rightarrow$ FR                    & 325               & 2500              & 8000                          &5\% \\
\hline
\end{tabular}
\label{tab:transcap}
\end{table}
\end{document}

In other combinations (e.g. \multicolumn{2}{|c|} in central columns) vertical lines seem to be not well aligned.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .