JDMCreator / LaTeXTableEditor

readme
MIT License
139 stars 13 forks source link

unable to import Latex code when \cmidrule(lr) present #8

Closed philipps12 closed 2 years ago

philipps12 commented 5 years ago

Hi, the booktabs package allows to shorten rules on one end to make nice sections in your table. This is done by r and/or l in round parantheses after the rule command (e.g. \cmidrule( r){1-1} would draw a rule in the first column with the right end shortened). Whenever such commands are present in the Latex code, the import fails. I am not asking for latex-tables supporting the command, but could you change it such that (lr) is simply ignored and imports? Cheers

JDMCreator commented 5 years ago

Indeed, it is possible to add trimmed borders with the border editor.

Importing tables with trimmed borders was supposed to be supported since version 1.2 (see changelog). However, it seems that it doesn't work anymore. I will look into this issue.

However, you said that the import fails. In my case, the import worked but the result was not the good one. Could you provide a sample of the code that failed ? In my case, I used the following sample :

\begin{table}
\centering
\begin{tabular}{lll} 
\toprule
1a & 2 & 3  \\ \cmidrule(lr){1-3}
4 & 5 & 6  \\
7 & 8 & 9  \\
\bottomrule
\end{tabular}
\end{table}
philipps12 commented 5 years ago

Sry for replying so late... I figured it out. The import of code including trimmed borders fails when [\heavyrulewidth] is used. e.g. this code does not import at all: \begin{table} \centering \begin{tabular}{lll} \toprule 1a & 2 & 3 \\ \cmidrule[\heavyrulewidth](lr){1-3} 4 & 5 & 6 \\ 7 & 8 & 9 \\ \bottomrule \end{tabular} \end{table}

Importing \cmidrule[\heavyrulewidth] without trimmed borders works. Importing \cmidrule(lr) without [\heavyrulewidth] works. Just the combination of the two fails.

JDMCreator commented 5 years ago

I found the issue and corrected it. However, the solution still doesn't allow you to import trimmed borders. However, the borders will be imported as though they weren't trimmed.