Skip to content
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

Ability to add documentclass options #13

Open
abdullahkhalids opened this issue Nov 5, 2024 · 3 comments
Open

Ability to add documentclass options #13

abdullahkhalids opened this issue Nov 5, 2024 · 3 comments

Comments

@abdullahkhalids
Copy link
Contributor

Currently there is no way of adding documentclass properties. For example, to change the default font size.

\documentclass[11pt]{article}

Or

\documentclass[dvipsnames]{article} # an option that is passed to xcolor to enable additional colors

Should not be too difficult to add a method Picture.add_documentclass_options to do this.

@allefeld
Copy link
Owner

allefeld commented Nov 5, 2024

Should not be too difficult to add a method Picture.add_documentclass_options to do this.

Yes, but I don't want to make the interface more complicated than necessary.

font size: You can set the font size for the tikzpicture environment instead, there is an example in the included tutorial notebook. You can directly specify the font size-changing LaTeX code, or e.g.

pic.tikzset(font=fontsize(11))

dvipsnames: Did you try

pic.usepackage('xcolor', 'dvipsnames')

? Not sure whether it works, could lead to an error because tikz has already loaded xcolor.

So this might need a fix. Easiest probably by inserting user-generated preamble entries directly after \documentclass.

@abdullahkhalids
Copy link
Contributor Author

I don't think this makes the interface more complicated. In any case, pic.usepackage('xcolor', 'dvipsnames') does not work, because as you pointed out tikz already loads xcolor.

Adding user-generated preamble entries directly after \documentclass, might degrade user experience because user might want to define stuff after tikz is loaded. It is also not backward compatible for the users of this package.

@allefeld
Copy link
Owner

It is also not backward compatible for the users of this package.

True. So maybe add a named parameter to usepackage, called pretikz, boolean, default False for backwards compatibility. Which would mean the same for add_preamble, and self.preamble split into pre and post.

Would you be interested to prepare a pull request?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants