1

I'm very new to latex and I'm trying to create a table with a combined row

Table1

As you can see, the combined row is missing the right vertical line, and I'm not able to see the problem myself. The code is:

\documentclass[12pt,a4paper]{article}
\usepackage{tabu}
\usepackage{multirow}
\usepackage{gensymb}
\begin{center}
\begin{tabu} to 1\textwidth { | X[l] | X[c] | X[c] | X[c] | }
\hline
\multicolumn{4}{|l|}{\textbf{Table 5. Cycling protocol }} \\ 
\hline \hline
\textbf{Step} & \textbf{Temperature} & \textbf{Duration} & \textbf{Cycles}\\
\hline
Initial Denaturation & 95\degree C & 3 minutes & 1x\\
\hline
Denaturation & 95\degree C & 30 seconds & \multirow{3}{1em}{35x}\\
Annealing & 53\degree C & 30 seconds  \\
Extension & 72\degree C & 30 seconds \\
\hline
Final Extension & 72\degree C & 7 minutes& 1x\\
\hline
\end{tabu}
\end{center}
  • I couldn't / didn't try (as the code snippet is not a MWE) but what happens when you add a & before the \\ of the "Annealing" and "Extension" line. – albert May 27 '18 at 17:18
  • (i) always provide complete small document begining with \documentclass{...} and ending with \end{document}, which show your problem and which we can copy in compile. (ii) in two rows below \multirow` are missed ampersands, consequently table is not proper terminated and has missed right border line. welcome to tex.se! – Zarko May 27 '18 at 17:30
  • Albert: sorry i don't know what MWE is, but it worked, thanks! – Louise May 27 '18 at 17:37
  • your mwe (minimal working example, a small but complete document) is still not complete. how are defined degree? also is mised \end{document} – Zarko May 27 '18 at 17:38
  • Sorry Zarko! I'll try again – Louise May 27 '18 at 17:38
1

like this?

enter image description here

as i mentioned in my comment, each row should be proper terminated, i.e.: number of ampersands has to be equal to number of columns in this row:

\documentclass{article}
\usepackage{multirow, tabu}
\usepackage{siunitx}

\begin{document}
\begin{center}
\tabulinesep=3pt
\begin{tabu} to 1\textwidth { | X[l] | X[c] | X[c] | X[c] | }
\hline
\multicolumn{4}{|l|}{\textbf{Table 5. Cycling protocol }} \\
\hline \hline
\textbf{Step} & \textbf{Temperature} & \textbf{Duration} & \textbf{Cycles}      \\
\hline
Initial Denaturation
                & \SI{95}{\celsius} & 3 minutes         & 1x                    \\
\hline
Denaturation    & \SI{95}{\celsius} & \SI{30}{seconds}  & \multirow{3}{1em}{35x}\\
Annealing       & \SI{53}{\celsius} & \SI{30}{seconds}  &                       \\ % <---
Extension       & \SI{72}{\celsius} & \SI{30}{seconds}  &                       \\ % <---
\hline
Final Extension & \SI{72}{\celsius} & \SI{7}{minutes}   & 1x                    \\
\hline
\end{tabu}
\end{center}
\end{document}

off-topic: i suggest to use siunitx for writing inits and to table parameter add \tabulinesep=3pt to make more vertical spaces in cells.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.