TransWikia.com

How to print accents in verbatim?

TeX - LaTeX Asked by Gabriele on December 24, 2020

I have this code:

begin{verbatim}
  Serial.begin(9600);    // definisce velocit`a porta seriale
  bt.begin(9600);    // inizializzera' comuinicazione Bluetooth
  display.setBrightness(0x0f);    // definisce inizializzera'à del display
end{verbatim}

I want to print accents but it’s showed like:

  1. velocit`a
  2. inizializzera’
  3. inizializzer ̃A ̈

How can I solve?

One Answer

enter image description here

documentclass{article}

begin{document}

begin{verbatim}
Serial.begin(9600);    // definisce la velocità della porta seriale
bt.begin(9600);    // inizializzerà la comunicazione Bluetooth
display.setBrightness(0x0f);   // definisce àèéìòùÀÈÉÌÒÙ 
end{verbatim}

end{document}

Don't indent the code in verbatim.

If you don't get proper accented characters, it's very likely that your file is not UTF-8 encoded. Either convert all files to this encoding or load

usepackage[<option>]{inputenc}

with the proper encoding option.

For quite a long time, various input encodings have been supported in LaTeX making unnecessary to resort to the classical input for accents (at least for the most common ones).

Answered by egreg on December 24, 2020

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