pylatex Change Font

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
1
down vote

favorite
1












How do I change the font to "helvetica" in pylatex ?



I tried it, but this does not worK:



doc = pylatex.Document(fontenc = 'helvet')









share|improve this question









New contributor




james is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.



















  • Welcome to TeX.SX! The font encoding has nothing to do with the font name. I do not know pylatex that well, but can't you simply include a font package (usepackage in LaTeX)?
    – TeXnician
    3 hours ago










  • @TeXnician Thank you for your comment. This would be helpful, but I don't know how to do it in pylatex.
    – james
    3 hours ago










  • According to the docs it is possible to append packages and raw LaTeX strings, but as this solely revolves around Python and a library I'm voting to close as off-topic. Maybe you should simply ask the question how to include a package as issue.
    – TeXnician
    3 hours ago







  • 2




    Try doc.preamble.append(Command('usepackage', 'helvet')) in your python code.
    – Skillmon
    2 hours ago










  • @Skillmon Yes ! This works ! Thank you very much. I just had to add 'pl.' in front of 'Command' to make it work: 'doc.preamble.append(pl.Command('usepackage', 'helvet'))'
    – james
    1 hour ago














up vote
1
down vote

favorite
1












How do I change the font to "helvetica" in pylatex ?



I tried it, but this does not worK:



doc = pylatex.Document(fontenc = 'helvet')









share|improve this question









New contributor




james is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.



















  • Welcome to TeX.SX! The font encoding has nothing to do with the font name. I do not know pylatex that well, but can't you simply include a font package (usepackage in LaTeX)?
    – TeXnician
    3 hours ago










  • @TeXnician Thank you for your comment. This would be helpful, but I don't know how to do it in pylatex.
    – james
    3 hours ago










  • According to the docs it is possible to append packages and raw LaTeX strings, but as this solely revolves around Python and a library I'm voting to close as off-topic. Maybe you should simply ask the question how to include a package as issue.
    – TeXnician
    3 hours ago







  • 2




    Try doc.preamble.append(Command('usepackage', 'helvet')) in your python code.
    – Skillmon
    2 hours ago










  • @Skillmon Yes ! This works ! Thank you very much. I just had to add 'pl.' in front of 'Command' to make it work: 'doc.preamble.append(pl.Command('usepackage', 'helvet'))'
    – james
    1 hour ago












up vote
1
down vote

favorite
1









up vote
1
down vote

favorite
1






1





How do I change the font to "helvetica" in pylatex ?



I tried it, but this does not worK:



doc = pylatex.Document(fontenc = 'helvet')









share|improve this question









New contributor




james is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











How do I change the font to "helvetica" in pylatex ?



I tried it, but this does not worK:



doc = pylatex.Document(fontenc = 'helvet')






python pylatex






share|improve this question









New contributor




james is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




james is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited 4 hours ago





















New contributor




james is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked 4 hours ago









james

1084




1084




New contributor




james is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





james is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






james is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











  • Welcome to TeX.SX! The font encoding has nothing to do with the font name. I do not know pylatex that well, but can't you simply include a font package (usepackage in LaTeX)?
    – TeXnician
    3 hours ago










  • @TeXnician Thank you for your comment. This would be helpful, but I don't know how to do it in pylatex.
    – james
    3 hours ago










  • According to the docs it is possible to append packages and raw LaTeX strings, but as this solely revolves around Python and a library I'm voting to close as off-topic. Maybe you should simply ask the question how to include a package as issue.
    – TeXnician
    3 hours ago







  • 2




    Try doc.preamble.append(Command('usepackage', 'helvet')) in your python code.
    – Skillmon
    2 hours ago










  • @Skillmon Yes ! This works ! Thank you very much. I just had to add 'pl.' in front of 'Command' to make it work: 'doc.preamble.append(pl.Command('usepackage', 'helvet'))'
    – james
    1 hour ago
















  • Welcome to TeX.SX! The font encoding has nothing to do with the font name. I do not know pylatex that well, but can't you simply include a font package (usepackage in LaTeX)?
    – TeXnician
    3 hours ago










  • @TeXnician Thank you for your comment. This would be helpful, but I don't know how to do it in pylatex.
    – james
    3 hours ago










  • According to the docs it is possible to append packages and raw LaTeX strings, but as this solely revolves around Python and a library I'm voting to close as off-topic. Maybe you should simply ask the question how to include a package as issue.
    – TeXnician
    3 hours ago







  • 2




    Try doc.preamble.append(Command('usepackage', 'helvet')) in your python code.
    – Skillmon
    2 hours ago










  • @Skillmon Yes ! This works ! Thank you very much. I just had to add 'pl.' in front of 'Command' to make it work: 'doc.preamble.append(pl.Command('usepackage', 'helvet'))'
    – james
    1 hour ago















Welcome to TeX.SX! The font encoding has nothing to do with the font name. I do not know pylatex that well, but can't you simply include a font package (usepackage in LaTeX)?
– TeXnician
3 hours ago




Welcome to TeX.SX! The font encoding has nothing to do with the font name. I do not know pylatex that well, but can't you simply include a font package (usepackage in LaTeX)?
– TeXnician
3 hours ago












@TeXnician Thank you for your comment. This would be helpful, but I don't know how to do it in pylatex.
– james
3 hours ago




@TeXnician Thank you for your comment. This would be helpful, but I don't know how to do it in pylatex.
– james
3 hours ago












According to the docs it is possible to append packages and raw LaTeX strings, but as this solely revolves around Python and a library I'm voting to close as off-topic. Maybe you should simply ask the question how to include a package as issue.
– TeXnician
3 hours ago





According to the docs it is possible to append packages and raw LaTeX strings, but as this solely revolves around Python and a library I'm voting to close as off-topic. Maybe you should simply ask the question how to include a package as issue.
– TeXnician
3 hours ago





2




2




Try doc.preamble.append(Command('usepackage', 'helvet')) in your python code.
– Skillmon
2 hours ago




Try doc.preamble.append(Command('usepackage', 'helvet')) in your python code.
– Skillmon
2 hours ago












@Skillmon Yes ! This works ! Thank you very much. I just had to add 'pl.' in front of 'Command' to make it work: 'doc.preamble.append(pl.Command('usepackage', 'helvet'))'
– james
1 hour ago




@Skillmon Yes ! This works ! Thank you very much. I just had to add 'pl.' in front of 'Command' to make it work: 'doc.preamble.append(pl.Command('usepackage', 'helvet'))'
– james
1 hour ago










1 Answer
1






active

oldest

votes

















up vote
3
down vote



accepted










You can add stuff to your preamble using doc.preamble.append(). To add helvet to your preamble use:



doc.preamble.append(Command('usepackage', 'helvet'))


This needs



from pylatex import Command


to work out, if you imported pylatex and not only submodules and functions from it, use pylatex.Command instead.



From what I gathered by a quick look on the documentation of pylatex you might be able to add arbitrary stuff to your document (making a horizontal line possible) by doing:



from pylatex.utils import NoEscape


and then



doc.append(NoEscape(r'hrule')) # or whichever macro you want to use for your horizontal line


I'm not sure what NoEscape is needed for, perhaps it isn't needed, but I can't try because I don't have pylatex installed.






share|improve this answer




















  • This is great ! Thank you very much ! Just a quick question: How can I change the thickness of the line ? I tried "doc.append(pl.Command('rule','0.4pt','linewidth'))" but it does not work.
    – james
    35 mins ago










  • I also tried: doc.append(NoEscape(r'ruletextwidth0.4pt'))
    – james
    33 mins ago










Your Answer







StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "85"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);






james is a new contributor. Be nice, and check out our Code of Conduct.









 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f452078%2fpylatex-change-font%23new-answer', 'question_page');

);

Post as a guest






























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
3
down vote



accepted










You can add stuff to your preamble using doc.preamble.append(). To add helvet to your preamble use:



doc.preamble.append(Command('usepackage', 'helvet'))


This needs



from pylatex import Command


to work out, if you imported pylatex and not only submodules and functions from it, use pylatex.Command instead.



From what I gathered by a quick look on the documentation of pylatex you might be able to add arbitrary stuff to your document (making a horizontal line possible) by doing:



from pylatex.utils import NoEscape


and then



doc.append(NoEscape(r'hrule')) # or whichever macro you want to use for your horizontal line


I'm not sure what NoEscape is needed for, perhaps it isn't needed, but I can't try because I don't have pylatex installed.






share|improve this answer




















  • This is great ! Thank you very much ! Just a quick question: How can I change the thickness of the line ? I tried "doc.append(pl.Command('rule','0.4pt','linewidth'))" but it does not work.
    – james
    35 mins ago










  • I also tried: doc.append(NoEscape(r'ruletextwidth0.4pt'))
    – james
    33 mins ago














up vote
3
down vote



accepted










You can add stuff to your preamble using doc.preamble.append(). To add helvet to your preamble use:



doc.preamble.append(Command('usepackage', 'helvet'))


This needs



from pylatex import Command


to work out, if you imported pylatex and not only submodules and functions from it, use pylatex.Command instead.



From what I gathered by a quick look on the documentation of pylatex you might be able to add arbitrary stuff to your document (making a horizontal line possible) by doing:



from pylatex.utils import NoEscape


and then



doc.append(NoEscape(r'hrule')) # or whichever macro you want to use for your horizontal line


I'm not sure what NoEscape is needed for, perhaps it isn't needed, but I can't try because I don't have pylatex installed.






share|improve this answer




















  • This is great ! Thank you very much ! Just a quick question: How can I change the thickness of the line ? I tried "doc.append(pl.Command('rule','0.4pt','linewidth'))" but it does not work.
    – james
    35 mins ago










  • I also tried: doc.append(NoEscape(r'ruletextwidth0.4pt'))
    – james
    33 mins ago












up vote
3
down vote



accepted







up vote
3
down vote



accepted






You can add stuff to your preamble using doc.preamble.append(). To add helvet to your preamble use:



doc.preamble.append(Command('usepackage', 'helvet'))


This needs



from pylatex import Command


to work out, if you imported pylatex and not only submodules and functions from it, use pylatex.Command instead.



From what I gathered by a quick look on the documentation of pylatex you might be able to add arbitrary stuff to your document (making a horizontal line possible) by doing:



from pylatex.utils import NoEscape


and then



doc.append(NoEscape(r'hrule')) # or whichever macro you want to use for your horizontal line


I'm not sure what NoEscape is needed for, perhaps it isn't needed, but I can't try because I don't have pylatex installed.






share|improve this answer












You can add stuff to your preamble using doc.preamble.append(). To add helvet to your preamble use:



doc.preamble.append(Command('usepackage', 'helvet'))


This needs



from pylatex import Command


to work out, if you imported pylatex and not only submodules and functions from it, use pylatex.Command instead.



From what I gathered by a quick look on the documentation of pylatex you might be able to add arbitrary stuff to your document (making a horizontal line possible) by doing:



from pylatex.utils import NoEscape


and then



doc.append(NoEscape(r'hrule')) # or whichever macro you want to use for your horizontal line


I'm not sure what NoEscape is needed for, perhaps it isn't needed, but I can't try because I don't have pylatex installed.







share|improve this answer












share|improve this answer



share|improve this answer










answered 42 mins ago









Skillmon

18k11636




18k11636











  • This is great ! Thank you very much ! Just a quick question: How can I change the thickness of the line ? I tried "doc.append(pl.Command('rule','0.4pt','linewidth'))" but it does not work.
    – james
    35 mins ago










  • I also tried: doc.append(NoEscape(r'ruletextwidth0.4pt'))
    – james
    33 mins ago
















  • This is great ! Thank you very much ! Just a quick question: How can I change the thickness of the line ? I tried "doc.append(pl.Command('rule','0.4pt','linewidth'))" but it does not work.
    – james
    35 mins ago










  • I also tried: doc.append(NoEscape(r'ruletextwidth0.4pt'))
    – james
    33 mins ago















This is great ! Thank you very much ! Just a quick question: How can I change the thickness of the line ? I tried "doc.append(pl.Command('rule','0.4pt','linewidth'))" but it does not work.
– james
35 mins ago




This is great ! Thank you very much ! Just a quick question: How can I change the thickness of the line ? I tried "doc.append(pl.Command('rule','0.4pt','linewidth'))" but it does not work.
– james
35 mins ago












I also tried: doc.append(NoEscape(r'ruletextwidth0.4pt'))
– james
33 mins ago




I also tried: doc.append(NoEscape(r'ruletextwidth0.4pt'))
– james
33 mins ago










james is a new contributor. Be nice, and check out our Code of Conduct.









 

draft saved


draft discarded


















james is a new contributor. Be nice, and check out our Code of Conduct.












james is a new contributor. Be nice, and check out our Code of Conduct.











james is a new contributor. Be nice, and check out our Code of Conduct.













 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f452078%2fpylatex-change-font%23new-answer', 'question_page');

);

Post as a guest













































































Comments

Popular posts from this blog

What does second last employer means? [closed]

Installing NextGIS Connect into QGIS 3?

One-line joke