Container subclass to generate part of my LaTeX report
See original GitHub issueI have a LaTeX project which consist of many .tex files. I want to use PyLaTeX to only generate one of these files, so I basically DON’T want PyLaTeX to create the Document etc.
I want something that works like this:
from pylatex.base_classes.containers import Container
class GeneralContainer(Container):
_latex_name = 'generalcontainer'
def __init__(self):
super().__init__()
def dumps(self):
s = ''
for child in self:
if isinstance(child, str):
s_ = child
else:
s_ = child.dumps()
s+=s_
return s
Usage: Fill the container with PyLaTeX objects and then save this to a plain .tex file
content= Text()
content.append(...)
content.generate_tex('file.tex')
And than I can use this content in whichever way I want in LaTeX
\section{Section bla bla bla}
\input{file}
Basically I need this kind of general container which is already a subclass of Container, does such one exist? Is this a desired use case for PyLaTeX?
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Writing your own class - Overleaf, Online LaTeX Editor
Sometimes the best option to customize a document is to write a new class from scratch. This article explains the main structure and...
Read more >How to override a subclass of book to get TOC on even page ...
I am trying to get my table of contents on a verso page (i.e., an even-numbered one). I have seen several threads on...
Read more >The very short guide to typesetting with LATEX
1. Create your document using any suitable plain-text editor with LATEX controls, eg TEXshop (Mac), TEXnicCenter (Win), Kile (Linux) ...
Read more >Rolling your own Document Class: Using LATEX to keep ...
This paper describes what the code in the article document class file does and suggests solutions to some of the popular requirements for...
Read more >HTML and CSS Tutorial - Nanyang Technological University
This is the reason that I combine both the HTML and CSS in this article as they are inseparable. To create an OMO...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I just released 1.4.0 with the
Fragment
class included.You can probably use the Fragment class that this PR introduces: https://github.com/JelteF/PyLaTeX/pull/292