-
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?
Conversation
Signed-off-by: Tin Lai <[email protected]>
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.
Good idea, but I have some notes.
@@ -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 comment
The 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.document_code
should do the trick.
@@ -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 comment
The 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.
@@ -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 = [] |
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.
I'm using this PR as follows:
where
\tdplotsetmaincoords{70}{110}
is not part of the preamble (which is supported currently), but it needs to be in-between