PyLatex - Using Only Table Rather Than Whole Document
up vote
1
down vote
favorite
I have created a document base on this example. But I want to use only table part rather than whole document.
I have spent plenty of time libraries of PyLaTeX. I could not find how I can do.
pylatex
add a comment |
up vote
1
down vote
favorite
I have created a document base on this example. But I want to use only table part rather than whole document.
I have spent plenty of time libraries of PyLaTeX. I could not find how I can do.
pylatex
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I have created a document base on this example. But I want to use only table part rather than whole document.
I have spent plenty of time libraries of PyLaTeX. I could not find how I can do.
pylatex
I have created a document base on this example. But I want to use only table part rather than whole document.
I have spent plenty of time libraries of PyLaTeX. I could not find how I can do.
pylatex
pylatex
asked Dec 1 at 13:03
i2_
954
954
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
2
down vote
accepted
The LongTable
class has the generate_tex
method, so you can do
from pylatex import LongTable, MultiColumn
# Generate data table
data_table = LongTable('lll')
data_table.add_hline()
data_table.add_row(["header 1", "header 2", "header 3"])
data_table.add_hline()
data_table.end_table_header()
data_table.add_hline()
data_table.add_row((MultiColumn(3, align='r',
data='Containued on Next Page'),))
data_table.add_hline()
data_table.end_table_footer()
data_table.add_hline()
data_table.add_row((MultiColumn(3, align='r',
data='Not Containued on Next Page'),))
data_table.add_hline()
data_table.end_table_last_footer()
row = ["Content1", "9", "Longer String"]
for i in range(150):
data_table.add_row(row)
data_table.generate_tex('tablefile')
to create a file tablefile.tex
containing only the longtable
environment.
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
accepted
The LongTable
class has the generate_tex
method, so you can do
from pylatex import LongTable, MultiColumn
# Generate data table
data_table = LongTable('lll')
data_table.add_hline()
data_table.add_row(["header 1", "header 2", "header 3"])
data_table.add_hline()
data_table.end_table_header()
data_table.add_hline()
data_table.add_row((MultiColumn(3, align='r',
data='Containued on Next Page'),))
data_table.add_hline()
data_table.end_table_footer()
data_table.add_hline()
data_table.add_row((MultiColumn(3, align='r',
data='Not Containued on Next Page'),))
data_table.add_hline()
data_table.end_table_last_footer()
row = ["Content1", "9", "Longer String"]
for i in range(150):
data_table.add_row(row)
data_table.generate_tex('tablefile')
to create a file tablefile.tex
containing only the longtable
environment.
add a comment |
up vote
2
down vote
accepted
The LongTable
class has the generate_tex
method, so you can do
from pylatex import LongTable, MultiColumn
# Generate data table
data_table = LongTable('lll')
data_table.add_hline()
data_table.add_row(["header 1", "header 2", "header 3"])
data_table.add_hline()
data_table.end_table_header()
data_table.add_hline()
data_table.add_row((MultiColumn(3, align='r',
data='Containued on Next Page'),))
data_table.add_hline()
data_table.end_table_footer()
data_table.add_hline()
data_table.add_row((MultiColumn(3, align='r',
data='Not Containued on Next Page'),))
data_table.add_hline()
data_table.end_table_last_footer()
row = ["Content1", "9", "Longer String"]
for i in range(150):
data_table.add_row(row)
data_table.generate_tex('tablefile')
to create a file tablefile.tex
containing only the longtable
environment.
add a comment |
up vote
2
down vote
accepted
up vote
2
down vote
accepted
The LongTable
class has the generate_tex
method, so you can do
from pylatex import LongTable, MultiColumn
# Generate data table
data_table = LongTable('lll')
data_table.add_hline()
data_table.add_row(["header 1", "header 2", "header 3"])
data_table.add_hline()
data_table.end_table_header()
data_table.add_hline()
data_table.add_row((MultiColumn(3, align='r',
data='Containued on Next Page'),))
data_table.add_hline()
data_table.end_table_footer()
data_table.add_hline()
data_table.add_row((MultiColumn(3, align='r',
data='Not Containued on Next Page'),))
data_table.add_hline()
data_table.end_table_last_footer()
row = ["Content1", "9", "Longer String"]
for i in range(150):
data_table.add_row(row)
data_table.generate_tex('tablefile')
to create a file tablefile.tex
containing only the longtable
environment.
The LongTable
class has the generate_tex
method, so you can do
from pylatex import LongTable, MultiColumn
# Generate data table
data_table = LongTable('lll')
data_table.add_hline()
data_table.add_row(["header 1", "header 2", "header 3"])
data_table.add_hline()
data_table.end_table_header()
data_table.add_hline()
data_table.add_row((MultiColumn(3, align='r',
data='Containued on Next Page'),))
data_table.add_hline()
data_table.end_table_footer()
data_table.add_hline()
data_table.add_row((MultiColumn(3, align='r',
data='Not Containued on Next Page'),))
data_table.add_hline()
data_table.end_table_last_footer()
row = ["Content1", "9", "Longer String"]
for i in range(150):
data_table.add_row(row)
data_table.generate_tex('tablefile')
to create a file tablefile.tex
containing only the longtable
environment.
answered Dec 1 at 17:20
Torbjørn T.
154k13245433
154k13245433
add a comment |
add a comment |
Thanks for contributing an answer to TeX - LaTeX Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f462682%2fpylatex-using-only-table-rather-than-whole-document%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown