I'm writing a LaTeX document in which I have to write many "|" characters which are not part of a mathematical formula.

Simply writing test | test gives me something like (after compilation) : test - test and I don't want the line to become horizontal.

What I've tried so far:

  • test \| test (this does not even work at compilation)

  • \usepackage{amsmath}

    test $$ \mid $$ test (this quite works but implies line breaks... Whatsmore I don't need to write mathematical formulas)

  • test \char124 test (this also gives me test - test !!)

I've well written \usepackage[utf8]{inputenc} at the beginning of my document.

What I use for compilation: This is pdfTeX, Version 3.1415926-1.40.10 (TeX Live 2009/Debian)

I'm surprised that I could not found any topic nor tutorial that tells how to write pipes correctly... Does someone have an idea about how to proceed? Maybe I'm doing something bad? Thank you in advance!

  • 3
    You might want to try \textbar
    – Fato39
    Apr 13 '15 at 8:01
  • 2
    Or you could use \usepackage[T1]{fontenc}. T1 has a glyph for |. Apr 13 '15 at 8:13
  • 1
    See also: tex.stackexchange.com/questions/1774/…
    – jonalv
    Apr 13 '15 at 8:16
  • Thank you for your interesting replies. jonalv, I'm sorry (and surprised) for not having found this helpful topic earlier !
    – Totoro
    Apr 13 '15 at 8:28

Browse other questions tagged or ask your own question.