Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multirow / Mulitcolumn failure #349

Open
riklopfer opened this issue Mar 23, 2022 · 0 comments
Open

Multirow / Mulitcolumn failure #349

riklopfer opened this issue Mar 23, 2022 · 0 comments

Comments

@riklopfer
Copy link

pulled a single table from the examples page, and it generates an invalid tex file. Appears to be missing \usepackage{multirow} ?

import sys

from pylatex import Document, Section, Tabular, MultiColumn, MultiRow


def test_example3():
    doc = Document("broken")
    section = Section('Multirow Test')

    table3 = Tabular('|c|c|c|')
    table3.add_hline()
    table3.add_row((MultiColumn(2, align='|c|',
                                data=MultiRow(2, data='multi-col-row')), 'X'))
    table3.add_row((MultiColumn(2, align='|c|', data=''), 'X'))
    table3.add_hline()
    table3.add_row(('X', 'X', 'X'))
    table3.add_hline()

    section.append(table3)

    doc.append(section)

    doc.generate_pdf(clean_tex=False)


if __name__ == '__main__':
    sys.exit(test_example3())

There is quite a bit of output, but here are what I believe to be the important parts

stdout,

! Undefined control sequence.
\@sharp ->\multirow 
                    {2}{*}{multi{-}col{-}row}
l.16 ...}{|c|}{\multirow{2}{*}{multi{-}col{-}row}}
                                                  &X\\%

Package lastpage Warning: Rerun to get the references right on input line 24.

broken.log

! Undefined control sequence.
\@sharp ->\multirow 
                    {2}{*}{multi{-}col{-}row}
l.16 ...}{|c|}{\multirow{2}{*}{multi{-}col{-}row}}
                                                  &X\\%
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

broken.tex

\documentclass{article}%
\usepackage[T1]{fontenc}%
\usepackage[utf8]{inputenc}%
\usepackage{lmodern}%
\usepackage{textcomp}%
\usepackage{lastpage}%
%
%
%
\begin{document}%
\normalsize%
\section{Multirow Test}%
\label{sec:MultirowTest}%
\begin{tabular}{|c|c|c|}%
\hline%
\multicolumn{2}{|c|}{\multirow{2}{*}{multi{-}col{-}row}}&X\\%
\multicolumn{2}{|c|}{}&X\\%
\hline%
X&X&X\\%
\hline%
\end{tabular}

%
\end{document}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant