## LaTeX forum ⇒ TeXworks ⇒ mistakes on typing |

Information and discussion about TeXworks, an integrated LaTeX environment for several platforms
yaozhao
Posts: 57
Joined: Sat Oct 27, 2018 10:38 pm

### mistakes on typing |

The question is simple. I want to type |left|left|right|.

But the outcome after clicking on typesetting button is shown: —left— left —right

It's dash, rather than my desired |.

Many thanks in advance!

LaTeXguide.org • LaTeX-Cookbook.net

Stefan Kottwitz
Posts: 9878
Joined: Mon Mar 10, 2008 9:44 pm

### mistakes on typing |

The | is one of the special symbols that are not supported in the old default original font encoding of LaTeX. You can switch to a modern font encoding this way, then it works:

\usepackage[T1]{fontenc}

Stefan

yaozhao
Posts: 57
Joined: Sat Oct 27, 2018 10:38 pm

### mistakes on typing |

Great, that works! Thank you so much!

Could you explain what's the distinguishable function of this package [T1]{fontenc}?

Johannes_B
Site Moderator
Posts: 4183
Joined: Thu Nov 01, 2012 4:08 pm

### mistakes on typing |

By the way, i can recommend a great read: LaTeX for complete novices.
It is a free introduction written by Nicola Talbot that gets you familiar with all the basics you need.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.

Stefan Kottwitz
Posts: 9878
Joined: Mon Mar 10, 2008 9:44 pm

### mistakes on typing |

The symbols in a font (glyphs) have to be used with an internal numbering. So we have tables with numbers for fonts. Assigning numbers to font elements is called encoding. It's similar to ASCII code but not just for standard characters but for font symbols, that can be thousands. The default encoding in LaTeX just supports fewer symbols, such as normal characters/letters. Letters with accents are then made as combination of latter and an accent symbol over it. Modern encoding, such as the so called T1 encoding, have big font tables with a lot of symbols including real accented letters and many more symbols. That's what this line above does, it activates that.

Using this, I also recommend to add

\usepackage{lmodern}

This changes the default font (Computer Modern) to Latin Modern that is very similar but with proper T1 encoding support. I would say it's better to use it.

Stefan