3

I need to reproduce the following table using LaTeX.

Needed LaTeX table

I've tried to use a custom column separator, like @{$\oplus$}, but it affect every line of the table and that is not what I need.

\begin{tabular}{|c@{+}c@{=}c@{+}c@{=}c@{+}c@{+}c|}
    \hline
    cell & cell & cell & cell & cell & cell & cell \\
    \hline
    cell & cell & cell & cell & cell & cell & cell \\
    cell & cell & cell & cell & cell & cell & cell \\
    \hline
\end{tabular}

I would like to be able to use a math symbol in place of + or =, like \oplus.

John Doe
  • 467
  • 4
  • 10
  • You may be looking for align: http://tex.stackexchange.com/questions/44450/how-to-align-a-set-of-multiline-equations -- or alignat: http://tex.stackexchange.com/questions/43464/multiple-alignment-in-equations – Michael Palmer Mar 05 '17 at 16:54

2 Answers2

3

enter image description here

\documentclass{article}

\usepackage{array}

\begin{document}

\setlength\extrarowheight{2pt}
\begin{tabular}{|*{7}{c|}}
    \hline
  \multicolumn{1}{|c!{\makebox[0pt]{$+$}}}{cell}&
  \multicolumn{1}{c!{\makebox[0pt]{$=$}}}{cell}&
  \multicolumn{1}{c!{\makebox[0pt]{$+$}}}{cell}&
  \multicolumn{1}{c!{\makebox[0pt]{$=$}}}{cell}&
  \multicolumn{1}{c!{\makebox[0pt]{$+$}}}{cell}&
  \multicolumn{1}{c!{\makebox[0pt]{$+$}}}{cell}&
  \multicolumn{1}{c|}{cell}\\
    \hline
    cell & cell & cell & cell & cell & cell & cell \\
    cell & cell & cell & cell & cell & cell & cell \\
    \hline
\end{tabular}
\end{document}
David Carlisle
  • 757,742
  • Thank you very much. Subsidiary question: What is the purpose of the \makebox[0pt] command? – John Doe Mar 05 '17 at 17:12
  • 1
    @TomBarthe try it without:-) the content of ! (or @) is at the right hand edge of the previous cell, so if you just did + it would look as if it was to the left of the vertical rule below. \makebox forces it to have zero width overprinting the cell padding on either side so it sits over the | (but put in ++++++ and it will overprint the cell contents with no warning unless you increase \tabcolsep to leave more room. – David Carlisle Mar 05 '17 at 17:16
1

The first table is cleaner, the second table is with the obnoxious vertical rules.

\documentclass{article}
\usepackage{booktabs}

\begin{document}

\begin{tabular}{ c *{6}{@{$\mskip\thickmuskip$}c@{$\mskip\thickmuskip$}c} }
\toprule
cell & $+$ & cell & $=$ & cell & $+$ & cell & $=$ & cell & $+$ & cell & $+$ & cell \\
\midrule
cell && cell && cell && cell && cell && cell && cell \\
cell && cell && cell && cell && cell && cell && cell \\
\bottomrule
\end{tabular}

\bigskip

\begin{tabular}{ |c *{6}{@{$\mskip\thickmuskip$}c@{$\mskip\thickmuskip$}c}| }
\hline
cell & $+$ & cell & $=$ & cell & $+$ & cell & $=$ & cell & $+$ & cell & $+$ & cell \\
\hline
cell &\vline& cell &\vline& cell &\vline& cell &\vline& cell &\vline& cell &\vline& cell \\
\hline
cell &\vline& cell &\vline& cell &\vline& cell &\vline& cell &\vline& cell &\vline& cell \\
\hline
\end{tabular}

\end{document}

enter image description here

egreg
  • 1,121,712