Comments (4)
i would love to have graphics support in this nice python package. first level graphics support would achieved if it would be possible to load additional latex packages. if haven't found any way to add additional to the document. neither in the examples nor in the code of pylatex. do you have any recommodations to me?
i would appreciate!
from pylatex.
Packages can be added to like this:
doc = Document()
doc.packages.append(Package('fullpage'))
You can even pass it keyword arguments specified here:
https://github.com/JelteF/PyLaTeX/blob/master/pylatex/package.py
The argument names corespond to this output: \base[option]{name}
That way you can even change the base to a graphics command and use that instead of an actual string. Like this:
Package('chick.png', base='includegraphics', option='scale=0.5')
I hope this helps. Actual graphics objects will probably not happen soon, since I mostly add to this library whenever I need something extra. And I won't see myself using very advanced features that won't be achievable by using the method described above. I might make a Command object though, so the Package object doesn't have to be misused for commands.
from pylatex.
Thanks for the quick reply.
The hint, how to add packages in the preamble works fine for me! Thanks
for that!
Using the Package('chick.png', base='includegraphics',
option='scale=0.5') method to add an "\includegraphics"-statement,
doesn't work for me in that way, because I'm just able to add the
"\includegra.."-statement in the preamble, which doesn't make sense in
terms of including a figure in the document.
For now I have a workaround with just adding a plain text insertation of
"\includegraphics..." by appending it to the section-object similiar to
text, tables, etc.
If I'll have enough time, I would like to contribute a proper figure
method to pylatex. But I can't promise that, because it takes a while
for to code this in a smart way...
Am Mittwoch, den 05.11.2014, 23:40 +0100 schrieb Jelte Fennema:
Packages can be added to like this:
doc = Document()
doc.packages.append(Package('fullpage'))
You can even pass it keyword arguments specified here:
https://github.com/JelteF/PyLaTeX/blob/master/pylatex/package.py
The argument names corespond to this output: \base[option]{name}
That way you can even change the base to a graphics command and use
that instead of an actual string. Like this: `Package('chick.png',
base='includegraphics', option='scale=0.5')I hope this helps. Actual graphics objects will probably not happen
soon, since I mostly add to this library whenever I need something
extra. And I won't see myself using very advanced features that won't
be achievable by using the method described above. I might make a
Command object though, so the Package object doesn't have to be
misused for commands.—
Reply to this email directly or view it on GitHub.
from pylatex.
What I meant by the chick example is that code like this should work:
doc = Document()
doc.packages.append(Package('fullpage'))
doc.append('This is a picture of a chick:')
doc.append(Package('chick.png', base='includegraphics', option='scale=0.5'))
Note: I haven't tested this.
Btw, the source code is not that big or difficult. So it shouldn't be to hard hard to create a includegraphics thing, but I'd rather have a more general way to do commands.
Something with a syntax like this:
Command('includegraphics', option='scale=0.5', argument='chick.png')
It would be nice if it could also accept lists of arguments or options so stuff like this would be possible:
\randomcommand[a][b]{'arg1'}{'arg2'}
from pylatex.
Related Issues (20)
- [Question] How can I just compile an existing TeX document? HOT 2
- Can we have an option to disable utils.fix_filename? HOT 1
- Add sympy support
- Texify to tableofcontents HOT 1
- fontenc and inputenc should not be included
- Store the generated PDF in byteIO
- How to properly add math and refs to captions
- No LaTex compiler was found (Windows 10) HOT 8
- How to to compile .tex file? HOT 2
- File not found for files with dots in relative or absolute path to file
- How to Specify LaTeX Compiler
- "PermissionError: [WinError 5] Access is denied" with document.generate_pdf()
- Adding pandas dataframes to pylatex sections breaks with pandas 2.0
- Negative values in TextBlock
- Two-Column document HOT 1
- Question: Tiny text size HOT 1
- Python 3.12 install fails HOT 2
- Missing Options Paramter in Section classes
- Proposal for `add_item`
- how add txt file content to tex file ?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pylatex.