TransWikia.com

Add newlines to label-displays in `showkeys` package

TeX - LaTeX Asked by rshkadhttkqwkqknhd on February 20, 2021

I’m using the package showkeys to display labels in my LaTeX file. All my labels are of the form type:name:details. Since my labels tend to get very long (lemma:the_name_of_the_lemma:...) I’d like to redefine the showkeyslabelformat command to break the line at every :.

How is this possible? Is there a way to replace the : by newlines?

2 Answers

Ooooh, I was just about to answer and say this was hard (because catcodes), when David replied with a solution using hyphenchar. Cunning!

So I'll simply chip in by remarking that the exact same command works in showlabels, with only a change of name.

renewcommand*showlabelsetlabel[1]{%
  fbox{parbox[t]{2cm}{%
    raggedrightnormalfontsmallttfamily
    hyphencharfont=`:
    #1}}}

Answered by Norman Gray on February 20, 2021

showkeys uses the following command to typeset the label

providecommand*showkeyslabelformat[1]{%
  fbox{normalfontsmallttfamily#1}}

so you can redefine that in any way you want,

enter image description here

documentclass{article}

usepackage{showkeys}

renewcommand*showkeyslabelformat[1]{%
  fbox{parbox[t]{2cm}{raggedrightnormalfontsmallttfamilyhyphencharfont=`:#1}}}

begin{document}

section{zzzlabel{section:with:a:long:label}}
begin{equation}
  label{equation:with:an:even:longer:label}
  1=0
end{equation}
end{document}

Answered by David Carlisle on February 20, 2021

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