Adding Underlines to Hyperlinks

25 views
Skip to first unread message

Carlos Montalvo

unread,
Mar 25, 2026, 6:41:43 PMMar 25
to PreTeXt accessibility
Hi All,

I was sent here by Steven Clontz so hopefully I'm following the right protocol. I had a vision impaired student a few years ago ask me to underline hyperlinks so he could find the links in my pdf textbook easier. That was a fairly simple command in LaTeX but upon converting to PreTeXt the underlining went away. Steven said I may be able to edit the publication.ptx file but that perhaps it could get added into the source code for PreTeXt. 

What does everyone think?

Rob Beezer

unread,
Mar 26, 2026, 11:58:08 AMMar 26
to pretex...@googlegroups.com
Dear Carlos,

You are in exactly the right place.

I think it would make sense to add a "link underline" option to the publication
file. Your question suggests LaTeX/PDF, but now would be the time to decide if
this might apply more broadly (HTML?).

> That was a fairly simple
> command in LaTeX but upon converting to PreTeXt the underlining went away.

By design. ;-)

I could implement the option, and the code for LaTeX. Would you be willing to
do a small exercise that would help with the LaTeX implementation?

Rob
> --
> You received this message because you are subscribed to the Google Groups
> "PreTeXt accessibility" group.
> To unsubscribe from this group and stop receiving emails from it, send an email
> to pretext-a11y...@googlegroups.com <mailto:pretext-
> a11y+uns...@googlegroups.com>.
> To view this discussion visit https://groups.google.com/d/msgid/pretext-
> a11y/89167616-fde9-4a57-bbe9-639052f5c4a7n%40googlegroups.com <https://
> groups.google.com/d/msgid/pretext-a11y/89167616-fde9-4a57-
> bbe9-639052f5c4a7n%40googlegroups.com?utm_medium=email&utm_source=footer>.

Rob Beezer

unread,
Mar 26, 2026, 3:05:21 PMMar 26
to pretex...@googlegroups.com
I've started an allied thread over on "pretext-dev". Anybody can read that, you
need to request a membership to post.

(Some of my conversation with Carlos went off-list, I don't think intentionally.)

Rob

On 3/26/26 09:51, Carlos Montalvo wrote:
> Yes I would be happy to help with underlining for both PDF and HTML versions
> just tell me what needs to be done and I'll get right on it.
>
> Thanks!
>
> -C.
> a11y%2Bunsu...@googlegroups.com> <mailto:pretext- <mailto:pretext->
> > a11y+uns...@googlegroups.com
> <mailto:a11y%2Bunsu...@googlegroups.com>>.
> > To view this discussion visit https://groups.google.com/d/msgid/pretext-
> <https://groups.google.com/d/msgid/pretext->
> > a11y/89167616-fde9-4a57-bbe9-639052f5c4a7n%40googlegroups.com
> <http://40googlegroups.com> <https://
> > groups.google.com/d/msgid/pretext-a11y/89167616-fde9-4a57- <http://
> groups.google.com/d/msgid/pretext-a11y/89167616-fde9-4a57->
> > bbe9-639052f5c4a7n%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 a topic in the
> Google Groups "PreTeXt accessibility" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/topic/
> pretext-a11y/e1t-JQScUsA/unsubscribe <https://groups.google.com/d/topic/
> pretext-a11y/e1t-JQScUsA/unsubscribe>.
> To unsubscribe from this group and all its topics, send an email to pretext-
> a11y+uns...@googlegroups.com <mailto:pretext-
> a11y%2Bunsu...@googlegroups.com>.
> To view this discussion visit https://groups.google.com/d/msgid/pretext-
> a11y/MTAwMDAxOC5iZWV6ZXI.1774540686%40pnsh <https://groups.google.com/d/
> msgid/pretext-a11y/MTAwMDAxOC5iZWV6ZXI.1774540686%40pnsh>.
>
>
>
> --
> Carlos Montalvo, Ph.D.
> Associate Professor
> William B Burnsed Jr,
> Department of Mechanical, Aerospace and Biomedical Engineering
> Aerospace Engineering Curriculum Committee Chair
>
> Faculty Advisor AIAA
>
> 150 Student Services Drive
>
> Shelby Hall, Room 3106
> Mobile, AL 36688-0002
> Telephone #: (251) 460-7458
> Website: http://aerialsystems.org <http://aerialsystems.org/>

bee...@privacyport.com

unread,
Mar 27, 2026, 10:54:14 AMMar 27
to pretex...@googlegroups.com
Well, I was hoping for something with minimal edits. Blasting out the preamble
is not a good omen.

But let me have a look in a bit here. Don't put anymore time into this right now.

Rob

On 3/26/26 16:21, Carlos Montalvo wrote:
> No problem. Here's the raw pretext file and latex file.
>
> 1.) main.ptx - raw pretext file
> 2.) main.tex - generated tex file from "pretext build latex" where project.ptx
> have <target name="latex" format="latex" />.
> 3.) main.pdf - generated with 'pretext build pdf' or 'pdflatex main.tex' (after
> running that command twice)
> 4.) main_underline_links.tex - edited tex file to produce hyperlinks with
> underlines. I tried to use the preamble autogenerated by pretext but I was
> getting a lot of package conflicts so to make it easier I just copied the
> preamble that I use for my LaTeX books. If this isn't what you intended I can go
> back and try to merely edit the preamble rather than doing a full overhaul.
> Because of changing the preamble so drastically I ended up having to edit the
> tex file quite a bit but again just let me know if this isn't what you were
> looking for.
> 5.) main_underline_links.pdf - This is the pdf generated by running 'pdflatex
> main_underline_links.tex' twice.
>
> I hope this helps!
>
> -C.
>
> PS. I pushed the entire repo to my old LaTeX.git if for some reason the
> attachments don't work. https://github.com/cmontalvo251/LaTeX/tree/master/
> example_underline_hyperlinks <https://github.com/cmontalvo251/LaTeX/tree/master/
> example_underline_hyperlinks>
>
> On Thu, Mar 26, 2026 at 12:54 PM Rob Beezer <bee...@privacyport.com
> <mailto:bee...@privacyport.com>> wrote:
>
> Dear Carlos,
>
> Thanks for the enthusiastic reply.  I'm going to assume we can do at least
> PDF/LaTeX, and may need to shunt the HTML question to a larger audience.
>
> Links come from #xref (internal), and #url (external).  Am I forgetting any?
>
> Make a really simple PreTeXt article with one example of each (you'll need
> targets, obviously!).  Generate the *.tex file.  Then, by hand, make the
> least/best edits to the LaTeX to get the look your student needs.
> Preference is
> to add no new LaTeX packages, and otherwise use well-supported ones.  If it is
> complicated, maybe even define a macro in the preamble and use that in the body
>
> Post here (or on a GitHub issue), the (a) PreTeXt, (b) the stock LateX created,
> and (c) the edited desired LaTeX.  I'm on an AI kick right now, so I plan to
> throw those three files at my tool of choice.  I expect it to do a nice job on
> the publisher switch since we already have so many examples that all are
> similar.
>
> Thanks,
> Rob
>
> On 3/26/26 09:51, Carlos Montalvo wrote:
> > Yes I would be happy to help with underlining for both PDF and HTML versions
> > just tell me what needs to be done and I'll get right on it.
> >
> > Thanks!
> >
> > -C.
> >
> > On Thu, Mar 26, 2026 at 10:58 AM 'Rob Beezer' via PreTeXt accessibility
> > <pretex...@googlegroups.com <mailto:pretex...@googlegroups.com>
> <mailto:pretex...@googlegroups.com <mailto:pretext-
> > a11y%2Bunsu...@googlegroups.com
> <mailto:a11y%252Buns...@googlegroups.com>> <mailto:pretext-
> <mailto:pretext-> <mailto:pretext- <mailto:pretext->>
> >      > a11y+uns...@googlegroups.com
> <mailto:a11y%2Bunsu...@googlegroups.com>
> >     <mailto:a11y%2Bunsu...@googlegroups.com
> <mailto:a11y%252Buns...@googlegroups.com>>>.
> >      > To view this discussion visit https://groups.google.com/d/msgid/
> pretext- <https://groups.google.com/d/msgid/pretext->
> >     <https://groups.google.com/d/msgid/pretext- <https://
> groups.google.com/d/msgid/pretext->>
> >      > a11y/89167616-fde9-4a57-bbe9-639052f5c4a7n%40googlegroups.com
> <http://40googlegroups.com>
> >     <http://40googlegroups.com <http://40googlegroups.com>> <https://
> >      > groups.google.com/d/msgid/pretext-a11y/89167616-fde9-4a57-
> <http://groups.google.com/d/msgid/pretext-a11y/89167616-fde9-4a57-> <http://
> > groups.google.com/d/msgid/pretext-a11y/89167616-fde9-4a57- <http://
> groups.google.com/d/msgid/pretext-a11y/89167616-fde9-4a57->>
> >      > bbe9-639052f5c4a7n%40googlegroups.com?
> utm_medium=email&utm_source=footer <http://40googlegroups.com?
> utm_medium=email&utm_source=footer>
> >     <http://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 a topic in the
> >     Google Groups "PreTeXt accessibility" group.
> >     To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/ <https://groups.google.com/d/topic/>
> >     pretext-a11y/e1t-JQScUsA/unsubscribe <https://groups.google.com/d/
> topic/ <https://groups.google.com/d/topic/>
> >     pretext-a11y/e1t-JQScUsA/unsubscribe>.
> >     To unsubscribe from this group and all its topics, send an email to
> pretext-
> > a11y+uns...@googlegroups.com
> <mailto:a11y%2Bunsu...@googlegroups.com> <mailto:pretext- <mailto:pretext->
> > a11y%2Bunsu...@googlegroups.com
> <mailto:a11y%252Buns...@googlegroups.com>>.
> >     To view this discussion visit https://groups.google.com/d/msgid/
> pretext- <https://groups.google.com/d/msgid/pretext->
> >     a11y/MTAwMDAxOC5iZWV6ZXI.1774540686%40pnsh <https://
> groups.google.com/d/ <https://groups.google.com/d/>
> >     msgid/pretext-a11y/MTAwMDAxOC5iZWV6ZXI.1774540686%40pnsh>.
> >
> >
> >
> > --
> > Carlos Montalvo, Ph.D.
> > Associate Professor
> > William B Burnsed Jr,
> > Department of Mechanical, Aerospace and Biomedical Engineering
> > Aerospace Engineering Curriculum Committee Chair
> >
> > Faculty Advisor AIAA
> >
> > 150 Student Services Drive
> >
> > Shelby Hall, Room 3106
> > Mobile, AL 36688-0002
> > Telephone #: (251) 460-7458
> > Website: http://aerialsystems.org <http://aerialsystems.org> <http://
> aerialsystems.org/ <http://aerialsystems.org/>>

Carlos Montalvo

unread,
Mar 27, 2026, 11:03:25 AMMar 27
to PreTeXt accessibility
Since I'm new here I unintentionally replied directly to Rob rather than sending out the email to everyone to view. Here's my original email to Rob about the request for an example set of files.

============================================

No problem. Here's the raw pretext file and latex file. 

1.) main.ptx - raw pretext file
2.) main.tex - generated tex file from "pretext build latex" where project.ptx have <target name="latex" format="latex" />. 
3.) main.pdf - generated with 'pretext build pdf' or 'pdflatex main.tex' (after running that command twice)
4.) main_underline_links.tex - edited tex file to produce hyperlinks with underlines. I tried to use the preamble autogenerated by pretext but I was getting a lot of package conflicts so to make it easier I just copied the preamble that I use for my LaTeX books. If this isn't what you intended I can go back and try to merely edit the preamble rather than doing a full overhaul. Because of changing the preamble so drastically I ended up having to edit the tex file quite a bit but again just let me know if this isn't what you were looking for. 
5.) main_underline_links.pdf - This is the pdf generated by running 'pdflatex main_underline_links.tex' twice. 

I hope this helps!

=============================================

It sounds like unfortunately destroying the entire autogenerated preamble was not the way to go so apologies for that. I should have known better. Either way, let me know what you come up with and I'll continue to help as much as I can. 

main.ptx
main.pdf
main.tex
main_underline_links.tex
main_underline_links.pdf

Rob Beezer

unread,
Mar 27, 2026, 7:18:18 PMMar 27
to pretex...@googlegroups.com
Implemented for LaTeX output only. To get started see:

Subsection 44.3.8: Hyperlink Highlighting
https://pretextbook.org/doc/guide/html/publication-file-latex.html#latex-link-highlight-options

Should be in tomorrow's CLI nightly.

Not a yes/no to underlining. Instead a choice for a "link highlight". Choices
are "none" and "underline". Code is designed to make it easy to add, say, "box".

One note: A citation is an #xref, and you can target a numbered equation with an
#xref. The former looks like [37] and the latter looks like (5.32). Right now,
both get an underline. It'd be easy to say the bracketing is enough, and the
underline looks weird. Or the underline is necessary and good, that's not weird.

Thanks, Carlos, for moving this along.

Rob

Carlos Montalvo

unread,
Mar 31, 2026, 6:24:59 PMMar 31
to PreTeXt accessibility
Thanks Rob. I downloaded the nightly version and tested it and works as intended. Thanks for your help. If there's anything else I can help with let me know.
Reply all
Reply to author
Forward
0 new messages