<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">I could not try your sample source because your package formatmacros was missing from the post.<div class=""><br class=""></div><div class="">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).</div><div class=""><br class=""></div><div class="">For example:</div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><font face="Courier" class="">documentclass{article}</font></div><div style="margin: 0px; font-stretch: normal; line-height: normal; min-height: 22px;" class=""><font face="Courier" class=""><br class=""></font></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><font face="Courier" class="">\usepackage{amsthm}</font></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><font face="Courier" class="">\newtheorem{thm}{Theorem}[section]</font></div><div style="margin: 0px; font-stretch: normal; line-height: normal; min-height: 22px;" class=""><font face="Courier" class=""><br class=""></font></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><font face="Courier" class="">\usepackage{hyperref}</font></div><p style="margin: 0px; font-stretch: normal; line-height: normal; min-height: 22px;" class=""><font face="Courier" class="">  <br class="webkit-block-placeholder"></font></p><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><font face="Courier" class="">\usepackage[nameinlink,noabbrev,capitalize]{cleveref}</font></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><font face="Courier" class="">\crefname{thm}{Theorem}{Theorems}</font></div><div style="margin: 0px; font-stretch: normal; line-height: normal; min-height: 22px;" class=""><font face="Courier" class=""><br class=""></font></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><font face="Courier" class="">\begin{document}</font></div><div style="margin: 0px; font-stretch: normal; line-height: normal; min-height: 22px;" class=""><font face="Courier" class=""><br class=""></font></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><font face="Courier" class="">\section{First section}\label{mysec:first}</font></div><div style="margin: 0px; font-stretch: normal; line-height: normal; min-height: 22px;" class=""><font face="Courier" class=""><br class=""></font></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><font face="Courier" class="">See \cref{two} in \cref{sec:another-sec}.</font></div><div style="margin: 0px; font-stretch: normal; line-height: normal; min-height: 22px;" class=""><font face="Courier" class=""><br class=""></font></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><font face="Courier" class="">\section{Another section}\label{sec:another-sec}</font></div><div style="margin: 0px; font-stretch: normal; line-height: normal; min-height: 22px;" class=""><font face="Courier" class=""><br class=""></font></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><font face="Courier" class="">\begin{thm}\label{two}</font></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><font face="Courier" class="">$1+1=2$</font></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><font face="Courier" class="">\end{thm}</font></div><div style="margin: 0px; font-stretch: normal; line-height: normal; min-height: 22px;" class=""><font face="Courier" class=""><br class=""></font></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><font face="Courier" class="">\end{document}</font></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><br class=""></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class="">will show in the output:</div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><br class=""></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><span class="Apple-tab-span" style="white-space: pre;">       </span>See Theorem 2.1 in Section 2.</div><div><br class=""><blockquote type="cite" class=""><div class="">On 21 Jun2020, at 4:58 PM, Nitecki, Zbigniew H. <<a href="mailto:Zbigniew.Nitecki@tufts.edu" class="">Zbigniew.Nitecki@tufts.edu</a>> wrote:</div><br class="Apple-interchange-newline"><div class="">

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" class="">

<div class="">
<div class="" style="word-wrap:break-word; line-break:after-white-space">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.
<div class=""><br class="">
</div>
<div class="">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</div>
<div class="">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}</div>
<div class="">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.</div>
<div class="">Here is the style file whose main content is that macro:</div>
<div class=""></div>
</div>
<div style="word-wrap:break-word; line-break:after-white-space" class="">
<meta content="text/html; charset=utf-8" class="">
<div class=""></div>
<div class=""><br class="">
</div>
<div class="">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.</div>
<div class="">Here are a short sourcefile and pdf output, as well as a log file:</div>
<div class=""><br class="">
</div>
<div class=""></div>
</div>
<div style="word-wrap:break-word; line-break:after-white-space" class="">
<meta content="text/html; charset=us-ascii" class="">
<div class=""></div>
</div>
<div style="word-wrap:break-word; line-break:after-white-space" class="">
<meta content="text/html; charset=us-ascii" class="">
<div class=""></div>
</div>
<div class="" style="word-wrap:break-word; line-break:after-white-space">
<div class=""></div>
<div class="">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.</div>
<div class="">I don’t know if there is something about the \refer macro that is conflcting with \hyperref, and if so, is there a workaround?</div>
<div class=""><br class="">
</div>
<div class="">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,</div>
<div class="">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.</div>
<div class="">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</div>
<div class="">\newcommand{\c}{\ensuremath{\mathfrak{c}}} led to an “unknown command” error once the hyperref command was moved to immediately precede the </div>
<div class="">\begin{document}.  Also, one of the pstricks routines I used (pst-ode) defined some parameters via the statement </div>
<div class="">
<div class="" style="margin:0px; font-stretch:normal; font-size:12px; line-height:normal">
                \pstVerb{</div>
<div class="" style="margin:0px; font-stretch:normal; font-size:12px; line-height:normal">
                <span class="x_Apple-tab-span" style="white-space:pre"></span>/A -1 def</div>
<div class="" style="margin:0px; font-stretch:normal; font-size:12px; line-height:normal">
                <span class="x_Apple-tab-span" style="white-space:pre"></span>/B 0 def</div>
<div class="" style="margin:0px; font-stretch:normal; font-size:12px; line-height:normal">
                <span class="x_Apple-tab-span" style="white-space:pre"></span>/C 0 def</div>
<div class="" style="margin:0px; font-stretch:normal; font-size:12px; line-height:normal">
                <span class="x_Apple-tab-span" style="white-space:pre"></span>/D -2 def</div>
<div class="" style="margin:0px; font-stretch:normal; font-size:12px; line-height:normal">
                }</div>
<div class="">and this led to unknown command errors.  (They disappeared if I moved the \hyperref call earlier).</div>
<div class="">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.</div>
<div class="">However, I found it strange that this problem only occurred when I moved the hyperref call to the end of the preamble.</div>
<div class=""><br class="">
</div>
<div class="">So for now, I am not using hyperref in these notes, but would like to.</div>
<div class=""><span class="x_Apple-style-span" style="border-collapse:separate; font-variant-ligatures:normal; font-variant-east-asian:normal; line-height:normal; border-spacing:0px"><span class="x_Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-position: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;">
<div class="" style="word-wrap:break-word"><span class="x_Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-position: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;">
<div class="" style="word-wrap:break-word">
<div class="">
<div class="" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; font-size:12px">
<font face="Helvetica" size="3" class="" style="font:normal normal normal 12px/normal Helvetica"><br class="x_Apple-interchange-newline">
Zbigniew Nitecki</font></div>
<div class="" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; font-size:12px">
<font face="Helvetica" size="3" class="" style="font:normal normal normal 12px/normal Helvetica">Department of Mathematics</font></div>
<div class="" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; font-size:12px">
<font face="Helvetica" size="3" class="" style="font:normal normal normal 12px/normal Helvetica">Tufts University</font></div>
<div class="" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; font-size:12px">
<font face="Helvetica" size="3" class="" style="font:normal normal normal 12px/normal Helvetica">Medford, MA 02155</font></div>
<div class="" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; font:normal normal normal 12px/normal Helvetica; min-height:14px; font-size:12px">
<br class="">
</div>
<div class="" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; font-size:12px">
<font face="Helvetica" size="3" class="" style="font:normal normal normal 12px/normal Helvetica">telephones:</font></div>
<div class="" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; font-size:12px">
<font face="Helvetica" size="3" class="" style="font:normal normal normal 12px/normal Helvetica">Office<span class="x_Apple-converted-tab">    </span>(617)627-3843</font></div>
<div class="" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; font-size:12px">
<font face="Helvetica" size="3" class="" style="font:normal normal normal 12px/normal Helvetica">Dept.<span class="x_Apple-converted-tab">    </span>(617)627-3234</font></div>
<div class="" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; font-size:12px">
<font face="Helvetica" size="3" class="" style="font:normal normal normal 12px/normal Helvetica">Dept. fax<span class="x_Apple-converted-tab">    </span>(617)627-3966</font></div>
<span class="x_Apple-style-span" style="font-size:12px"><a href="http://www.tufts.edu/~znitecki/" class="">http://www.tufts.edu/~znitecki/</a></span></div>
</div>
</span><br class="x_Apple-interchange-newline">
</div>
</span><br class="x_Apple-interchange-newline">
</span><br class="x_Apple-interchange-newline">
</div>
<br class="">
</div>
</div>
</div>

<span id="cid:574F147168245346B325733C40CA3CC4@namprd05.prod.outlook.com"><refmacros.sty></span><span id="cid:9E3CE2B30D08894686866724D8EAE339@namprd05.prod.outlook.com"><TestofHyperref.tex></span><span id="cid:8AD7555D046A4047BCD16F87B0B9D4E2@namprd05.prod.outlook.com"><TestofHyperref.log></span><span id="cid:fd70d1a2-2759-4266-869c-b87c5986bcf3@namprd05.prod.outlook.com"><TestofHyperref.pdf></span>----------- Please Consult the Following Before Posting -----------<br class="">TeX FAQ: <a href="http://www.tex.ac.uk/faq" class="">http://www.tex.ac.uk/faq</a><br class="">List Reminders and Etiquette: <a href="https://sites.esm.psu.edu/~gray/tex/" class="">https://sites.esm.psu.edu/~gray/tex/</a><br class="">List Archives: <a href="http://dir.gmane.org/gmane.comp.tex.macosx" class="">http://dir.gmane.org/gmane.comp.tex.macosx</a><br class="">                <a href="https://email.esm.psu.edu/pipermail/macosx-tex/" class="">https://email.esm.psu.edu/pipermail/macosx-tex/</a><br class="">TeX on Mac OS X Website: <a href="http://mactex-wiki.tug.org/" class="">http://mactex-wiki.tug.org/</a><br class="">List Info: <a href="https://email.esm.psu.edu/mailman/listinfo/macosx-tex" class="">https://email.esm.psu.edu/mailman/listinfo/macosx-tex</a><br class=""></div></blockquote></div><br class=""><div class="">
---<br class="">Murray Eisenberg<span class="Apple-tab-span" style="white-space: pre;">                       </span><a href="mailto:murrayeisenberg@gmail.com" class="">murrayeisenberg@gmail.com</a><br class="">503 King Farm Blvd #101<span class="Apple-tab-span" style="white-space: pre;">     </span>Home (240)-246-7240<br class="">Rockville, MD 20850-6667<span class="Apple-tab-span" style="white-space: pre;">  </span>Mobile (413)-427-5334<br class=""><br class="">

</div>
<br class=""></div></body></html>