Margin notes and figures (LaTex)

19 views
Skip to first unread message

Sean Fitzpatrick

unread,
Jul 18, 2021, 6:02:49 PM7/18/21
to APEX/Active Calculus MBX conversion
Last summer I got LaTeX styling set up, and we ended up using the "marginnote" LaTeX package to accomplish this. It did the job, but there is one problem: that package is no longer maintained, so it is not a good long term solution.

I am going to experiment with importing Greg's original LaTeX code for notes and figures in the margin. I think all the code needed is supported by the LaTeX packages that PreTeXt uses.

I'll let you know how this goes.

Two requests:

For Greg: have a look at last year's LaTeX conversion, and let me know if there are any issues that stand out for you. If I can fix them, I will.

(This is the PDF for one of our local remixes. I didn't get around to making an 'official' PDF.)

For Alex (or Rob, or David): the LaTeX macro used by Greg in original APEX look something like (I probably have the order wrong)

\mfigure{X}{reference-id}{caption}{path to figure}

Here X is a number between 0 and 1 that sets the vertical position on the page.
Is there any reasonable way to add an attribute on a figure/image/table/aside that would let us set this number in the ptx source?
(It would be reasonable for the answer to be no. I could let everything default to 0.5 and then hand edit the LaTeX source after the fact.)

I am also not confident that Greg's margin figure macro will be able to handle TikZ source. We'll see. If not, I guess I could run a latex-image processing step that outputs to PDF.

gregory...@gmail.com

unread,
Jul 20, 2021, 7:57:36 AM7/20/21
to APEX/Active Calculus MBX conversion
I'll take a look at the .pdf and consider the margin notes.

The mfigure-type command can handle tikz source:

The mfigure,  mtable  and mnote commands in my LaTeX use \put and \AddToShipoutPicture commands and are essentially all the same. Marginal notes are placed with mnote with 2 arguments: one is the vertical height of the note on the page, and the other is the LaTeX code, which can be anything (text, a table, tikz, \includegraphics, etc.).

The mtable command is just an mnote with a caption. The mfigure command is essentially an mnote with caption with a shorthand so we don't have to write \includegraphics each time.

Sean Fitzpatrick

unread,
Jul 20, 2021, 9:03:02 AM7/20/21
to APEX/Active Calculus MBX conversion
I think I've got this working. Trial run (chapter 1 only) was successful. I ran the output to LaTeX overnight and once the kids are off for the day I'll see if it compiles.

I wasn't able to get it to work as a macro for some reason. But since PreTeXt writes the LaTeX for me, that's moot.

In the xsl style sheet I wrote for LaTeX output I've set things up so that it just takes a figure-ptx environment (or table, image or tabular), and wraps it in the \AddShipoutToPicture and a minipage.

Only bad news is there's no way to get PreTeXt to figure out vertical placement ahead of time. So each one is hard coded with an initial placement of 0.5 and then we have to run through the LaTeX and adjust.

In the LaTeX source it prints %% margin figure %% above each one, so you can use that search key to walk through the source.

--
You received this message because you are subscribed to a topic in the Google Groups "APEX/Active Calculus MBX conversion" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/apexactive-calculus-mbx-conversion/kbN84PuuWVk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to apexactive-calculus-mbx...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/apexactive-calculus-mbx-conversion/92c40a53-aa5c-441c-985a-51174843aac1n%40googlegroups.com.

Sean Fitzpatrick

unread,
Jul 20, 2021, 5:18:55 PM7/20/21
to APEX/Active Calculus MBX conversion
New margin figure code works, with one issue: figures within examples sometimes get placed on the previous page.
This is almost certainly an issue with the fact that the example environment is a tcolorbox.

I'll see if I can figure out how to fix it. (But it might be tricky...)

gregory...@gmail.com

unread,
Jul 21, 2021, 12:58:59 PM7/21/21
to APEX/Active Calculus MBX conversion
Where is the code that defines the example environment? My original coding was clunky in LaTeX, and for another project I made a proper environment vs. command that was cleaner. I think such an approach might be better than a tcolorbox, and may help with the figures.

Sean Fitzpatrick

unread,
Jul 21, 2021, 2:35:58 PM7/21/21
to apexactive-calcul...@googlegroups.com
Right now we are relying on the example environment provided by PreTeXt, which uses a tcolorbox. In the xsl files provided in the style/ folder I've added styling for the example tcolorbox that replicates "Greg's L" for the examples.

Changing to a different example environment could be tricky, since that is going to change how PreTeXt makes the .tex file. Maybe Alex or Rob would have ideas (or try to talk us out of changing anything)
You received this message because you are subscribed to the Google Groups "APEX/Active Calculus MBX conversion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to apexactive-calculus-mbx...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/apexactive-calculus-mbx-conversion/49a2831a-11a2-4890-8cf0-785242f33504n%40googlegroups.com.

Sean Fitzpatrick

unread,
Jul 22, 2021, 11:50:46 PM7/22/21
to APEX/Active Calculus MBX conversion
In case anyone has opinions on this: I've got a working solution, that involves putting marginal content in a \tcolorbox, and then putting that in a \savebox, which in turn goes in a \vbox, and then some horizontal shifting to get things in place. But it's a bit flaky.
Suggestion is to use a package called xcoffin.

I'll test this and see how it goes.

Pros: places the margin item using the insertion point as the reference point. Macro provided by the person answering on TeX SE includes a vertical shift factor to adjust overlapping margin boxes.
Cons: requires an unfamiliar LaTeX package.
Reply all
Reply to author
Forward
0 new messages