-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow adding arbitrary document code #8
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1024,6 +1024,7 @@ def __init__(self, tempdir=None, cache=True, opt=None, **kwoptions): | |
super().__init__(opt=opt, **kwoptions) | ||
# additional preamble entries | ||
self.preamble = [] | ||
self.document_codes = [] | ||
# should the created PDF be cached? | ||
self.cache = cache | ||
# create temporary directory for pdflatex etc. | ||
|
@@ -1080,6 +1081,9 @@ def usepackage(self, name, options=None): | |
code += '{' + name + '}' | ||
self.add_preamble(code) | ||
|
||
def add_document_code(self, code): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please add a docstring to the function, in the style of the other docstrings. |
||
self.document_codes.append(code) | ||
|
||
def fira(self): | ||
""" | ||
set font to Fira, also for math | ||
|
@@ -1117,6 +1121,7 @@ def _update(self): | |
# document body | ||
codelines += [ | ||
r'\begin{document}', | ||
"\n".join(self.document_codes), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It would be nicer to insert the elements of the list instead of the combined string. I believe |
||
self._code, | ||
r'\end{document}'] | ||
code = '\n'.join(codelines) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please insert a line comment on the line before explaining the purpose of the variable.
Also please call the variable
document_code
without the s.