2

I want to reference sections in the form '§1'. I use hyperref.sty, and I have changed the sectionautorefname: \renewcommand{\sectionautorefname}{\S}. This prints '§ 1', with a space. Can I remove the space?

\documentclass{article}
\usepackage{hyperref}
\renewcommand{\sectionautorefname}{\S}
\begin{document}
\section{section}
\label{section}
\autoref{section}
\end{document}
2

You could \kern it to the left.

\documentclass{article}
\usepackage{hyperref}
\renewcommand{\sectionautorefname}{\S\kern-4pt}
\begin{document}
\section{section}
\label{section}
\autoref{section}
\end{document}

enter image description here

Perhaps a better way is to gobble the space:

\makeatletter
\renewcommand{\sectionautorefname}{\S\@gobble}
\makeatother

though I don't know if this latter approach has any unintended pitfalls.

2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.