1

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

  • Related/possible starting point: https://tex.stackexchange.com/questions/27258/how-do-i-write-underline-text-but-with-a-dotted-line and https://superuser.com/questions/1136672/double-underline-one-of-them-dashed. – Marijn Jan 15 '21 at 14:49

2 Answers2

3

For example using \halign and \leaders primitives:

\def\underlined#1{\vtop{\tt\halign{##\cr#1\cr\leaders\hbox{=}\hfill\cr}}}

Text: \underlined{Odwolanie upowaznienia}

\bye

wipet
  • 74,238
1

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}

\newcommand\setex[1] {#1 \ \StrLen{#1}[\len]\multido{}{\len}{=}}

\titleformat{\section} {\normalfont\filcenter}{}{0pt}{\setex{#1}}

\begin{document}

\section{Test}

Lorem ipsum...

\end{document}

enter image description here

This will not work for really long section titles.

DG'
  • 21,727