Skip to content

Commit

Permalink
Fix appendix section titles
Browse files Browse the repository at this point in the history
The example style file has appendix titles formatted as "Appendix A.", but the current `.sty` file only outputs "A." by default. This can't be fixed by packages like `appendix` or `titlesec` due to the custom sectioning of the `.sty` file. This patch modifies the section display when the `\appendix` command is run so that the appendix titles are displayed correctly.
  • Loading branch information
dlej committed Nov 7, 2022
1 parent 70b4d89 commit 78d403a
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 11 deletions.
37 changes: 27 additions & 10 deletions jmlr2e.sty
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
% Do not define proof environemtn if already defined. (Thank you James Martens)
% Last edited Sept 5, 2022 Alp Kucukelbir
% Disclose funding.
% Last edited Oct 17, 2022 Daniel LeJeune
% Fixed appendix title display.
%
% The name of this file should follow the article document
% type, e.g. \documentstyle[jmlr]{article}
Expand Down Expand Up @@ -131,6 +133,31 @@
#7}}\fi
\@xsect{#5}}

% Title each appendix with `Appendix` before its letter
\let\originalJMLRappendix\appendix
\renewcommand{\appendix}{
\originalJMLRappendix
\def\@sict##1##2##3##4##5##6[##7]##8{\ifnum ##2>\c@secnumdepth
\def\@svsec{}\else
\refstepcounter{##1}\edef\@svsec{\csname the##1\endcsname}\fi
\@tempskipa ##5\relax
\ifdim \@tempskipa>\z@
\begingroup ##6\relax
\@hangfrom{\hskip ##3\relax Appendix \@svsec.\hskip 0.1em}
{\interlinepenalty \@M ##8\par}
\endgroup
\csname ##1mark\endcsname{##7}\addcontentsline
{toc}{##1}{\ifnum ##2>\c@secnumdepth \else
\protect\numberline{\csname the##1\endcsname}\fi
##7}\else
\def\@svsechd{##6\hskip ##3\@svsec ##8\csname ##1mark\endcsname
{##7}\addcontentsline
{toc}{##1}{\ifnum ##2>\c@secnumdepth \else
\protect\numberline{\csname the##1\endcsname}\fi
##7}}\fi
\@xsect{##5}}
}

\def\@sect#1#2#3#4#5#6[#7]#8{\ifnum #2>\c@secnumdepth
\def\@svsec{}\else
\refstepcounter{#1}\edef\@svsec{\csname the#1\endcsname\hskip 0.5em }\fi
Expand Down Expand Up @@ -348,16 +375,6 @@ are provided at \url{https://jmlr.org/papers/v#1/#6.html}.\hfill}}%
% Research Note
\long\def\researchnote#1{\noindent {\LARGE\it Research Note} #1}

% \renewcommand{\appendix}{\par
% \setcounter{section}{0}
% \setcounter{subsection}{0}
% \def\thesection{\Alph{section}}%
% \ifdefined\theHsection \def\theHsection{\Alph{section}} \fi%
% \def\section{\@ifnextchar*{\@startsiction{section}{1}{\z@}{-0.24in}{0.10in}%
% {\large\bf\raggedright}}%
% {\@startsiction{section}{1}{\z@}{-0.24in}{0.10in}
% {\large\bf\raggedright Appendix\ }}}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% PROOF, THEOREM, and FRIENDS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Expand Down
Binary file modified sample.pdf
Binary file not shown.
2 changes: 1 addition & 1 deletion sample.tex
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ \section{Introduction}
\newpage

\appendix
\section*{Appendix A.}
\section{}
\label{app:theorem}

% Note: in this sample, the section number is hard-coded in. Following
Expand Down

0 comments on commit 78d403a

Please sign in to comment.