Preparing APS manuscripts, it is required that when "Table, Figure" appear at the beginning of a sentence, they should appear in their full form, otherwise, in abbreviated form as "Tab., Fig.". Using \ref<> one needs to decide and type the referred names by hand; on the other hand, using \autoref<> , which though automatically brings the referred names, it can not, as far as I know, tell whether the names appear at the beginning of a sentence or not. So, is there an automated way to meet the above-mentioned requirement, instead of everytime inputting by hand?
asked Dec 22, 2018 at 10:37 Αλέξανδρος Ζεγγ Αλέξανδρος Ζεγγ 313 4 4 silver badges 14 14 bronze badgescleveref has \cref and \Cref . The two forms usually give different capitalisation, so \Cref is usually used at the beginning of a sentence and \cref in the middle. It should be possible to modify the involved strings so that \cref shows "Tab." and \Cref "Table".
Commented Dec 22, 2018 at 12:42As long as in \nonfrenchspacing you can fork depending on the \spacefactor :
\documentclass \usepackage% \makeatletter \newcommand\sfcodefork% \renewcommand\figureautorefname<>>> \renewcommand\tableautorefname<>>> \makeatother \begin \nonfrenchspacing \section \begin% \rule% \caption\label% \end% \begin% \begin left&right\\ \end \caption\label% \end% References at beginning of sentence: \autoref is referenced. \autoref is referennced. We can refer \autoref in the middle of a sentence. We can refer \autoref in the middle of a sentence. \end
As far as I can see this otherwise very nice solution does not give the long form at the beginning of a new paragraph. In cases like this spacefactor solutions would be too fragile for me and I would recommend using different commands (like \cref vs. \Cref or \cite vs. \Cite ).
Commented Dec 25, 2018 at 12:29Extending the example provided by Ronald Klopp I suggest implementing an \autoref -variant which does check for hmode also.
As a side-effect this provides the possibility of "fooling" the test into the "full" form by prepending \therewashmodefalse to \hmodeckeckautoref . I think you can fool the test into the short form by prepending \null to \hmodeckeckautoref .
As another side effect this might resolve some of the situations where you get the message
! Improper \spacefactor.
I advice to use this with care and to carefully check whether things turn out as desired.
\documentclass \usepackage% \makeatletter \newif\iftherewashmode\therewashmodetrue \newcommand\hmodeckeckautoref <\ifhmode\else\global\therewashmodefalse\fi\autoref>\newcommand\sfcodefork% >% \renewcommand\figureautorefname<>>> \renewcommand\tableautorefname<>>> \makeatother \begin \nonfrenchspacing \section \begin% \rule% \caption\label% \end% \begin% \begin left&right\\ \end \caption\label% \end% References at beginning of sentence: \hmodeckeckautoref is referenced. \hmodeckeckautoref is referennced. References at beginning of paragraph: \hmodeckeckautoref is referenced. \hmodeckeckautoref is referennced. We can refer \hmodeckeckautoref in the middle of a sentence. We can refer \hmodeckeckautoref in the middle of a sentence. \end