JACoW-org / JACoW_Templates

10 stars 10 forks source link

Adopt clerever package #1

Open matsievskiysv opened 3 years ago

matsievskiysv commented 3 years ago

This is a JACoW template section dedicated to the use of references:

Figure captions are formatted as shown in Figs.~ \ref{fig:paper_layout} and \ref{fig:jacow_team}, while table captions take the form of a heading, with initial letters of principle words, capitalized, and without a period at the end (see Tables~ \ref{tab:margins} and~ \ref{tab:styles}). Any reference to the contents of the table should be made from the body of the paper rather than from within the table caption itself.

Single-line captions are centred in the column, while captions that span more than one line should be justified. The \LaTeX{} template uses the ‘booktabs’ package to format tables.

When referring to a figure from within the text, the convention is to use the abbreviated form [e.\,g., Fig.~ 1] \emph{unless} the reference is at the start of the sentence, in which case “Figure” is written in full. Reference to a table, however, is never abbreviated [e.\,g., Table~ 1].

If a displayed equation needs a number (i.\,e., it will be referenced), place it in parentheses, and flush with the right margin of the column. The equation itself should be indented and centred, as far as is possible: \begin{equation}\label{eq:label} CB=\frac{q^3}{3\epsilon{0} mc}=\SI{3.54}{\micro eV/T} \end{equation}

When referencing a numbered equation, use the word “Equation” at the start of a sentence, and the abbreviated form, “Eq.”, if in the text. The equation number is placed in parentheses [e.\,g., Eq.~\eqref{eq:label}], which can be achieved in \LaTeX{} using \verb|\eqref{eq:label}|.

It's has a lot of rules which may be hard to follow. IMHO it would be better to use cleveref package and to enforce reference style in template itself. With cleveref all the references will be done by using either \cref (in the middle of the sentence) or \Cref (in the beginning of the sentence) commands. Customization of the reference style is quite flexible. Here's the setup example from https://github.com/AndreyAkinshin/Russian-Phd-LaTeX-Dissertation-Template/blob/master/common/styles.tex

\crefformat{equation}{(#2#1#3)} % одиночная ссылка с приставкой
\labelcrefformat{equation}{(#2#1#3)} % одиночная ссылка без приставки
\crefrangeformat{equation}{(#3#1#4) \cyrdash~(#5#2#6)} % диапазон ссылок с приставкой
\labelcrefrangeformat{equation}{(#3#1#4) \cyrdash~(#5#2#6)} % диапазон ссылок без приставки
\crefmultiformat{equation}{(#2#1#3)}{ и~(#2#1#3)}{, (#2#1#3)}{ и~(#2#1#3)} % перечисление ссылок с приставкой
\labelcrefmultiformat{equation}{(#2#1#3)}{ и~(#2#1#3)}{, (#2#1#3)}{ и~(#2#1#3)} % перечисление без приставки

If you decide to use cleveref, you might want to include a following code snippet to allow using spaces between references in \cref as described in https://tex.stackexchange.com/a/340502/104425.

\usepackage{kvsetkeys}
\makeatletter
\let\org@@cref\@cref
\renewcommand*{\@cref}[2]{%
    \edef\process@me{%
        \noexpand\org@@cref{#1}{\zap@space#2 \@empty}%
    }\process@me
}
\makeatother
matsievskiysv commented 3 years ago

Configuration should look something like this:

% Equation
\crefformat{equation}{Eq.~(#2#1#3)} % single reference with name
\Crefformat{equation}{Equation~(#2#1#3)} % single reference with name
\labelcrefformat{equation}{(#2#1#3)} % single reference without name
\crefrangeformat{equation}{Eqs.~(#3#1#4) --~(#5#2#6)} % reference range with name
\Crefrangeformat{equation}{Equations~(#3#1#4) --~(#5#2#6)} % reference range with name
\labelcrefrangeformat{equation}{(#3#1#4) --~(#5#2#6)} % reference range without name
\crefmultiformat{equation}{Eqs.~(#2#1#3)}{ and~(#2#1#3)}{, (#2#1#3)}{ and~(#2#1#3)} % reference list with name
\Crefmultiformat{equation}{Equations~(#2#1#3)}{ and~(#2#1#3)}{, (#2#1#3)}{ and~(#2#1#3)} % reference list with name
\labelcrefmultiformat{equation}{(#2#1#3)}{ and~(#2#1#3)}{, (#2#1#3)}{ and~(#2#1#3)} % reference list without name
% Figure
\crefformat{figure}{Fig.~#2#1#3} % single reference with name
\Crefformat{figure}{Figure~#2#1#3} % single reference with name
\labelcrefformat{figure}{#2#1#3} % single reference without name
\crefrangeformat{figure}{Fig.~#3#1#4 --~#5#2#6} % reference range with name
\Crefrangeformat{figure}{Figures~#3#1#4 --~#5#2#6} % reference range with name
\labelcrefrangeformat{figure}{#3#1#4 --~#5#2#6} % reference range without name
\crefmultiformat{figure}{Fig.~#2#1#3}{ and~#2#1#3}{, #2#1#3}{ and~#2#1#3} % reference list with name
\Crefmultiformat{figure}{Figures~#2#1#3}{ and~#2#1#3}{, #2#1#3}{ and~#2#1#3} % reference list with name
\labelcrefmultiformat{figure}{#2#1#3}{ and~#2#1#3}{, #2#1#3}{ and~#2#1#3} % reference list without name
% Table
\crefformat{table}{Table~#2#1#3} % single reference with name
\Crefformat{table}{Table~#2#1#3} % single reference with name
\labelcrefformat{table}{#2#1#3} % single reference without name
\crefrangeformat{table}{Table~#3#1#4 --~#5#2#6} % reference range with name
\Crefrangeformat{table}{Table~#3#1#4 --~#5#2#6} % reference range with name
\labelcrefrangeformat{table}{#3#1#4 --~#5#2#6} % reference range without name
\crefmultiformat{table}{Tables~#2#1#3}{ and~#2#1#3}{, #2#1#3}{ and~#2#1#3} % reference list with name
\Crefmultiformat{table}{Tables~#2#1#3}{ and~#2#1#3}{, #2#1#3}{ and~#2#1#3} % reference list with name
\labelcrefmultiformat{table}{#2#1#3}{ and~#2#1#3}{, #2#1#3}{ and~#2#1#3} % reference list without name
vrws commented 2 years ago

Dear @matsievskiysv sorry for the delayed response, for the next rework I will take a closer look into cleveref and your suggestions. Thank you

vrws commented 1 year ago

Hi Mxwell,

jacow class does not have numbered sections, therefore \ref already delivers nothing. You will see only Sec , ?? Sec , ?? Eqn 1, eq. (1)

On 04/09/2023 19:42, Mxwell wrote:

Also, the JACoW template seems to suffer the same issue as AASJournals/AASTeX60#69 https://github.com/AASJournals/AASTeX60/issues/69

— Reply to this email directly, view it on GitHub https://github.com/JACoW-org/JACoW_Templates/issues/1#issuecomment-1705573035, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADIDWMPHE6GMDRVXKW43TD3XYYHGZANCNFSM5EET3HGA. You are receiving this because you commented.Message ID: @.***>

mxwell-dev commented 1 year ago

Hi @vrws , yes, I had that realization shortly after I posted my comment and deleted it, I guess you still got a notification email.