TransWikia.com

inline tcolorbox with rotated title

TeX - LaTeX Asked by Etsaf on March 1, 2021

I’m desperately searching for a way to recreate those really nice inline-tcboxes they used in tcolorbox manual for, as an example, emphasizing libraries’ names.

enter image description here

I found some topics about left-sided + rotated titles but I can’t find a way to adapt the aswers to this specific goal.

Does anyone have a clue ?

One Answer

Copied from tcolorbox's documentation:

documentclass{article}

usepackage{lipsum}
usepackage[skins]{tcolorbox}
usepackage{hyperref}

newtcbox{mylib}{enhanced,nobeforeafter,tcbox raise base,boxrule=0.4pt,top=0mm,bottom=0mm,
  right=0mm,left=4mm,arc=1pt,boxsep=2pt,before upper={vphantom{dlg}},
  colframe=green!50!black,coltext=green!25!black,colback=green!10!white,
  overlay={begin{tcbclipinterior}fill[green!75!blue!50!white] (frame.south west)
    rectangle node[text=white,font=sffamilybfseriestiny,rotate=90] {LIB} ([xshift=4mm]frame.north west);end{tcbclipinterior}}}

MakeRobustmylib

ifdefinedpdfstringdefDisableCommands
  pdfstringdefDisableCommands{defmylib#1{'#1'}}
fi

begin{document}

Library mylib{lipsum}:

lipsum[1]

end{document}

enter image description here

The line MakeRobustmylib makes mylib robust, so that you can use it in the argument of commands like section or caption. The line pdfstringdefDisableCommands (used only if hyperref is loaded) makes mylib produce a sensible PDF outline entry when used in section. If you then do section{Library mylib{lipsum}} it won't break (because of MakeRobust), and the PDF outline will say Library 'lipsum'.

Correct answer by Phelype Oleinik on March 1, 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