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

Defining LaTeX commands in a single location for use throughout the docs #532

Closed
juliohm opened this issue Jul 9, 2017 · 7 comments
Closed
Labels
Format: HTML Related to the default HTML output Type: Documentation

Comments

@juliohm
Copy link
Contributor

juliohm commented Jul 9, 2017

As discussed on gitter, currently we have to retype \newcommand on every markdown file to get a notation that is consistent across documentation pages.

It would be interesting to have a single place where one can define all the LaTeX syntax in the docs.

@juliohm
Copy link
Contributor Author

juliohm commented Dec 4, 2018

Any update on this issue with the latest Documenter.jl? :)

@fredrikekre
Copy link
Member

fredrikekre commented Dec 4, 2018

No but it is trivial to implement if you want to.
Edit: Maybe this is not for latex output?

@juliohm
Copy link
Contributor Author

juliohm commented Mar 3, 2020

Do we have support for this in the new Documenter.jl?

@mortenpi
Copy link
Member

mortenpi commented Jun 3, 2020

Yes, we actually do. You can configure KaTeX & MathJax in make.jl now (#1097). So for MathJax it should look something like this:

makedocs(...,
    format = Documenter.HTML(...,
        mathengine = MathJax(Dict(
            :TeX => Dict(
                :equationNumbers => Dict(:autoNumber => "AMS"),
                # Custom Tex commands:
                :Macros => Dict(
                    :defd => "",
                    :ket => ["|#1\\rangle", 1],
                    :bra => ["\\langle#1|", 1],
                )
            )
        ))
    )
)

I'll downgrade this to a documentation issue.

@mortenpi mortenpi added Format: HTML Related to the default HTML output Type: Documentation and removed Type: Feature labels Jun 3, 2020
@juliohm
Copy link
Contributor Author

juliohm commented Aug 20, 2020

Nice to have this feature 👍

@wsshin
Copy link

wsshin commented Feb 16, 2022

                :Macros => Dict(
                    :defd => "",
                    :ket => ["|#1\\rangle", 1],
                    :bra => ["\\langle#1|", 1],

It seems that defining new LaTeX commands like this works only for MathJax. Is there an equivalent for KaTeX?

@mortenpi
Copy link
Member

@wsshin Yes, it should be possible, although I do not have a snippet on hand. But you can pass a configuration dict to KaTeX() too, and KaTeX accepts a macros option. Might be a little bit of trial and error to get it working exactly right, but you can double check the generated JS in build/assets/documenter.js.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Format: HTML Related to the default HTML output Type: Documentation
Projects
None yet
Development

No branches or pull requests

4 participants