TransWikia.com

Underline text with === (SETEX style)

TeX - LaTeX Asked by Marek Kowalczyk on March 28, 2021

I’m trying to recreate the typewriter look.

How to make underline{sometext} work like SETEX-style section marker?

The intended use is with monospaced/typewriter fonts for lines with plenty of space beneath them (like section headings).

Illustration of desired effect below.

Underline text SETEX style

2 Answers

For example using halign and leaders primitives:

defunderlined#1{vtop{tthalign{##cr#1crleadershbox{=}hfillcr}}}

Text: underlined{Odwolanie upowaznienia}

bye

Correct answer by wipet on March 28, 2021

The real typewriter look can be achieved by setting a number of = below the title. Here is an example with section:

documentclass{article}

usepackage{xstring}
usepackage{multido}
usepackage[explicit]{titlesec}
usepackage[default]{sourcecodepro}

newcommandsetex[1]
  {#1  StrLen{#1}[len]multido{}{len}{=}}

titleformat{section}
  {normalfontfilcenter}{}{0pt}{setex{#1}}

begin{document}

section{Test}

Lorem ipsum...

end{document}

enter image description here

This will not work for really long section titles.

Answered by DG' on March 28, 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