0

This is just a simple testing of Excel2Latex:

Table in Excel

Table in Excel

Table converted to Latex by Excel2Latex

Table converted to Latex by Excel2Latex

Code in Latex for the table given by Excel2Latex:

% Table generated by Excel2LaTeX from sheet 'Hoja1'
\begin{table}[htbp]
    \centering
    \caption{Add caption}
    \begin{tabular}{|c|ccccc|c|}
        \toprule
        & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{1} & \multicolumn{1}{c|}{2} & \multicolumn{1}{c|}{3} & 4     & 5 \\
        \midrule
        0     & \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{} &       &  \\
        \midrule
        1     & \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{} &       &  \\
        \cmidrule{1-1}\cmidrule{3-7}    2     & \multicolumn{2}{c|}{} & \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{} &       &  \\
        \cmidrule{1-1}\cmidrule{4-7}    3     & \multicolumn{3}{c|}{} & \multicolumn{1}{c|}{} &       &  \\
        \cmidrule{1-1}\cmidrule{5-7}    4     & \multicolumn{4}{c|}{}         &       &  \\
        \cmidrule{1-1}\cmidrule{6-7}    5     & \multicolumn{5}{c|}{}                 &  \\
        \bottomrule
    \end{tabular}%
    \label{tab:addlabel}%
\end{table}%

I have installed all the necessary packages and the file compiles without errors, but the output is obviously unacceptable.

Is it possible to make any adjustments to get the conversions from Excel to Latex correct?

  • 2
    you have not shown usable code but \midrule suggests you are using booktabs whch explicitly documents that it is incompatible with vertical rules. Use \hline – David Carlisle Nov 14 '22 at 12:51
  • 1
    You could try to see if the result is better when you unselect the Booktabs package option in the Excel2LaTeX window. – Marijn Nov 14 '22 at 12:57
  • 1
    Uncheck the "Booktabs package" from Options in Excel2Latex before saving. – Simon Dispa Nov 14 '22 at 12:57
  • 1
    However, if you want to keep using booktabs, you can also follow the advice in https://tex.stackexchange.com/a/399741/ and add \aboverulesep=0ex \belowrulesep=0ex \renewcommand{\arraystretch}{1.5} before your table to remove the gaps. – Marijn Nov 14 '22 at 13:09
  • Thank you, David. But, what is the equivalent for \cmidrule? – Jesús Álvarez Lobo Nov 14 '22 at 13:13
  • The bug with vertical lines is solved "Unchecking the "Booktabs package" from Options in Excel2Latex before saving", sugested by Simon Dispa and Marijin. Thank you very much to all!. – Jesús Álvarez Lobo Nov 14 '22 at 13:22
  • \crule is the non booktabs command – David Carlisle Nov 14 '22 at 15:08

0 Answers0