Tabular alignment (replacement for sign diagram images)

53 views
Skip to first unread message

Sean Fitzpatrick

unread,
Feb 22, 2024, 8:12:28 PM2/22/24
to PreTeXt support
I have both philosophical and technical questions about getting some tabular environments right.

In APEX Calculus, there are numerous places in the curve sketching section where we want to display a sign diagram; that is, a number line indicating where the first and second derivatives are positive/negative.

The original LaTeX version used TikZ for these. At some point we tried to switch to tabular for accessibility reasons, but the results weren't great.

The good news: the same code produces much better looking results than it did several years ago!

The bad news: I still can't get alignment right in some places.

Philosophical questions first: I am wondering which of the following seems like the best option. 

1. Fiddle with the tabulars until they look right. Could involve some violations of PreTeXt philosophy, like using a LaTeX 'phantom' to force alignment.

1a. Someone tells me how to fix the tabulars in a way that complies with PreTeXt philosophy.

2. Keep the TikZ versions, and put the tabular version inside the (long) description.

3. Accept that the tabular isn't really that accessible either, since we are fiddling with the layout to get a desired appearance, stick with the TikZ diagrams, and use the long description to explain what's happening in the image.

Now the technical: I'm including screenshots for some of the results I'm getting because I don't have a live version with the tabulars yet. The tabular code follows the image.

Here is one that looks good:
Screenshot from 2024-02-22 18-01-03.png
It's produced using the following:

<tabular halign="center">
<row bottom="major">
<cell colspan="2" right="minor">
<line><m>\fp\gt0</m>,</line>
<line><m>f</m> incr;</line>
<line><m>\fpp\lt0</m>,</line>
<line><m>f</m> c. down</line></cell>
<cell colspan="2" right="minor">
<line><m>\fp\lt0</m>,</line>
<line><m>f</m> decr;</line>
<line><m>\fpp\lt0</m>,</line>
<line><m>f</m> c. down</line></cell>
<cell colspan="2" right="minor">
<line><m>\fp\lt0</m>,</line>
<line><m>f</m> decr;</line>
<line><m>\fpp\gt0</m>,</line>
<line><m>f</m> c. up</line></cell>
<cell colspan="2">
<line><m>\fp\gt0</m>,</line>
<line><m>f</m> incr;</line>
<line><m>\fpp\gt0</m>,</line>
<line><m>f</m> c. up</line></cell>
</row>
<row>
<cell></cell>
<cell colspan="2">
<line><m>\frac{1}{9}\left(10-\sqrt{37}\right)</m></line>
<line><m>\approx0.435</m></line></cell>
<cell colspan="2">
<line><m>\frac{10}{9}</m></line>
<line><m>\approx1.111</m></line></cell>
<cell colspan="2">
<line><m>\frac{1}{9}\left(10+\sqrt{37}\right)</m></line>
<line><m>\approx1.787</m></line></cell>
<cell></cell>
</row>
</tabular>

Here is one where the numbers at the bottom are not aligned properly (they should align with the vertical rules):
Screenshot from 2024-02-22 18-03-15.png
The confusing part is that the markup is nearly the same. The only difference I can think of is that the numbers aren't as wide. Here's the code:

<tabular halign="center">
<row bottom="major">
<cell colspan="2" right="minor">
<line><m>\fp\gt 0</m>,</line>
<line><m>f</m> incr;</line>
<line><m>\fpp\gt 0</m>,</line>
<line><m>f</m> c. up</line></cell>
<cell colspan="2" right="minor">
<line><m>\fp\gt0</m>,</line>
<line><m>f</m> incr;</line>
<line><m>\fpp\lt0</m>,</line>
<line><m>f</m> c. down</line></cell>
<cell colspan="2" right="minor">
<line><m>\fp\lt0</m>,</line>
<line><m>f</m> decr;</line>
<line><m>\fpp\lt0</m>,</line>
<line><m>f</m> c. down</line></cell>
<cell colspan="2">
<line><m>\fp\lt0</m>,</line>
<line><m>f</m> decr;</line>
<line><m>\fpp\gt0</m>,</line>
<line><m>f</m> c. up</line></cell>
</row>
<row>
<cell></cell>
<cell colspan="2"><m>-2</m></cell>
<cell colspan="2"><m>\frac{1}{2}</m></cell>
<cell colspan="2"><m>3</m></cell>
<cell></cell>
</row>
</tabular>

It seems like the numbers are aligned right, rather than centred. I can push them left by adding a \phantom{} inside the math tags, but that is certainly bad practice.

I haven't yet tried putting a p inside each cell, and then setting column widths, but that's the next thing I'll try.

Rob Beezer

unread,
Feb 22, 2024, 10:54:38 PM2/22/24
to pretext...@googlegroups.com
First reaction.

Why not label each column with an interval? One row exact, the next approximate.

Sean Fitzpatrick

unread,
Feb 22, 2024, 11:00:34 PM2/22/24
to pretext...@googlegroups.com
That could work.

I think the intent is to mimic the hand-drawn method used in class (or at least, the way I've always done it, and seen it done):

1. Draw a line
2. Mark and label zeros and asymptotes on said line
3. Between each potential sign change location mark + or - to indicate the sign of the function/derivative



--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/pretext-support/MTAwMDAyMC5iZWV6ZXI.1708660475%40quikprotect.

Rob Beezer

unread,
Feb 22, 2024, 11:47:01 PM2/22/24
to pretext...@googlegroups.com
Right. But don't we say "increasing on the interval..."

Sean Fitzpatrick

unread,
Feb 22, 2024, 11:59:35 PM2/22/24
to pretext...@googlegroups.com
Yep! I'll have to run this one by Greg.
Or Alex, but I think he no longer has skin in the APEX game.

Alex Jordan

unread,
Feb 23, 2024, 12:06:28 AM2/23/24
to pretext...@googlegroups.com
Now that there is "description" (the long version) I would recommend
your option 3. And make the image as pretty as Greg would like it to
be.
> To view this discussion on the web visit https://groups.google.com/d/msgid/pretext-support/CAH%2BNcPaxpMk5xQTSscFfR3zpPeqDqbi_weXO36wxzQ-NGshvLg%40mail.gmail.com.

Sean Fitzpatrick

unread,
Feb 23, 2024, 12:16:00 AM2/23/24
to pretext...@googlegroups.com
This might be the way to go.

A TikZ image is immune to CSS changes and will look the same in the PDF.

And a written description is probably more helpful than an HTML table for a reader who can't see it.

Rob Beezer

unread,
Feb 23, 2024, 12:44:56 PM2/23/24
to pretext...@googlegroups.com
Dear Sean,

As a Canadian, you will appreciate that I was doing support between periods
while at an NHL hockey game (one requiring that two national anthems be sung). ;-)

For the record, I don't think we will ever have tables where you can associate
text with the rules/borders between entries of the table. Which is how I
understood the root problem here.

So I think it makes sense that:

(a) these are "more complex" *diagrams*, rather than a simple table.

(b) some graphics language (TikZ) is employed to describe the diagram carefully

Rob


On 2/22/24 21:15, Sean Fitzpatrick wrote:
> This might be the way to go.
>
> A TikZ image is immune to CSS changes and will look the same in the PDF.
>
> And a written description is probably more helpful than an HTML table for a
> reader who can't see it.
>
> On Thu, Feb 22, 2024, 10:06 p.m. Alex Jordan <jordanc...@gmail.com
> <mailto:jordanc...@gmail.com>> wrote:
>
> Now that there is "description" (the long version) I would recommend
> your option 3. And make the image as pretty as Greg would like it to
> be.
>
> On Thu, Feb 22, 2024 at 8:59 PM Sean Fitzpatrick
> <dsfitz...@gmail.com <mailto:dsfitz...@gmail.com>> wrote:
> >
> > Yep! I'll have to run this one by Greg.
> > Or Alex, but I think he no longer has skin in the APEX game.
> >
> > On Thu, Feb 22, 2024, 9:47 p.m. Rob Beezer <bee...@privacyport.com
> <mailto:bee...@privacyport.com>> wrote:
> >>
> >> Right.  But don't we say "increasing on the interval..."
> >>
> >> On February 22, 2024 8:00:22 PM PST, Sean Fitzpatrick
> <dsfitz...@gmail.com <mailto:dsfitz...@gmail.com>> wrote:
> >> >That could work.
> >> >
> >> >I think the intent is to mimic the hand-drawn method used in class (or at
> >> >least, the way I've always done it, and seen it done):
> >> >
> >> >1. Draw a line
> >> >2. Mark and label zeros and asymptotes on said line
> >> >3. Between each potential sign change location mark + or - to indicate the
> >> >sign of the function/derivative
> >> >
> >> >
> >> >
> >> >On Thu, Feb 22, 2024, 8:54 p.m. Rob Beezer <bee...@privacyport.com
> <mailto:bee...@privacyport.com>> wrote:
> >> >
> >> >> First reaction.
> >> >>
> >> >> Why not label each column with an interval?  One row exact, the next
> >> >> approximate.
> >> >>
> >> >> On February 22, 2024 5:12:28 PM PST, Sean Fitzpatrick <
> <mailto:pretext-support%2Bunsu...@googlegroups.com>.
> >> >> To view this discussion on the web visit
> >> >>
> https://groups.google.com/d/msgid/pretext-support/MTAwMDAyMC5iZWV6ZXI.1708660475%40quikprotect <https://groups.google.com/d/msgid/pretext-support/MTAwMDAyMC5iZWV6ZXI.1708660475%40quikprotect>
> >> >> .
> >> >>
> >> >
> >>
> >> --
> >> 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%2Bunsu...@googlegroups.com>.
> >> To view this discussion on the web visit
> https://groups.google.com/d/msgid/pretext-support/MTAwMDAxNy5iZWV6ZXI.1708663618%40quikprotect <https://groups.google.com/d/msgid/pretext-support/MTAwMDAxNy5iZWV6ZXI.1708663618%40quikprotect>.
> >
> > --
> > 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%2Bunsu...@googlegroups.com>.
> > To view this discussion on the web visit
> https://groups.google.com/d/msgid/pretext-support/CAH%2BNcPaxpMk5xQTSscFfR3zpPeqDqbi_weXO36wxzQ-NGshvLg%40mail.gmail.com <https://groups.google.com/d/msgid/pretext-support/CAH%2BNcPaxpMk5xQTSscFfR3zpPeqDqbi_weXO36wxzQ-NGshvLg%40mail.gmail.com>.
>
> --
> 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%2Bunsu...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/pretext-support/CA%2BR-jrd1tgH%3Dv-6QhoXvnpR%3DYHrr_6bPQZazfTyE-B8ckM-POg%40mail.gmail.com <https://groups.google.com/d/msgid/pretext-support/CA%2BR-jrd1tgH%3Dv-6QhoXvnpR%3DYHrr_6bPQZazfTyE-B8ckM-POg%40mail.gmail.com>.
>
> --
> 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-suppo...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/pretext-support/CAH%2BNcPb%2BoxumF-DFzTH_oO4rBPECFVZR%3Dy0HHaN3HgqaGWCgtQ%40mail.gmail.com <https://groups.google.com/d/msgid/pretext-support/CAH%2BNcPb%2BoxumF-DFzTH_oO4rBPECFVZR%3Dy0HHaN3HgqaGWCgtQ%40mail.gmail.com?utm_medium=email&utm_source=footer>.
Reply all
Reply to author
Forward
0 new messages