TransWikia.com

Highlight (¿) in text mode

TeX - LaTeX Asked on October 5, 2021

I need a way to ease the spotting of < and > used in text-mode (I get ¡ and ¿ in the .pdf file).

Is there a way to highlight these symbols in the .pdf file? I mean ¡ and ¿.

(I’m not allowed to use usepackage[T1]{fontenc}).

One Answer

I see no other way than to make < and > active so they print something evident when used in text mode and the standard symbols in math mode. Of course any < or > comparison in the context of ifnum (or derived) that are not buried in macros defined in the preamble will die horribly.

documentclass{article}

AtBeginDocument{%
  begingrouplccode`~=`< lowercase{endgroupprotecteddef~}{ifmmode<else OUCH!`fi}%
  begingrouplccode`~=`> lowercase{endgroupprotecteddef~}{ifmmode>else OUCH?`fi}%
  catcode`>=active
  catcode`<=active
}

begin{document}

$a<b$ $a>b$

<>

$left<xright>$

end{document}

enter image description here

Correct answer by egreg on October 5, 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