0

I am trying to replicate this table in LaTeX and I am having some trouble getting the lines to connect.

enter image description here

Here is what I am actually getting:

enter image description here

Here are the packages I am using:

% Packages
\usepackage{times}
\usepackage[english]{babel}
\usepackage{hyperref}
\usepackage{fancyhdr}
\usepackage[dvipsnames]{xcolor}
\usepackage{listings}
\usepackage{parcolumns}
\usepackage{algorithm}
\usepackage{algorithmicx}
\usepackage{algpseudocode}
\usepackage{enumitem}
\usepackage{geometry}
\usepackage{soul}
\usepackage{graphicx}
\usepackage{enumitem}
\usepackage{csquotes}
\usepackage{bookmark}
\usepackage{mdframed}
\usepackage{mathtools}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{aliascnt}
\usepackage{mhchem}
\usepackage{chemfig}
\usepackage{array}
% \usepackage{booktabs}
\usepackage{multicol}
\usepackage[toc]{appendix}
\usepackage[
  backend=biber,%
  style=chem-acs%
]{biblatex}

And here is how I have the table typeset in my report:

%! TEX root = ../main.tex

\begin{table}[h!]
  \centering
  \begin{tabular}{|l|l|c|l|l|c|l|l|c|l|l|}
    \hline\\
    $Q_r$ of $R_1$ & $R_1$ & Plus & $Q_r$ of $R_2$ & $R_2$ & Yields & $Q_r$ of $P_1$ & $P_1$ & Plus & $Q_r$ of $P_2$ & $P_2$\\
    \hline\\
    & & & & & & & & & &\\
    \hline\\
    & & & & & & & & & &\\
    \hline\\
    & & & & & & & & & &\\
    \hline\\
    & & & & & & & & & &\\
    \hline\\
    & & & & & & & & & &\\
    \hline\\
    & & & & & & & & & &\\
    \hline\\
    & & & & & & & & & &\\
    \hline\\
    & & & & & & & & & &\\
    \hline\\
    & & & & & & & & & &\\
    \hline\\
    & & & & & & & & & &\\
    \hline
  \end{tabular}
\end{table}

I am aware that the Booktabs package doesn't work well with vertical lines and the general consensus is to just not use them -- but I am trying to replicate this table exactly how it was given to me in the prompt. Why am I unable to get all of the column's vertical lines to match up properly? It clearly works for the first column but goes back to its disconnection in the rest.

4
  • 2
    Welcome to TeX:SE! Remove all \\ after \hline.
    – Zarko
    Jun 16, 2021 at 4:20
  • @Zarko That worked! Not sure what made me think I had to use the \\ before, some older reports I had used that. Thank you! Jun 16, 2021 at 4:31
  • BTW, in your document preamble is missed \documentclass{...}, package \hyperref had to be load last, each package should be loaded only ones (remove duplicates), Please, in future provide MWE (Minimal working Example), a small but complete document beginning with \documentclas and ending with \end{document} and have loaded only to your problem related packages (in your case is no one), which reproduce your problem. So the MWE with solution of your problem is
    – Zarko
    Jun 16, 2021 at 4:32
  • \documentclass{article} \begin{document} \begin{table}[ht] \centering \begin{tabular}{|l|l|c|l|l|c|l|l|c|l|l|} \hline $Q_r$ of $R_1$ & $R_1$ & Plus & $Q_r$ of $R_2$ & $R_2$ & Yields & $Q_r$ of $P_1$ & $P_1$ & Plus & $Q_r$ of $P_2$ & $P_2$\\ \hline & & & & & & & & & &\\ \hline & & & & & & & & & &\\ \hline \end{tabular} \end{table} \end{document}
    – Zarko
    Jun 16, 2021 at 4:32

1 Answer 1

1

Have a look:

\begin{table}[h!]
  \centering
  \begin{tabular}{|l|l|c|l|l|c|l|l|c|l|l|}
    \hline
    $Q_r$ of $R_1$ & $R_1$ & Plus & $Q_r$ of $R_2$ & $R_2$ & Yields & $Q_r$ of $P_1$ & $P_1$ & Plus & $Q_r$ of $P_2$ & $P_2$\\    \hline
    & & & & & & & & & &\\   \hline
    & & & & & & & & & &\\   \hline
    & & & & & & & & & &\\   \hline
    & & & & & & & & & &\\   \hline
    & & & & & & & & & &\\   \hline
    & & & & & & & & & &\\   \hline
    & & & & & & & & & &\\   \hline
    & & & & & & & & & &\\   \hline
    & & & & & & & & & &\\   \hline
    & & & & & & & & & &\\   \hline
  \end{tabular}
\end{table}

enter image description here

You must log in to answer this question.

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