# [OS X TeX] hyperref problem

Herbert Schulz herbs at wideopenwest.com
Mon Jun 22 11:54:50 EDT 2020

> On Jun 22, 2020, at 10:43 AM, Murray Eisenberg <murrayeisenberg at gmail.com> wrote:
>
>
> 	- In an external previewer, e.g., Adobe Acrobat Reader or macOS Preview, clicking a link takes you to its target.
>
> 	- In the TeXShop previewer, as somebody else pointed out, if you move the mouse to a link, a little window pops up showing the actual target; if you then click the link, it takes you to the page of the link. This is exactly what the TeXShop previewer is supposed to do.
>
> 	It would be really nice if standard, external, previewers had the same feature of the little pop-up window showing the target. It’s a really convenient way to see what the link refers to without having to jump to the target’s page and thereby losing your place in the document!
>
>
>> On 21 Jun2020, at 7:29 PM, Nitecki, Zbigniew H. <Zbigniew.Nitecki at tufts.edu> wrote:
>>
>> Sorry—I missed that the refmacros file needs the formatmacros file.  Here it is:
>>
>> I’ll check out cleverer.  Thanks for the tip.
>>
>> Zbigniew Nitecki
>> Department of Mathematics
>> Tufts University
>> Medford, MA 02155
>>
>> telephones:
>> Office    (617)627-3843
>> Dept.    (617)627-3234
>> Dept. fax    (617)627-3966
>> http://www.tufts.edu/~znitecki/
>>
>>
>>
>>
>>> On Jun 21, 2020, at 17:57, Murray Eisenberg <murrayeisenberg at gmail.com> wrote:
>>>
>>> I could not try your sample source because your package formatmacros was missing from the post.
>>>
>>> However, as to the first hyperref issue: are you aware of the cleveref package, which you to do even more than your \refer command seems to do. For example, with cleveref (and hypreref) you could still use a label such as \label{subsec:first} but don’t actually need the “subsec:” part then, as cleveref will detect what kind of entity it is and then using the \crefname in the preamble allows you to use whatever name you wish when it is referenced (now with \cref rather than \ref).
>>>
>>> For example:
>>>
>>> documentclass{article}
>>>
>>> \usepackage{amsthm}
>>> \newtheorem{thm}{Theorem}[section]
>>>
>>> \usepackage{hyperref}
>>>
>>> \crefname{thm}{Theorem}{Theorems}
>>>
>>> \begin{document}
>>>
>>> \section{First section}\label{mysec:first}
>>>
>>> See \cref{two} in \cref{sec:another-sec}.
>>>
>>> \section{Another section}\label{sec:another-sec}
>>>
>>> \begin{thm}\label{two}
>>> $1+1=2$
>>> \end{thm}
>>>
>>> \end{document}
>>>
>>> will show in the output:
>>>
>>> See Theorem 2.1 in Section 2.
>>>
>>>> On 21 Jun2020, at 4:58 PM, Nitecki, Zbigniew H. <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?
>>>>
>>>> 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.
>>>> 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.  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
>>>> \begin{document}.  Also, one of the pstricks routines I used (pst-ode) defined some parameters via the statement
>>>>                 \pstVerb{
>>>>                 /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.
>>>>
>>>> So for now, I am not using hyperref in these notes, but would like to.
>>>>
>>>> Zbigniew Nitecki
>>>> Department of Mathematics
>>>> Tufts University
>>>> Medford, MA 02155
>>>>
>>>> telephones:
>>>> Office    (617)627-3843
>>>> Dept.    (617)627-3234
>>>> Dept. fax    (617)627-3966
>>>> http://www.tufts.edu/~znitecki/
>>>>
>>>>
>>>>
>>>>
>>>> <refmacros.sty><TestofHyperref.tex><TestofHyperref.log><TestofHyperref.pdf>----------- Please Consult the Following Before Posting -----------
>>>> TeX FAQ: http://www.tex.ac.uk/faq
>>>> List Reminders and Etiquette: https://sites.esm.psu.edu/~gray/tex/
>>>> List Archives: http://dir.gmane.org/gmane.comp.tex.macosx
>>>>                https://email.esm.psu.edu/pipermail/macosx-tex/
>>>> TeX on Mac OS X Website: http://mactex-wiki.tug.org/
>>>> List Info: https://email.esm.psu.edu/mailman/listinfo/macosx-tex
>>>
>>> ---
>>> Murray Eisenberg murrayeisenberg at gmail.com
>>> 503 King Farm Blvd #101  Home (240)-246-7240
>>> Rockville, MD 20850-6667  Mobile (413)-427-5334
>>>
>>>
>>> ----------- Please Consult the Following Before Posting -----------
>>> TeX FAQ: http://www.tex.ac.uk/faq
>>> List Reminders and Etiquette: https://sites.esm.psu.edu/~gray/tex/
>>> List Archives: http://dir.gmane.org/gmane.comp.tex.macosx
>>>                https://email.esm.psu.edu/pipermail/macosx-tex/
>>> TeX on Mac OS X Website: http://mactex-wiki.tug.org/
>>> List Info: https://email.esm.psu.edu/mailman/listinfo/macosx-tex
>>
>> <formatmacros.sty>
>
> ---
> Murray Eisenberg			murrayeisenberg at gmail.com
> 503 King Farm Blvd #101	Home (240)-246-7240
> Rockville, MD 20850-6667	Mobile (413)-427-5334
>

Howdy,

I confirm that compiling the example with a fully updated TeX Live 2020 there is no problem with the links using the TeXShop Preview window.

Good Luck,

Herb Schulz
(herbs at wideopenwest dot com)