Git Product home page Git Product logo

Comments (5)

jdonkervliet avatar jdonkervliet commented on July 17, 2024 3

Note that this no longer works. You should use wrap your raw latex in NoEscape or use the Command class in case you want to insert a command.

from pylatex.

JelteF avatar JelteF commented on July 17, 2024

Yes, any object inherits from one of the container baseclasses can also contain "raw" latex strings.
You can just do:

doc = Document()
doc.append(r'\newpage')
doc.append('This is on a new page')

This is also why you should always escape user supplied strings using the utils function.

In some cases it might be easier to use the Command class. This is mostly the case when your commands need arguments that aren't hard coded.
If you need a specific environment (like enumerate wiht a begin and end command) it might be easiest to inherit LatexNamedContainer, since that does that for you and you can use the with syntax that way.

from pylatex.

Starow avatar Starow commented on July 17, 2024

Thank you for these infos and the fast reply!
I passed everything inside some r'text' strings and it works :)

from pylatex.

JelteF avatar JelteF commented on July 17, 2024

No problem. BTW the r before r'text' is just so you don't have to escape all the backslashes its something that is built in to python.

from pylatex.

LydiaF avatar LydiaF commented on July 17, 2024

Thank you for this info :)

from pylatex.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.