[OS X TeX] hyperref problem

Ross Moore ross.moore at mq.edu.au
Sun Jun 21 23:02:44 EDT 2020

Hi Zbigniew.

On 22 Jun 2020, at 12:26 pm, Nitecki, Zbigniew H. <Zbigniew.Nitecki at tufts.edu<mailto:Zbigniew.Nitecki at tufts.edu>> wrote:

Thank you for taking the time to write all this very useful and thoughtful advice.

I am properly chastened for my sinful shortcut with the \c macro—and I should have realized its use in the context of foreign languages.
My current project doesn’t involve any references, but I used the foreign language packages extensively when writing my earlier book(s), particularly for foreign names.  I will try to go back and figure out what is going wrong a little more carefully and patiently.

There are usually very good reasons why something doesn’t work;
usually a clash of some kind.

I have a question about the pdfx package you mention at the end of your email.  I had not heard of it;  what exactly does it do?

It is for adding the Metadata, and enabling features designed to ensure that the PDF
has sufficient information for proper extraction of its visual and textual content, well into the future.
 (no matter how software tools change, that is)
If you Google for PDF/A you will find lots of material about what it is for and why it is desirable;
totally independent of producing PDFs with TeX/LaTeX/etc.

 Is it part of MacTex or TeX Live—in other words do I need to download it separately?

It has been in TeXLive for quite awhile now (at least 4 years), but dates back much longer.

Do I call it with a \usepackage command?

Read its documentation.    texdoc pdfx   in a terminal should bring it up.

I’m not quite sure what the whole validation process is about.  I gather it has to do with making one’s source code compatible with global standards, which I am happy to try to do.

Nothing about LaTeX source.
It is about ensuring the PDF has everything, and that fonts are embedded
and have tables that map all their characters into Unicode sub-strings, etc.

(One of my worst publication experiences was with an article for the American Mathematical Monthly—my macros, even when I supplied the macro files, just wouldn’t cooperate with the MAA style file;  the editor at one point threatened, even though he liked the paper, to reject it on technical grounds.

Editors, especially the technical kind, are the ones that are meant to solve compatibility problems.
Authors write down their ideas, in whatever way is convenient and precise.
Editors handle the technical aspects of making those ideas reliably readable.

I ended up going through a 20-page paper and replacing every one of my macro occurrences with its definition.

That’s just the wrong way to handle such things.
It makes more work for everyone.

 BTW, that would be a very useful kind
of script, if someone who knows these things were to write it.)

The most you should have to do is rename the macro, to avoid conflict with something
they already use.
If there’s an issue with macro-expansion after that, then they should be able to sort it out.

Thanks again for your advice.  I really appreciate it.

You’re welcome.

All the best.


Best regards
Ziggy Nitecki

Zbigniew Nitecki
Department of Mathematics
Tufts University
Medford, MA 02155

Office    (617)627-3843
Dept.    (617)627-3234
Dept. fax    (617)627-3966

On Jun 21, 2020, at 21:27, Ross Moore <ross.moore at mq.edu.au<mailto:ross.moore at mq.edu.au>> wrote:

Hi Zbigniew,

On 22 Jun 2020, at 6:58 am, Nitecki, Zbigniew H. <Zbigniew.Nitecki at tufts.edu<mailto:Zbigniew.Nitecki at tufts.edu>> wrote:

I just finished writing up a longish (50pp) set of notes using TeXShop; in the process I ran into two sets of problems, one involving hyperref, the  other a problem with the TeXShop editor.  I’m separating my questions into two emails.  This one concerns hyperref, for which I can provide a reasonably minimal example.  I’ll address my editor problems in a subsequent email.

I have for quite some time used a modification of the \ref macro in latex, which works as follows: labels are always in the format \label{#1:#2}, where #1
identifies a descriptive term like ’Section”  or “Theorem” and #2 identifies which one it is;  then when I want to refer back to the labeled item, I write \refer{#1}{#2}
and what gets printed is the descriptive term followd by the number.  I found this very useful, particularly in writing a book, to make the spelling and capitalization of cross references uniform.
Here is the style file whose main content is that macro:

All has gone well, and as I recall (it’s been a few years) it seemed to work well with hyperref on my book project as well.  But this time something went wrong.  There are two problems, but I think only the first can be addressed in this forum.
Here are a short sourcefile and pdf output, as well as a log file:

I find that when I compile this, if I immediately click on one of the (red) hyperlinked items, I am taken to the appropriate page (there are only two pages in this example).  However, any subsequent click on a hyperlinked item gives me only a little window showing what the text referred to looks like—it doesn’t go to the appropriate page.  I should clarify that this behavior is when I am in view in TeXShop.When I open just the pdf (so it opens in Preview, not in TeXShop, the hyperlinks seem to work.
I don’t know if there is something about the \refer macro that is conflcting with \hyperref, and if so, is there a workaround?

No. This will not have anything to do with the (back-end) macros that you use.

The small (Prelink) window is a feature added quite recently (say within 3 years).
It was used in Skim for awhile before it came into TeXshop’s Preview.
Someone else might be able to say exactly when (and why) this feature has been added to the TeXshop front-end.
It should show up simply by hovering your mouse over the active rectangle which is associated with the hyperlink.
Then actually clicking within that rectangle should activate the link as previously.
It may be that once the small Prelink window comes up, you cannot tell where the active rectangle is anymore,
or it may be completely obscured.
Is there a setting to shift where the Prelink window is located, w.r.t. the active rectangle?
Again, someone else may be able to answer this question.

The second hyperref problem is harder to pin down.  I actually have a lot of self-defined macros, mostly formatting notation, so in my actual source file,
there were both a number of \usepackage commands in the preamble which referred to my  macro packages—as well as pstricks and other packages—and a lot of \newcommands specific to the notes.

Not at all uncommon.

I initially had the call to \hperref in the middle of my preamble, and then I was experiencing the problem described by the example.  But then I looked at the hyperref manual and it said that the call should come after all the other calls.  So I moved it, and all hell broke loose.

That recommendation in the hyperref manual was made roughly 20 years ago.
The reasoning is that quite a few macros need to be patched to support automatic creation
of advanced PDF features, such as Bookmarks, hyperlinked cross-references to sections,
citations, etc. as well as external hyperlinking.
It was then thought that it was best to delay Hyperref until as late as possible, so that when it does
its patching, it will build on top of whatever other packages may have done themselves, earlier
within the preamble.

Such advice is now grossly out-dated.
There are better ways to delay the patching until other packages have been loaded.
Nowadays I find it best to load hyperref as early as possible, so that you know what
you have and can build on top of that (using the better methods).

Another thing that is very important is that you don’t define home-grown macros
with names that will be altered by Hyperref, because they are standard in many
ways although you do not actually use them yourself.

This next problem is an example of exactly this.

 For example, I had at one point decided to use fraktur in one place in the notes, so put in a short sequence of macros for typing a,b,c, d, and A in fraktur.  Most of them were ok, except
\newcommand{\c}{\ensuremath{\mathfrak{c}}} led to an “unknown command” error once the hyperref command was moved to immediately precede the

I’m surprised that  \newcommand{\c}{… }  doesn’t throw an error immediately.
 \c  is the accent command for a cedilla, as is rather common in French and other languages.
By making this definition, you will never be able to properly typeset a co-author or citation-author’s name
such as   Fran\c{c}ois .

This affects hyperref, because in the advanced features it supports, it is necessary to declare
such macro names for encodings other than ones directed at specific font characters.
Hence all macros in commonly-used language encodings also become defined whenever hyperref is required.

In my mind, having single-letter user-defined macros is a real no-no.
Very many letters are used this way already for various languages and encodings.
Thus you are just asking for trouble when using hyperref, unless you are very careful
in how you choose macro names.

Trying to find single-letter names that are not already used, and remembering what you defined them for
is just a fool’s game. Better is to be more descriptive: e.g.  \frakc  in your case.
Yes, it’s more typing, at first; but with copy/paste and/or command completion it really is not so.
Furthermore, your LaTeX sources become easier to read and understand/proofread  than when every
3rd or 4th letter is a backslash.

Even 2-letter names commonly have another use.   (\it, \rm, \tt, \sc, \sf, \ij, \dj, \dz , … )
The only 2-letter combinations that I use are ones that clearly jolt the mind as to
their intended meaning; e.g. \RR , \QQ, \CC  etc. for  \mathbb  letters, or bold-face symbols.
Using \bb, \cc, \xx, \yy etc.  for vectors is generally acceptable, but beware \tt  and that  \aa  and \AA
already have a meaning.   (think the symbol for Angstrøm units, or in Swedish names).

Also, one of the pstricks routines I used (pst-ode) defined some parameters via the statement
                /A -1 def
                /B 0 def
                /C 0 def
                /D -2 def
and this led to unknown command errors.  (They disappeared if I moved the \hyperref call earlier).
Again, I don’t know what is going on, but this one is harder to correct because there are a lot of possible conflicts spread over many files.
However, I found it strange that this problem only occurred when I moved the hyperref call to the end of the preamble.

Not so strange, when you realise that  hyperref  is encountering a macro name that it is trying to declare
for a standard meaning, but it has been usurped by something already defined.

So for now, I am not using hyperref in these notes, but would like to.

My advice is to go back to loading it early,
and take great care about resolving any errors that you may encounter.

If you have lots of foreign names in your References, check them to make sure
 a.  that they are actually typeset correctly;
 b.  try to Copy/Paste your whole reference section into a text-file; check
      for errors in the spellings that may result.

Also, I recommend doing:

 c.  load the  pdfx  package to generate PDF/A-2u output, to attempt to conform to
      a published standard for Archivability.

There is a lot of stuff in there specifically to allow you to detect and fix the kinds of
errors that are discussed above.
But you’ll need to check your PDFs with validation software.
There are a number of online PDF/A validators, so you don’t need to have purchased
a licence for Acrobat Pro, or other costly software.
(But if your institution gives you cheap access to Acrobat Pro, then it is well worth having.)

Hope this helps.


Zbigniew Nitecki
Department of Mathematics
Tufts University
Medford, MA 02155

Office    (617)627-3843
Dept.    (617)627-3234
Dept. fax    (617)627-3966

<refmacros.sty><TestofHyperref.tex><TestofHyperref.log><TestofHyperref.pdf>----------- Please Consult the Following Before Posting -----------
TeX FAQ: https://protect-au.mimecast.com/s/haBqCwV1jpSoW5PQSqKkVT?domain=tex.ac.uk<https://protect-au.mimecast.com/s/eNGACK1DOrCLGXQ4ivnSGX?domain=tex.ac.uk>
List Reminders and Etiquette: https://protect-au.mimecast.com/s/-dmXCxngGkfZ3pB0SY9yff?domain=sites.esm.psu.edu<https://protect-au.mimecast.com/s/GUMICL7Eg9fLZG0QiPWX0r?domain=sites.esm.psu.edu>
List Archives: https://protect-au.mimecast.com/s/uahlCyoj8PuYRGJWSR9OPu?domain=dir.gmane.org<https://protect-au.mimecast.com/s/KNLCCMwGj8CjAwpzsWN0tN?domain=dir.gmane.org>
TeX on Mac OS X Website: https://protect-au.mimecast.com/s/w7VKCANpnDCjzxVofMkjBJ?domain=mactex-wiki.tug.org<https://protect-au.mimecast.com/s/7-RFCOMK7Yc3y7DvI56Qak?domain=mactex-wiki.tug.org>
List Info: https://protect-au.mimecast.com/s/u3O0CBNqgBCvOxAmsv1q37?domain=email.esm.psu.edu<https://protect-au.mimecast.com/s/BnKXCP7L1NfQkjB3hBI4os?domain=email.esm.psu.edu>

Dr Ross Moore
Department of Mathematics and Statistics
12 Wally’s Walk, Level 7, Room 734
Macquarie University, NSW 2109, Australia
T: +61 2 9850 8955  |  F: +61 2 9850 8114
M:+61 407 288 255  |  E: ross.moore at mq.edu.au<mailto:ross.moore at mq.edu.au>

----------- Please Consult the Following Before Posting -----------
TeX FAQ: http://www.tex.ac.uk/faq<https://protect-au.mimecast.com/s/eNGACK1DOrCLGXQ4ivnSGX?domain=tex.ac.uk>
List Reminders and Etiquette: https://sites.esm.psu.edu/~gray/tex/<https://protect-au.mimecast.com/s/GUMICL7Eg9fLZG0QiPWX0r?domain=sites.esm.psu.edu/>
List Archives: http://dir.gmane.org/gmane.comp.tex.macosx<https://protect-au.mimecast.com/s/KNLCCMwGj8CjAwpzsWN0tN?domain=dir.gmane.org>
TeX on Mac OS X Website: http://mactex-wiki.tug.org/<https://protect-au.mimecast.com/s/7-RFCOMK7Yc3y7DvI56Qak?domain=mactex-wiki.tug.org/>
List Info: https://email.esm.psu.edu/mailman/listinfo/macosx-tex<https://protect-au.mimecast.com/s/BnKXCP7L1NfQkjB3hBI4os?domain=email.esm.psu.edu>

----------- Please Consult the Following Before Posting -----------
TeX FAQ: https://protect-au.mimecast.com/s/eNGACK1DOrCLGXQ4ivnSGX?domain=tex.ac.uk
List Reminders and Etiquette: https://protect-au.mimecast.com/s/GUMICL7Eg9fLZG0QiPWX0r?domain=sites.esm.psu.edu/
List Archives: https://protect-au.mimecast.com/s/KNLCCMwGj8CjAwpzsWN0tN?domain=dir.gmane.org
TeX on Mac OS X Website: https://protect-au.mimecast.com/s/7-RFCOMK7Yc3y7DvI56Qak?domain=mactex-wiki.tug.org/
List Info: https://protect-au.mimecast.com/s/BnKXCP7L1NfQkjB3hBI4os?domain=email.esm.psu.edu

Dr Ross Moore
Department of Mathematics and Statistics
12 Wally’s Walk, Level 7, Room 734
Macquarie University, NSW 2109, Australia
T: +61 2 9850 8955  |  F: +61 2 9850 8114
M:+61 407 288 255  |  E: ross.moore at mq.edu.au<mailto:ross.moore at mq.edu.au>
[cid:image001.png at 01D030BE.D37A46F0]
CRICOS Provider Number 00002J. Think before you print.
Please consider the environment before printing this email.

This message is intended for the addressee named and may
contain confidential information. If you are not the intended
recipient, please delete it and notify the sender. Views expressed
in this message are those of the individual sender, and are not
necessarily the views of Macquarie University. <http://mq.edu.au/>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://email.esm.psu.edu/pipermail/macosx-tex/attachments/20200622/534b18c9/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 4605 bytes
Desc: image001.png
URL: <https://email.esm.psu.edu/pipermail/macosx-tex/attachments/20200622/534b18c9/attachment.png>

More information about the MacOSX-TeX mailing list