[OS X TeX] hyperref problem

Herbert Schulz herbs at wideopenwest.com
Tue Jun 23 15:50:19 CEST 2020


> On Jun 21, 2020, at 6: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}
>>   
>> \usepackage[nameinlink,noabbrev,capitalize]{cleveref}
>> \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/

Howdy,

Hmmm... I just added a line to Section 1 before Sub-Section 1 and empty lines before and after the \newpage. I compiled using the xelatexmk engine (move it from ~/Library/TeXShop/Engines/Inactive/Latexmk up to ~/Library/TeXShop/Engines) and the problem disappeared.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: TestofHyperref.tex
Type: application/octet-stream
Size: 1141 bytes
Desc: not available
URL: <https://tug.org/pipermail/macostex-archives/attachments/20200623/01180a78/attachment-0003.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: TestofHyperref.pdf
Type: application/pdf
Size: 26583 bytes
Desc: not available
URL: <https://tug.org/pipermail/macostex-archives/attachments/20200623/01180a78/attachment-0001.pdf>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: formatmacros.sty
Type: application/octet-stream
Size: 14602 bytes
Desc: not available
URL: <https://tug.org/pipermail/macostex-archives/attachments/20200623/01180a78/attachment-0004.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: refmacros.sty
Type: application/octet-stream
Size: 1521 bytes
Desc: not available
URL: <https://tug.org/pipermail/macostex-archives/attachments/20200623/01180a78/attachment-0005.obj>
-------------- next part --------------


Good Luck,

Herb Schulz
(herbs at wideopenwest dot com)

-------------- next part --------------
----------- 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


More information about the macostex-archives mailing list.