Rendered math in console input/output

49 views
Skip to first unread message

Stephen Brown

unread,
May 22, 2025, 3:24:09 PM5/22/25
to PreTeXt support
Hello!

I am hoping to use the <console> tag along with <input> and <output> to display samples of code from a Maple worksheet. However, in recent versions of Maple, the input and output are formatted as displayed math:
Maple Worksheet.png
Is it possible to customize <input> and <output> in this way?

I'm very new to authoring in PreTeXt and I haven't found any samples of this yet. Thanks!

Rob Beezer

unread,
May 23, 2025, 11:44:55 AM5/23/25
to pretext...@googlegroups.com
Dear Stephen,

#console is really meant to demonstrate interaction at a command-line.
Operating-system tasks, shell scripts, text utilities, simple (first) programs.

So there is no expectation of semi-graphical colored output like you show in
your screenshot (thanks for providing that!).

I think your Maple code could/should go into a #program. We don't have
syntax-highlighting for maple, but we could explore that.

I can't think of anything much better than screenshots as images/figures for
your #output, given its nature. Maybe you could automate its production somehow
with use of consistent filenames?

Can you not "go back" to a more textual output? Maybe you don't really want
that, anyway. We have much better support for open-source tools like Sage, and
Octave. But you almost certainly don't want that?

Rob

On 5/22/25 11:34, Stephen Brown wrote:
> Hello!
>
> I am hoping to use the <console> tag along with <input> and <output> to display
> samples of code from a Maple worksheet. However, in recent versions of Maple,
> the input and output are formatted as displayed math:
> Maple Worksheet.png
> Is it possible to customize <input> and <output> in this way?
>
> I'm very new to authoring in PreTeXt and I haven't found any samples of this
> yet. Thanks!
>
> --
> You received this message because you are subscribed to the Google Groups
> "PreTeXt support" group.
> To unsubscribe from this group and stop receiving emails from it, send an email
> to pretext-suppo...@googlegroups.com <mailto:pretext-
> support+u...@googlegroups.com>.
> To view this discussion visit https://groups.google.com/d/msgid/pretext-support/
> a4dec831-a1e4-4ec8-a081-7d28c08ec228n%40googlegroups.com <https://
> groups.google.com/d/msgid/pretext-support/a4dec831-a1e4-4ec8-
> a081-7d28c08ec228n%40googlegroups.com?utm_medium=email&utm_source=footer>.

Stephen Brown

unread,
May 23, 2025, 1:43:48 PM5/23/25
to PreTeXt support
Thank you Rob for the suggestions.

Students in calculus labs at my college are encouraged to use Maple in what is called "Worksheet Mode",
which acts like a command-line interface with prompts (>). Most of the lab activities have students input
one command at a time to see the output as they go, and there isn't really any syntax-highlighting involved.
In that sense, I felt that #console was more suitable than #program.

I prefer not to include images/figures in place of text, as I would prefer that students can copy/paste into
their own worksheets to try things out.

So far in the few examples I've created, I've left #input as mono-spaced text (something that Maple can be
toggled to, called "1D-Math" mode) and then displayed output in a separate #me. While this works well enough,
most students are used to Maple typesetting the input into displayed math. I'm hoping I can make things look
consistent with what students see in the application.

What I have currently:
<console prompt="> ">
  <input>2 + 2;</input>
</console>
<me>4</me>
<console prompt="> ">
  <input>8 / 2;</input>
</console>
<me>4</me>

Maple input-output.png

What I am striving for:
Maple input-output-1.png

If there is a way to modify #input and #output for this use, then it would greatly improve this process but if not,
then my current work around should likely suffice.

Stephen

Charilaos Skiadas

unread,
May 23, 2025, 2:25:15 PM5/23/25
to pretext...@googlegroups.com
Having to stop the console tags in order to enter a me tag may produce reasonably looking output, but I think it is semantically incorrect. But may be a reasonable solution with the current infrastructure (?)

I think what Stephen is envisioning is perhaps something more like a “notebook” tag that is meant to emulate the behavior of the various interactive-notebook kinds of environments like Maple, Mathematica, Jupyter notebook, R notebook etc. in those situations I am imagining the output to be essentially a more arbitrary paragraph-type thingie, possibly including images for something like graphs etc, certainly some way of doing some nicer-looking tables, certainly math, etc. And I think this definitely reaches outside what the console tag is meant to do, namely emulate a non-gui REPL-type interaction between the user and a program. But there are clearly use cases where there is an input-output interaction and the outputs of that interaction are not pure text, but they could still be reasonably accessible (math, tabular).

Given the relative prevalence of these notebook-type format, it is a reasonable question whether those should potentially be supported. I imagine a couple of ways it could go, but they all would take work:

1. A @format attribute to either the individual output tags or the overall console tag, to somehow indicate the distinction (format the outputs as "rich text")
2. A <text-output> or something similar as an alternative tag to <output>, to be allowed inside a <console>.
3. A whole separate <notebook> tag with <input/output> like the console, but with the output part interpreted as normal text.

Haris

Charilaos Skiadas
Professor in Mathematics and Computer Science
Hanover College


On May 23, 2025, at 1:43 PM, Stephen Brown <stephen....@gmail.com> wrote:

Thank you Rob for the suggestions.

Students in calculus labs at my college are encouraged to use Maple in what is called "Worksheet Mode",
which acts like a command-line interface with prompts (>). Most of the lab activities have students input
one command at a time to see the output as they go, and there isn't really any syntax-highlighting involved.
In that sense, I felt that #console was more suitable than #program.

I prefer not to include images/figures in place of text, as I would prefer that students can copy/paste into
their own worksheets to try things out.

So far in the few examples I've created, I've left #input as mono-spaced text (something that Maple can be
toggled to, called "1D-Math" mode) and then displayed output in a separate #me. While this works well enough,
most students are used to Maple typesetting the input into displayed math. I'm hoping I can make things look
consistent with what students see in the application.

What I have currently:
<console prompt="> ">
  <input>2 + 2;</input>
</console>
<me>4</me>
<console prompt="> ">
  <input>8 / 2;</input>
</console>
<me>4</me>

<Maple input-output.png>

What I am striving for:
To unsubscribe from this group and stop receiving emails from it, send an email to pretext-suppo...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/pretext-support/f4e62f07-4b58-4f7d-bc03-b768f7cc4528n%40googlegroups.com.
<Maple input-output.png><Maple input-output-1.png>

Rob Beezer

unread,
May 23, 2025, 4:50:21 PM5/23/25
to pretext...@googlegroups.com
Yes, I've got about 35 years experience with notebook interfaces. Mathematica,
Sage, Jupyter. So I "get it." Converting textbooks into "live" Sage notebooks
is part of the origin story of PreTeXt.

They are all pretty crappy when you look under the hood (little to no
structure), but that is a post for another day.

I would prefer that we support PreTeXt source converting to formats notebooks
can render, and then the notebooks can display content in whatever ways they
wish, without our involvement. (I realize this is not exactly what Stephen is
after.) I have often said we will prioritize open-source tools over proprietary
ones (the 12th Principle?). (Yes, I know engineering departments may dictate
which tools you use.) So we should be making progress on our conversion to
Jupyter notebooks. We, collectively, do not seem to have the time, skills, or
enthusiasm to make even *that* happen.

We once had an embedding of a Mathematica widget for interactive demonstrations.
Could never get it to work reliably. And I think the author of any instance
of the widget had to pay money to fund the overall computational load of that
demonstration. It was not a pleasant experience and that support was removed.
Based on that, I wouldn't go very far again to support Mathematica code.

I'm sorry Stephen, that I can't be more helpful or optimistic. Chasing Maple's
choices for rendering their output really isn't part of what we are about.

Rob
>> support/ <https://groups.google.com/d/msgid/pretext-support/>
>> > a4dec831-a1e4-4ec8-a081-7d28c08ec228n%40googlegroups.com
>> <http://40googlegroups.com/> <https://
>> > groups.google.com/d/msgid/pretext-support/a4dec831-a1e4-4ec8- <http://
>> groups.google.com/d/msgid/pretext-support/a4dec831-a1e4-4ec8->
>> > a081-7d28c08ec228n%40googlegroups.com?utm_medium=email&utm_source=footer
>> <http://40googlegroups.com/?utm_medium=email&utm_source=footer>>.
>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "PreTeXt support" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> support/f4e62f07-4b58-4f7d-bc03-b768f7cc4528n%40googlegroups.com <https://
>> groups.google.com/d/msgid/pretext-support/f4e62f07-4b58-4f7d-bc03-
>> b768f7cc4528n%40googlegroups.com?utm_medium=email&utm_source=footer>.
>> <Maple input-output.png><Maple input-output-1.png>
>
> --
> You received this message because you are subscribed to the Google Groups
> "PreTeXt support" group.
> To unsubscribe from this group and stop receiving emails from it, send an email
> to pretext-suppo...@googlegroups.com <mailto:pretext-
> support+u...@googlegroups.com>.
> To view this discussion visit https://groups.google.com/d/msgid/pretext-support/
> EEBAA24E-384B-489D-9929-E01BF4E99F7C%40gmail.com <https://groups.google.com/d/
> msgid/pretext-support/EEBAA24E-384B-489D-9929-E01BF4E99F7C%40gmail.com?
> utm_medium=email&utm_source=footer>.

Charilaos Skiadas

unread,
May 24, 2025, 12:04:06 PM5/24/25
to pretext...@googlegroups.com
Oh I was not at all suggesting any kind of emulation or connection with a live notebook on any of those systems, nor any computed connection between the input and the corresponding output. I was only considering whether we should provide a reasonable way for someone to be able to specify an output that is not purely textual. At least in my thinking the point of the console tag is for an author of something like a textbook to be able to show to the reader what they should type in and what the output should look like. If the author is writing a textbook about something like Maple or Jupyter, their ability to show in pretext what that interaction output would look like is somewhat limited. But it is honestly not something that I would be putting energy towards at the moment, personally.

Charilaos Skiadas
Professor in Mathematics and Computer Science
Hanover College

To unsubscribe from this group and stop receiving emails from it, send an email to pretext-suppo...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/pretext-support/MTAwMDAzNy5iZWV6ZXI.1748033418%40pnsh.

Stephen Brown

unread,
May 24, 2025, 12:49:47 PM5/24/25
to pretext...@googlegroups.com
I think Charilaos nicely described all that I'm trying to achieve. If there was interest in adding a @format option to #input and #output that defaults to text but could be set to MathJax rendering, then I believe that would get everything working the way I'd hope.

Stephen Brown
Professor, Mathematics and Statistics 
Okanagan College 

You received this message because you are subscribed to a topic in the Google Groups "PreTeXt support" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/pretext-support/GKLKNMu1FZU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to pretext-suppo...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/pretext-support/DEF8FE2B-9192-4006-9E20-D877C44DBD0F%40gmail.com.

David W. Farmer

unread,
May 24, 2025, 1:21:06 PM5/24/25
to pretext...@googlegroups.com

I'd be interested in discussing this in a drop-in. It seems like this
is a new type of thing, but I am not sure I have followed all the points
and would like to explore other use cases.
> To view this discussion visithttps://groups.google.com/d/msgid/pretext-support/CALr2%2BLch%3D%3DB4i4h3c2RvCmXwY%3DVcEYs%3D%2BVRoeDMMJsosaTfdXg%40ma
> il.gmail.com.
>
>

Oscar Levin

unread,
May 24, 2025, 2:45:57 PM5/24/25
to pretext...@googlegroups.com
I also think this warrants further discussion.  There were some recent requests for pseudocode with mathjax available, which I *think* is related and also seems reasonable (I say as I start teaching more theoretical computer science).

Stephen Brown

unread,
Jul 21, 2025, 12:52:22 PM7/21/25
to PreTeXt support
Hi again! Was there any advancement on this feature since our discussion over Zoom? Most of the material that I am working on now is involving examples of input/output from Maple.

Thanks for the help.
Stephen
Reply all
Reply to author
Forward
0 new messages