TransWikia.com

autoref without space

TeX - LaTeX Asked by twsh on November 29, 2020

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}

One Answer

You could kern it to the left.

documentclass{article}
usepackage{hyperref}
renewcommand{sectionautorefname}{Skern-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.

Correct answer by Steven B. Segletes on November 29, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP