Macaulay2 » Documentation
Packages » MergeTeX :: MergeTeX
next | previous | forward | backward | up | index | toc

MergeTeX -- Run Macaulay2 code inside a LaTeX file

Description

This packages parses a LaTeX file, looking for Macaulay2 code. The latter must follow the syntax of the LaTeX package "listings", namely, if must be enclosed in \begin{lstlisting}[language=Macaulay2]...\end{lstlisting}, or must be taken from an external M2 file via \begin{lstinputlisting}[language=Macaulay2]{filename.m2}; one can also insert inline code with \lstinline[language=Macaulay2]!...!, but it is not parsed. See the example file ex.tex.

It then produces a new file where the output of the code has been inserted in place of the input. The LaTeX file should contain \usepackage{listings} and should include a definition of the Macaulay2 language; this can be found in the auxiliary file lst-Macaulay2.tex.

It also replaces automatically commands of the form \macoutput{n} with the nth output of Macaulay2.

mergeTeX takes as input the TeX source as a string and returns the output as a string, whereas mergeTeXFile takes as arguments the names of the source LaTeX file and of the target LaTeX file (the two can be identical; mergeTeXFile acts idempotently).

Author

Version

This documentation describes version 0.6 of MergeTeX.

Citation

If you have used this package in your research, please cite it as follows:

@misc{MergeTeXSource,
  title = {{MergeTeX: Run \emph{Macaulay2} code inside a LaTeX file. Version~0.6}},
  author = {Paul Zinn-Justin},
  howpublished = {A \emph{Macaulay2} package available at
    \url{https://github.com/Macaulay2/M2/tree/master/M2/Macaulay2/packages}}
}

Exports

  • Functions and commands
    • mergeTeX
    • mergeTeXFile
  • Symbols
    • Path
    • TeX (missing documentation)

For the programmer

The object MergeTeX is a package, defined in MergeTeX.m2, with auxiliary files in MergeTeX/.


The source of this document is in MergeTeX.m2:201:0.