diff options
Diffstat (limited to 'macros/latex/contrib/asmejour/asmejour.cls')
-rw-r--r-- | macros/latex/contrib/asmejour/asmejour.cls | 209 |
1 files changed, 69 insertions, 140 deletions
diff --git a/macros/latex/contrib/asmejour/asmejour.cls b/macros/latex/contrib/asmejour/asmejour.cls index 62f4d90efd..095964ffc7 100644 --- a/macros/latex/contrib/asmejour/asmejour.cls +++ b/macros/latex/contrib/asmejour/asmejour.cls @@ -6,8 +6,8 @@ %% %% %% This file's version and date are: - \def\versionno{1.21} - \def\versiondate{2023/10/22\space} + \def\versionno{1.22} + \def\versiondate{2024/01/30\space} %% %% Author: John H. Lienhard V %% Department of Mechanical Engineering @@ -33,9 +33,6 @@ %% %% The title block is set by specific commands that are described in the asmejour-template.tex file. %% -%% The \section[]{} command's optional argument has been changed to better support pdf bookmarks, and -%% \section*[]{} is similarly modified. -%% %% The class defines abstract environment (with optional keywords) and a nomenclature environment. %% (LaTeX must be run twice to align the columns in the nomenclature list). %% @@ -43,7 +40,7 @@ %% %% LICENSE: %% -%% Copyright (c) 2023 John H. Lienhard +%% Copyright (c) 2024 John H. Lienhard %% %% Permission is hereby granted, free of charge, to any person obtaining a copy of this software and %% associated documentation files (the "Software"), to deal in the Software without restriction, @@ -71,7 +68,7 @@ \RequirePackage{xparse}[2020/02/25] \fi -\RequirePackage{iftex}[2019/11/07]% provides \ifpdftex, etc. +\RequirePackage{iftex}% provides \ifpdftex, etc. \RequirePackage{ifthen} %%%%%%%%%%%%% Test compatibility of older distributions %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -126,9 +123,6 @@ \PassOptionsToPackage{#1}{mathalfa}% } -%% set key [nodefaultsups] to obtain the newtx superiors font for footnotes. -\DeclareBoolOption{nodefaultsups} - %% Option to obtain line numbers [lineno] \DeclareBoolOption{lineno} @@ -161,23 +155,6 @@ }% } -%% only main= is actually needed, but keeping these three legacy commands for backward compatibility (these will disappear in 2024 or so) -\define@key{asmejour}{lang}[english]{% deprecated option - \PassOptionsToPackage{main=#1,#1}{babel}% - \PassOptionsToPackage{pdflang=en}{hyperref} - \aj@mainsettrue% - \ifthenelse{\equal{#1}{english}}{% - \relax}{% - \LogNote{Selecting #1 as the primary language}% - }% -} -\define@key{asmejour}{lang-second}[english]{% deprecated option - \PassOptionsToPackage{#1}{babel}% -} -\define@key{asmejour}{lang-third}[english]{% deprecated option - \PassOptionsToPackage{#1}{babel}% -} - %% if main language was not chosen explicitly, default to English \ifaj@mainset\relax\else \PassOptionsToPackage{main=english}{babel}% @@ -200,7 +177,7 @@ \NewDocumentCommand\@DisableKeys{>{\SplitList{;}}m}{\ProcessList{#1}{\aj@DisableOption}} \def\@KeyFamily{asmejour} -\@DisableKeys{nodefaultsups;mathalfa;barcolor;lineno;balance;nolists;govt;govtsome;contractor;main;lang;lang-second;lang-third} +\@DisableKeys{mathalfa;barcolor;lineno;balance;nolists;govt;govtsome;contractor;main} %%%%%%% PDF/A Compliance Keys %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -218,7 +195,7 @@ setkeys=\kvsetkeys, } - \ifpdftex %% pdf/a compliance has only been configured for pdflatex. Revised 2023/10/20 + \ifpdftex %% configure pdf/a compliance for pdflatex. Revised 2023/10/20 % %%% set key [pdfa] to activate pdf/a compliance (default is pdf/A-3u) \define@key{pdfaopt}{pdf-a}[true]{% @@ -250,8 +227,33 @@ %% Done with these keys, so we can now disable them \def\@KeyFamily{pdfaopt} \@DisableKeys{pdf-a;pdfapart;pdfaconformance} + + %% new pdf management in LaTeX, using \DocumentMetaData{..}, is preferred to this approach. + \ifpdftex + \ifaj@pdfaone + \pdfminorversion=4 % for pdf/a-1 need version 4, not 7 + \else + \pdfminorversion=7 % this selection is not required + \fi + \else + \ifaj@setpdfa\ClassWarningNoLine{asmejour}{pdf-a option requires pdfLaTeX engine. Under LuaLaTeX, use % + \protect\DocumentMetadata{pdfstandard=A-3b} before \protect\documentclass[..]{asmeconf}}\fi% + \ifx\directlua\undefined\else + \directlua{ + if pdf.getminorversion() \string~= 7 then + if (status.pdf_gone and status.pdf_gone > 0) + or (status.pdf_ptr and status.pdf_ptr > 0) then + tex.error("PDF version cannot be changed anymore") + else + pdf.setminorversion(7) + end + end + \fi + }% will lose some accented characters this way... better to use fontspec, if the system fonts exist. + \fi \fi + %%%%%%%%%% Further class options %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Option to omit ASME footer @@ -286,19 +288,6 @@ \PassOptionsToPackage{lining}{newtxtext}% } -%% Option not to use latex default superscripts, instead using the newtxtext superiors font [nodefaultsups] -%% This naming is inverse to the newtxtext package, which uses the superior font by default! -\ifasmejour@nodefaultsups - \ifpdftex - \else - \ClassWarningNoLine{asmejour}{The [nodefaultsups] option is only supported with pdftex. It will be ignored}% - \fi -\else - \ifpdftex - \PassOptionsToPackage{defaultsups}{newtxtext} - \fi -\fi - %% Option to hyphenate the typewriter font [hyphenate] \DeclareOption{hyphenate}{% \PassOptionsToPackage{hyphenate}{inconsolata}% @@ -385,33 +374,6 @@ \renewcommand*{\midrule}{\specialrule{0.5pt}{2pt}{3pt}} \renewcommand*{\bottomrule}{\specialrule{0.5pt}{1pt}{\doublerulesep}\specialrule{0.5pt}{0pt}{0pt}} -%%%%%%%%%%%%% PDF/A related %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%% new pdf management in LaTeX, using \DocumentMetaData{..}, is preferred to this approach. -\ifpdftex - \ifaj@pdfaone - \pdfminorversion=4 % for pdf/a-1 need version 4, not 7 - \else - \pdfminorversion=7 % this selection is not required - \fi - \RequirePackage[T1]{fontenc} - \RequirePackage[utf8]{inputenc}% for backward compatibility with pre-2018 LaTeX distributions -\else - \ifaj@setpdfa\ClassWarningNoLine{asmejour}{pdf-a option requires pdfLaTeX engine. Under LuaLaTeX, use % - \protect\DocumentMetadata{pdfstandard=A-3b} before \protect\documentclass[..]{asmeconf}}\fi% - \ifx\directlua\undefined\else - \directlua{ - if pdf.getminorversion() \string~= 7 then - if (status.pdf_gone and status.pdf_gone > 0) - or (status.pdf_ptr and status.pdf_ptr > 0) then - tex.error("PDF version cannot be changed anymore") - else - pdf.setminorversion(7) - end - end - \fi - }% will lose some accented characters this way... better to use fontspec, if the system fonts exist. -\fi - %%%%%%%%%%%%% Font related %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -419,6 +381,8 @@ \RequirePackage[]{babel} \ifpdftex + \RequirePackage[T1]{fontenc} + \RequirePackage[utf8]{inputenc}% for backward compatibility with pre-2018 LaTeX distributions \RequirePackage[helvratio=0.91]{newtxtext}% add this scaling 2022/06/26 \RequirePackage[varl,varqu]{inconsolata}% sans typewriter font; restored varl, varqu 2020/08/10 \RequirePackage[]{newtxmath} @@ -474,16 +438,6 @@ RawFeature = {+ss01,\ssztwo,+ss03}, ] \fi - -%% override \textsu if using default superiors (allow for undefined \textsu in fontspec). Revised 2023/10/21 -\providecommand\NewCommandCopy{\let} % for pre-2020/10 LaTeX distributions -\providecommand\RenewCommandCopy{\let} - -\ifx\textsu\undefined\NewCommandCopy\textsu\textsuperscript\fi -\ifasmejour@nodefaultsups\else - \RenewCommandCopy\textsu\textsuperscript -\fi -%% \RequirePackage[]{mathalfa}% load optional fonts for Calligraphy, Script, etc. @@ -649,21 +603,25 @@ \ifasmejour@balance \ClassWarningNoLine{asmejour}{Package lineno loaded, so final column balancing will be disabled}% \fi - %%% Allow line numbering in AMS math environments. - %%% postdisplaypenalty adjusted to avoid extra line number at end, see discussion here: https://tex.stackexchange.com/a/461192/ - %%% multline has some problem that puts an extra line number above it. - %%% Requires xparse and etoolbox - \NewDocumentCommand{\aj@losepostpenalty}{}{\patchcmd{\linenomathWithnumbers}{\advance\postdisplaypenalty\linenopenalty}{}{}{}}% -% - \NewDocumentCommand{\aj@FixAMSMath}{m}{% - \AtBeginEnvironment{#1}{\aj@losepostpenalty\linenomath}% - \AtEndEnvironment{#1}{\endlinenomath}% - \AtBeginEnvironment{#1*}{\aj@losepostpenalty\linenomath}% - \AtEndEnvironment{#1*}{\endlinenomath}% - }% -% - \NewDocumentCommand{\aj@FixAll}{>{\SplitList{;}}m}{\ProcessList{#1}{\aj@FixAMSMath}}% - \aj@FixAll{align;alignat;gather;flalign;multline}% + %%% Patch to allow line numbering in AMS math environments. + %%% This patch is for lineno versions earlier than v5.2 [2023/05/19]. As of mid-2023, the lineno package + %%% has been corrected to account for the AMS math environments. Retaining temporarily for backward compatibility. + %%% postdisplaypenalty adjusted to avoid extra line number at end, see: https://tex.stackexchange.com/a/461192/ + %%% multline has some additional problem that puts an extra line number above it. + \IfPackageAtLeastTF{lineno}{2023/05/19}{\relax}{ + \NewDocumentCommand{\ac@losepostpenalty}{}{\patchcmd{\linenomathWithnumbers}{\advance\postdisplaypenalty\linenopenalty}{}{}{}} + % + \NewDocumentCommand{\ac@FixAMSMath}{m}{% + \AtBeginEnvironment{#1}{\ac@losepostpenalty\linenomath}% + \AtEndEnvironment{#1}{\endlinenomath}% + \AtBeginEnvironment{#1*}{\ac@losepostpenalty\linenomath}% + \AtEndEnvironment{#1*}{\endlinenomath}% + } + % + \NewDocumentCommand{\ac@FixAll}{>{\SplitList{;}}m}{\ProcessList{#1}{\ac@FixAMSMath}} + % + \ac@FixAll{align;alignat;gather;flalign;multline} + } % \else \ProvideDocumentEnvironment{linenomath}{}{}{}% @@ -871,7 +829,6 @@ \RequirePackage[psdextra]{hyperref} % recent kernel transition suggests providing most hyperref options via \hypersetup, % but setting psdextra here (for additional math support in bookmarks) 2021/12/23 \hypersetup{% - unicode, % Unicode encoded PDF strings, default as of hyperref v7.0 pdfborder={0 0 0},% bookmarksnumbered=true,% bookmarksopen=true,% @@ -948,25 +905,6 @@ \def\footnote#1{}% } -%%% Create an optional argument for unnumbered sections and set pdf bookmark (thru \addcontentsline). -%%% The optional argument will manually set the pdf bookmark for that section; can be used to avoid hyperref -%%% errors when macros are in section titles. -%%% There should not be errors for $$, \cite, \ref, \label, \footnote, or \bm with current construction. -\let\svsection\section -\RenewDocumentCommand{\section}{s o m}{% - \IfBooleanTF {#1} - {\svsection*{#3}\phantomsection% - {\IfNoValueTF {#2} - {\addcontentsline{toc}{section}{#3}} - {\addcontentsline{toc}{section}{#2}}% remove trailing space 2020/02/28 - }% - } - {\IfNoValueTF {#2} - {\svsection{#3}} - {\svsection[#2]{#3}}% - }% -} - %%%%%%%%%%%%% Define some section and other names for special environments %%%%%%% @@ -1047,19 +985,7 @@ ]% }% \fi -%\ifaj@lists -% \AtEndDocument{% -% \clearpage -% \twocolumn[% -% \begin{@twocolumnfalse} -% \listoffigures -% \listoftables -% \end{@twocolumnfalse} -% ]% -% }% -%\else -% \LogNote{Omitting lists of figures and tables}% -%\fi + %%%%%%%%%%%%%%%% Author/Title/Abstract block %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -1152,13 +1078,9 @@ %% Flag for corresponding author (only one expected, although this code supports more than one) \newif\ifaj@CA\aj@CAfalse -\newcommand{\CAemail}[1]{\gdef\@CAemail{#1}}% legacy code, drop eventually - %% ASME prefers email to be in address block, not CA footnote; removed option 2021/01/30 \NewDocumentCommand{\CorrespondingAuthor}{}{% \global\aj@CAtrue% - \gdef\@CAsep{\relax}% legacy code, drop eventually - \gdef\@CAemail{\relax}% legacy code, drop eventually \def\@makefnmark{\hbox{\@textsuperscript{\sffamily\@thefnmark}}}% \footnotemark% \addtocounter{footnote}{-1}% in case of more than one CA @@ -1180,9 +1102,9 @@ ] \ifaj@CA \addtocounter{footnote}{1} - \footnotetext{\CAwords\@CAsep \@CAemail}% includes legacy code, will remove \@CA commands eventually + \footnotetext{\CAwords} \fi - \ifaj@Date\revfootnote{\@Date}\else\relax\fi + \DateFootnote \ifasmejour@contractor\revfootnote{The United States Government retains, and by accepting the article for publication, the publisher acknowledges that the United States Government retains, a non-exclusive, paid-up, irrevocable, worldwide license to publish or reproduce the published form of this work, or allow others to do so, for United States Government purposes.}% \fi \ifasmejour@govt\revfootnote{This material is declared a work of the U.S. Government and is not subject to copyright protection in the United States. Approved for public release; distribution is unlimited.}% @@ -1202,14 +1124,21 @@ %% Thanks to DPC for the suggestion of \gdef\tmp{... %% Put date as an unnumbered footnote at bottom of first column -\newif\ifaj@Date\aj@Datetrue% If true, print a date. - \ExplSyntaxOn -\RenewDocumentCommand{\date}{m} - {% - \tl_if_empty:nTF {#1}{\global\aj@Datefalse}{\gdef\@Date{#1}}% - } -\providecommand\@Date{\today} + \bool_new:N \g__asmejour_date_bool + \tl_new:N \g__asmejour_date_tl + \tl_new:N \DateFootnote + \bool_gset_true:N \g__asmejour_date_bool + \tl_gset:Nn \g__asmejour_date_tl { \today } + \tl_gset:Nn \DateFootnote { + \if_bool:N \g__asmejour_date_bool \revfootnote{\g__asmejour_date_tl} \else: \fi: + } + \RenewDocumentCommand{\date}{m} + { + \tl_if_empty:nTF {#1} + { \bool_gset_false:N \g__asmejour_date_bool } + { \tl_gset:Nn \g__asmejour_date_tl { #1 } } + } \ExplSyntaxOff \RenewDocumentCommand{\thanks}{m}{\relax}%% disabling this standard command, as it is inconsistent with this format |