8000 [ENH]: Allow a custom documentclass when using the pgf backend. · Issue #28119 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content
[ENH]: Allow a custom documentclass when using the pgf backend. #28119
Open
@voidstarstar

Description

@voidstarstar

Problem

In general, the process of producing a quality pgf file is confusing and not very intuitive to me. As a user, my ultimate goal is to be able to generate a pgf file that can be inputted into my own custom LaTeX document such that this final rendered plot looks identical to how matplotlib renders it internally. This internal rendering is what decides the position of labels, ticks, etc. so it is important that there is perfect consistency between this first internal rendering and my second final rendering. Achieving this consistency is very difficult when using a custom documentclass. From what I understand, there's no way to set what documentclass is used for the internal rendering as it appears to be hard coded as article. When using a complicated documentclass, it can become nearly impossible to track down every package, etc. that is used.

Related:
#28112
#26892
#26893
#26791
#14637

Proposed solution

Is there any reason why this documentclass can't be provided by the user? I would suggest the following:
When saving a pgf, simply allow the user to specify an optional pgf.documentclass rcParam and use article as the default. (I assume this needs to be done separately from the pgf.preamble rcParam since it looks like matplotlib inserts other LaTeX commands between the documentclass and user provided preamble, but I may be wrong.)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0