Copying Macaulay2 input and output to latex

37 views
Skip to first unread message

Candid Pleasure

unread,
Nov 6, 2022, 6:27:08 AM11/6/22
to Macaulay2
I need help copying my inputs and outputs to Latex. not just the code, as I can get that with the tex function.

I want to copy it as is on the interface directly into Texstudio, I've seen it done in textbooks and articles, I want to do it the same way in my work.

I attached an image to show what I mean.

Thank you .
Screenshot_20221106-122427_Drive.jpg

Doug Torrance

unread,
Nov 6, 2022, 6:52:11 AM11/6/22
to Macaulay2
Overleaf has some good documentation on including code (not specific to Macaulay2) in LaTeX documents:

If you choose the second option and have Pygments version 2.12.0 or newer, then Macaulay2 syntax highlighting is supported:

\begin{minted}{macaulay2}
...
\end{minted}

Michael Burr

unread,
Nov 6, 2022, 6:53:11 AM11/6/22
to Macaulay2
A simple way would be to use the verbatim environment in LaTeX (\begin{verbatim}...\end{verbatim}).  Anything between the begin and end is displayed exactly as input.  Most other choices, like using {\texttt ... } will require you format your input/output to LaTeX's format.

On Sunday, November 6, 2022 at 6:27:08 AM UTC-5 nwokupl...@gmail.com wrote:

Candid Pleasure

unread,
Nov 6, 2022, 7:08:13 AM11/6/22
to Macaulay2
Thank you very much for your response,
I've been able to copy the input exactly using /begin{verbatim}. The only problem is copying to the editor only copies out the input and not the output.

How can I copy out the output too ?
Thank you o much.

Doug Torrance

unread,
Nov 6, 2022, 7:42:58 AM11/6/22
to Macaulay2
How exactly are you using Macaulay2?  If it's through Emacs, then you should be able to copy/paste from the "Macaulay2 Interaction" buffer to get both the input and the output.

If it's through the web interface, then I understand why there might be some difficulty since most of the output is rendered nicely for the browser, but not so much for plain text.  Try issuing the following command to make everything plain text for easier copy/pasting:

topLevelMode = Standard

Candid Pleasure

unread,
Nov 6, 2022, 7:58:00 AM11/6/22
to Macaulay2
I am using it through the web interface, and the topLevelMode worked. Thank you very much for your time and help. I really do appreciate.

Daniel R. Grayson

unread,
Nov 10, 2022, 12:55:26 PM11/10/22
to Macaulay2
Here's a program I wrote long ago that runs M2 on M2 expressions located in a tex file and incorporates the output

Paul Zinn-Justin

unread,
Nov 10, 2022, 2:16:45 PM11/10/22
to maca...@googlegroups.com

--
You received this message because you are subscribed to the Google Groups "Macaulay2" group.
To unsubscribe from this group and stop receiving emails from it, send an email to macaulay2+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/macaulay2/8164fc38-da71-48d1-904c-18e90ac421aan%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages