hyperref
hyperref copied to clipboard
Capitalize first letter of sentence with autoref
For instance, given
\section{bla}\label{sec:bla}
...
\autoref{sec:bla} is where we discussed bla.
We'll obtain something along the lines of
2.1 bla
...
section 2.1 is where we discussed bla.
It would be useful to have something like \Cref from the cleveref package to indicate something is at the start of a sentence. I currently use something along these lines:
\newcommand{\Autoref}[1]{%
\begingroup%
\def\chapterautorefname{Chapter}%
\def\sectionautorefname{Section}%
\def\subsectionautorefname{Subsection}%
\autoref{#1}%
\endgroup%
}
Seconded, although I feel we should include a few other levels in the definition:
\def\chapterautorefname{Chapter}%
\def\sectionautorefname{Section}%
\def\subsectionautorefname{Subsection}%
\def\subsubsectionautorefname{Subsubsection}%
\def\paragraphautorefname{Paragraph}%
\def\tableautorefname{Table}%
\def\equationautorefname{Equation}%
Of course, this needs to cover all of the ...autorefnames.
Sorry but imho the whole autoref stuff doesn't belong into hyperref. hyperref shouldn't try to keep track of the afrikaans name of equations and bother how to format references. This should be done by package for language support and by packages for references. So I don't think that we should extend hyperref to add more names and commands here.
\autoref is a command from the hyperref package, If it is broken out into an independent reference library your comment would make sense, although again the hyperref package would then need to be updated to reflect this new functionality - just resulting with more work on both ends.
Considering the command preparses latex input anyway, we can relatively easily implement an optional star argument (\autoref*{fig:hello}) which capitalises the first letter in the hyperlinked reference - if required.
I know that \autoref is a command from hyperref. Also capitalising the first letter is not completly trivial as soon as languages with accents and similar are involved. But the question is not if is easy or not to implement it: hyperref is a package about hyperlinks. It shouldn't contain hundreds of line of code to manage list of names for various languages. It is already long enough.
A split wouldn't require much update in hyperref. autoref basically extracts the counter name from the label \newlabel{eq}{{1}{1}{}{equation.0.1}{}} and uses it. Everyone can do this. hyperref would then only have to remove the duplicate parts.