Hi,

I am trying to adapt a package called parnotes (which can be called using \usepackage{parnotes}. Its original source code can be downloaded at CTAN here.

The line of code I want to "adapt" (i.e. change when implemented in another .tex-document) lives inside the following piece:

\long\def\PN@parnote@real#1{

\parnotemarkfmt{PN@n}\nolinebreak\thinspace#1

\unless\ifnum\c@PN@n=\c@PN@t
\parnoteintercmd
\fi
}
\unskip\parnotemarkfmt{PN@t}
}


The only line I want to be change is the last one. I would like it to become:

    \unskip\textsuperscript{\parnotemarkfmt{PN@t}}


I know when this change performs perfect (I tweaked the downloadable source code at CTAN), but I would like to ask you for help, since I don't know how to change this line of code from outside (i.e. from a new .tex-file).

I would think (since I was able to adapt another line of code of the source this way) one would use in the preamble of a new .tex-document:

\makeatletter
\renewcommand{...???...}
\makeatother


Or perhaps someone knows an alternative way using \let ...?

• The default definition of \parnotemarkfmt already has \textsuperscript. Why would you want to add another level of superscripting? – egreg Dec 21 '14 at 21:30
• @egreg; I am trying to make the parnotes behave exactly like cross-referenced ("hyperlinked") endnotes which use hyperendnotes. --- The hyperendnotes package can be found here and can be included by addding \input{hyperendnotes.sty}to the preamble. --- These hyperendnotes-numbers have a different look then normal endnotes (they are larger, but only below \theendnotes; not in the "body"-text, where any footnote-number is first mentioned). Hence displacing the \textsuperscript. I will show a MWE below your answer. – Vincent Mia Edie Verheyen Dec 21 '14 at 22:40

Here's a minimal example:

\documentclass{article}
\usepackage{parnotes}

\begin{document}

\begin{autopn}
Text\parnote{parnote}

Text
\end{autopn}

\end{document}


which outputs

With your proposed change it would become

that's definitely bad, because the exponent is too high (besides being too small, but this is a question of taste).

The “easy” way, with which I produced the example, is

\usepackage{etoolbox}
\makeatletter
\patchcmd{\PN@parnote@real}
{\parnotemarkfmt{PN@t}}
{\textsuperscript{\parnotemarkfmt{PN@t}}}
{}{}
\makeatother


There are many examples of how \patchcmd can be used; see, for instance, Please tutor the usage of patchcmd and xpatch

However, in this case this is the wrong way to go. Indeed, the package provides \parnotemarkfmt exactly for the purpose of formatting the marker in text.

Its definition by the package is

\providecommand{\parnotemarkfmt}[1]{\textsuperscript{\PN@mark@set{#1}}}


(by the way, \newcommand should be used here, but it's of no consequence for the topic at hand). As you see, \textsuperscript is used. For information, \PN@mark@set is, by default, the same as \arabic.

If you want to reduce the size of the exponent, you can simply change the definition of \parnotemarkfmt. If you want a smaller exponent, you can define a \textsmallsuperscript macro based on what \textsuperscript does:

% latex.ltx, line 6017:
\DeclareRobustCommand*\textsuperscript[1]{%
\@textsuperscript{\selectfont#1}}
\def\@textsuperscript#1{%
{\m@th\ensuremath{^{\mbox{\fontsize\sf@size\z@#1}}}}}


So we can do

\DeclareRobustCommand*\textsmallsuperscript[1]{%
\vincent@textsmallsuperscript{\selectfont#1}}
\def\vincent@textsmallsuperscript#1{%
{\m@th\ensuremath{^{\mbox{\fontsize\ssf@size\z@#1}}}}}


Using a prefix before the “internal macro marker” @ is good practice.

Complete example:

\documentclass{article}
\usepackage{parnotes}

\makeatletter
\DeclareRobustCommand*\textsmallsuperscript[1]{%
\vincent@textsmallsuperscript{\selectfont#1}}
\def\vincent@textsmallsuperscript#1{%
{\m@th\ensuremath{^{\mbox{\fontsize\ssf@size\z@#1}}}}}% <--- use scriptscriptsize

\renewcommand{\parnotemarkfmt}[1]{\textsmallsuperscript{\PN@mark@set{#1}}}
\makeatother

\begin{document}

\begin{autopn}
Text\parnote{parnote}

Text
\end{autopn}

\end{document}


• Thanks a lot, worked like a charm. You can see the implementation in another post. --- One last question: What is really nice about the parnotes is that they have a fixed indent: note that when reaching 2 digits (at number 10), the parnotes don't shift to the right, while the endnotes do? --- I wonder if the indent of the endnotes could become fixed as well? – Vincent Mia Edie Verheyen Dec 22 '14 at 0:09
• @rdhs When will it be available? – egreg Jul 26 '16 at 9:31
• I've already uploaded it to CTAN, so give it a day or so. Alternatively, get it from my GitHub page: github.com/chelh/LaTeX-parnotes/releases – Chel Jul 26 '16 at 11:16