Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Adding colon to appendix section, but not to references

19 views
Skip to first unread message

Holger Schieferdecker

unread,
Jul 20, 2022, 6:21:33 AM7/20/22
to
Hello,

A colleague of mine writes an article for a journal. The style guide for
sections and subsections in the appendix is like

APPENDIX A: Title
1. Subtitle for A

He managed to get the uppercase APPENDIX and the colon and final dot.
But now the references look bad (like see B: or see 1.. at the end of a
sentence). I found some approaches, but couldn't make them work.

https://tex.stackexchange.com/a/413816
https://tex.stackexchange.com/q/22435 (first two answers)

The document with the bad references is below. It would look better if
the colon and the dot would not appear in the references. Any help is
appreciated.

Holger


%%%%%%%%%%%%%%%%%%%%%%
\documentclass[showpacs,preprintnumbers,amsmath,reprint,aps,prx,superscriptaddress]{revtex4-2}

\usepackage[colorlinks]{hyperref}
\usepackage[T1]{fontenc}
\usepackage[title]{appendix}

\begin{document}
\title{Best paper ever}
\author{My Name}
\affiliation{Institute}
\date{\today}
\maketitle

\section{Introduction}
\label{sec:intro}
This is a short introduction to the topic.

\begin{appendices}
\renewcommand*{\appendixname}{APPENDIX}
\renewcommand*{\thesection}{\Alph{section}:}
\renewcommand*{\thesubsection}{\arabic{subsection}.}

\section{Boosting the signals}
\label{sec:boost}
This is an appendix section.

More details are given in section \ref{sec:REMPI} and \ref{sec:REMPI1}.

\section{The next appendix}
\label{sec:REMPI}
Here are more details.

\subsection{Subsection in second appendix}
\label{sec:REMPI1}
Even more stuff.

\end{appendices}

\end{document}
%%%%%%%%%%%%%%%%%%%%%%

Holger Schieferdecker

unread,
Jul 27, 2022, 4:11:42 AM7/27/22
to
Am 20.07.2022 um 12:16 schrieb Holger Schieferdecker:
> A colleague of mine writes an article for a journal. The style guide for
> sections and subsections in the appendix is like
>
> APPENDIX A: Title
> 1. Subtitle for A
>
> He managed to get the uppercase APPENDIX and the colon and final dot.
> But now the references look bad (like see B: or see 1.. at the end of a
> sentence).

For reference: Sometimes the solution is making it more simple. :-)
Removing the package appendix and just using \appendix and changing
\appendixname solves the problem (see changes in the example below).

Holger

> %%%%%%%%%%%%%%%%%%%%%%
> \documentclass[showpacs,preprintnumbers,amsmath,reprint,aps,prx,superscriptaddress]{revtex4-2}
>
>
> \usepackage[colorlinks]{hyperref}
> \usepackage[T1]{fontenc}
> \renewcommand*{\appendixname}{APPENDIX}
>
> \begin{document}
> \title{Best paper ever}
> \author{My Name}
> \affiliation{Institute}
> \date{\today}
> \maketitle
>
> \section{Introduction}
> \label{sec:intro}
> This is a short introduction to the topic.
>
> \appendix
>
> \section{Boosting the signals}
> \label{sec:boost}
> This is an appendix section.
>
> More details are given in section \ref{sec:REMPI} and \ref{sec:REMPI1}.
>
> \section{The next appendix}
> \label{sec:REMPI}
> Here are more details.
>
> \subsection{Subsection in second appendix}
> \label{sec:REMPI1}
> Even more stuff.
>
> \end{document}
> %%%%%%%%%%%%%%%%%%%%%%

vincent....@gmail.com

unread,
Aug 11, 2022, 6:54:33 PM8/11/22
to
Holger Schieferdecker <spam...@gmx.de> writes:

> Hello,
>
> A colleague of mine writes an article for a journal. The style guide for
> sections and subsections in the appendix is like
>

[...]

>

Each section command writes to the .aux file a \newlabel command to
create the reference. Maybe you could redefine this command to remove
the trailing colon. Something like that (not tested!!) :

\makeatletter
\newcommand*\org@newlabel{}
\let\org@newlabel\newlabel
\renewcommand*\newlabel[2]{{\def\@tempa##1##2##3##4##5{\count0=#2
\def\@tempb{{##3}{##4}{##5}}%
}%
\@tempa#2%
\edef\@tempa{\noexpand\org@newlabel{#1}{{APPENDIX \@Alph\count0}{\the\count0}\@tempb}}%
\expandafter}\@tempa
}
\makeatother

Vincent

vincent....@gmail.com

unread,
Aug 12, 2022, 1:12:00 AM8/12/22
to
vincent....@gmail.com writes:

> Holger Schieferdecker <spam...@gmx.de> writes:
>
>> Hello,
>>
>> A colleague of mine writes an article for a journal. The style guide for
>> sections and subsections in the appendix is like
>>
>
> [...]
>
>>
>
> Each section command writes to the .aux file a \newlabel command to
> create the reference. Maybe you could redefine this command to remove
> the trailing colon.

[...]

> Vincent

This way seems to work:

--------8<-----------8<-----------8<-----------8<-----------8<-------
% In preamble
\DeclareRobustCommand*\annexesecnumformatter[1]{ANNEXE #1:}% with colon
\makeatletter
\newcommand*\org@newlabel{}
\let\org@newlabel\newlabel
\renewcommand*\newlabel[2]{{%
\def\annexesecnumformatter##1{ANNEXE ##1}% w/o colon
\edef\@tempa{\noexpand\org@newlabel{#1}{#2}}%
\expandafter}\@tempa
}
\makeatother

...
% In APPENDIX
\renewcommand*\thesection{\annexesecnumformatter{\Alph{section}}}
--------8<-----------8<-----------8<-----------8<-----------8<-------

Vincent

Holger Schieferdecker

unread,
Aug 15, 2022, 5:27:14 AM8/15/22
to
Hello Vincent,

Thank you very much for the idea. This gives the desired result when
using the package appendix.

Am 12.08.2022 um 07:11 schrieb vincent....@gmail.com:
>> Each section command writes to the .aux file a \newlabel command to
>> create the reference. Maybe you could redefine this command to remove
>> the trailing colon.

Full working example (with slight changes) is below.

Thanks again,
Holger

%%%%%%%%%%%%%%%%%%%%%
\documentclass[showpacs,preprintnumbers,amsmath,reprint,aps,prx,superscriptaddress]{revtex4-2}

\usepackage[colorlinks]{hyperref}
\usepackage[T1]{fontenc}
\usepackage[title]{appendix}

\DeclareRobustCommand*\annexesecnumformatter[1]{#1:}% with colon
\makeatletter
\newcommand*\org@newlabel{}
\let\org@newlabel\newlabel
\renewcommand*\newlabel[2]{{%
\def\annexesecnumformatter##1{##1}% w/o colon
\edef\@tempa{\noexpand\org@newlabel{#1}{#2}}%
\expandafter}\@tempa
}
\makeatother

\begin{document}
\title{Best paper ever}
\author{My Name}
\affiliation{Institute}
\date{\today}
\maketitle

\section{Introduction}
\label{sec:intro}
This is a short introduction to the topic.

\begin{appendices}
\renewcommand*{\appendixname}{APPENDIX}
\renewcommand*\thesection{\annexesecnumformatter{\Alph{section}}}
\renewcommand*{\thesubsection}{\arabic{subsection}}

\section{Boosting the signals}
\label{sec:boost}
This is an appendix section.

More details are given in section \ref{sec:REMPI} and \ref{sec:REMPI1}.

\section{The next appendix}
\label{sec:REMPI}
Here are more details.

\subsection{Subsection in second appendix}
\label{sec:REMPI1}
Even more stuff.

\end{appendices}

\end{document}
%%%%%%%%%%%%%%%%%%%%%%%%%
0 new messages