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

Support preamble #189

Open
MirionQs opened this issue Dec 30, 2024 · 6 comments · May be fixed by #192
Open

Support preamble #189

MirionQs opened this issue Dec 30, 2024 · 6 comments · May be fixed by #192

Comments

@MirionQs
Copy link

I added a macro to the specification file

...
    LoadClassWithOptions: ignore-sym,
    // user-defined
    Li: sym,
  ),
)
...

but it didn't work

#import "@preview/mitex:0.2.4": *

#mi("\\Li_2(x)")
plugin errored with: error: unknown command: \Li
@Myriad-Dreamin
Copy link
Collaborator

Myriad-Dreamin commented Jan 2, 2025

To use new macros (spec), you must either rebuild wasm with new artifact:

/// The default command specification.
///
/// See [Reproducing Default Command Specification][repro-default] for more
/// information.
///
/// [repro-default]: https://github.com/mitex-rs/artifacts/blob/main/README.md#default-command-specification-since-v011

or passing the spec data as the argument here:

#let mitex-convert(it, mode: "math", spec: bytes(())) = {

@MirionQs
Copy link
Author

MirionQs commented Jan 3, 2025

I guess I'll wait for the custom macro feature to be developed. Changing the file isn't really a good solution.

@Enter-tainer
Copy link
Member

Changing the file isn't really a good solution.

could you please give more input on this?

@MirionQs
Copy link
Author

MirionQs commented Jan 3, 2025

Changing the file isn't really a good solution.

could you please give more input on this?

I would define \Pr as \mathscr{Pr} in set theory to denote a proper class, and define \Pr as \operatorname{Pr} in probability theory to represent a function. However, modifying the specification file would affect all documents, so I don't think this solution is a good one.

@Myriad-Dreamin
Copy link
Collaborator

Myriad-Dreamin commented Jan 3, 2025

You might seek some personally used shortcut instead of trying to contribute some new public macros. Some meta macros may help define shortcut macros:

\newcommand{\f}[2]{#1f(#2)}
  \f\relax{x} = \int_{-\infty}^\infty
    \f\hat\xi\,e^{2 \pi i \xi x}
    \,d\xi

I don't remember clearly, but \newcommand and \newenvironment are definitely supported. It seems more constructive if we support more list of commonly used such macros.

@MirionQs
Copy link
Author

MirionQs commented Jan 5, 2025

You might seek some personally used shortcut instead of trying to contribute some new public macros. Some meta macros may help define shortcut macros:


\newcommand{\f}[2]{#1f(#2)}

  \f\relax{x} = \int_{-\infty}^\infty

    \f\hat\xi\,e^{2 \pi i \xi x}

    \,d\xi

I don't remember clearly, but \newcommand and \newenvironment are definitely supported. It seems more constructive if we support more list of commonly used such macros.

They are not global in the whole document, so I have to write them again and again. (My documents are converted from Markdown instead of raw LaTeX. There are many inline and display formulae)

@Myriad-Dreamin Myriad-Dreamin changed the title Adding macros to the specification file doesn't work Support preamble Jan 18, 2025
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

Successfully merging a pull request may close this issue.

3 participants