Skip to content

\NR@strip@period (done by nameref package) does not work correctly

...since we add \relax at the end of the optional \caption parameter.

Consequence: \caption{This is a test.}\label{test}..\nameref{test} expands to This is a test.\relax instead of This is a test (without period).

Therefore we need a different method to distinguish \caption{} from \caption[]{}.

\documentclass{article}
\usepackage{nameref}
%\usepackage{caption}

\begin{document}

\begin{figure}
\caption{This is a test.}
\label{test}
\end{figure}

\nameref{test} % With caption package this results in "This is a test." but without caption package this results in "This is a test" (without period).

\end{document}
Edited by Axel Sommerfeldt