0

Why LaTex return error when I write _ in normal mode (not math mode). Why we have decided to return error, we couldn't just print _. I mean if we write _ in a normal mode it print _ and in normal mode it will have another definition.

What are the reasons for choosing that decision?

Hunsu
  • 1,721
  • 1
  • 14
  • 29
  • 2
    The same goes for other active characters as well, like $, or ^, or &, or ~, ... are you okay with these? – Werner Jul 02 '14 at 19:34
  • for $ and ~ yes. – Hunsu Jul 02 '14 at 19:36
  • 4
    Then the answer is simple (like with all the others): _ has special meaning and should be used with care outside of these special contexts and should be escaped outside of these contexts (see Escape character in LaTeX). – Werner Jul 02 '14 at 19:39
  • ...as for "What [is] the reason for [making this] decision?" Well, that's a design decision that implies what follows as being a subscript. – Werner Jul 02 '14 at 19:40
  • For _ we can't say in normal mode we will print _, in math mode we give him another meaning. for $, ~, % we can't do that as it has already a function in normal mode. – Hunsu Jul 02 '14 at 19:45
  • 2
    If you're just interested in printing a _ see Underscores in words (text). – Werner Jul 02 '14 at 19:51
  • 2
    You could also use the underscore package. But read its documentation if you don't want to run into problem with underscores in file names and label etc. – Ulrike Fischer Jul 02 '14 at 20:41
  • 3
    It doesn't matter too much but I don't see why this has been closed as duplicate (and have voted to reopen) the other question is about how to get a text underscore which this question does not ask, it is a question about a design decision in the language (so admittedly not really answerable except by Knuth who could say what was in his mind at the time) – David Carlisle Jul 02 '14 at 22:10
  • @Werner No I'm not interesting in printing _ (I know how to do that but thanks for the link I have learned others things). Like David Carlisle said in his comment my question is about design decision. I though that there were reasons for choosing that decision. – Hunsu Jul 03 '14 at 06:17

1 Answers1

7

It is a tex primitive behaviour not something defined in LaTeX. It is consistent with most other primitive math mode syntax, that it generates an error in text mode. \alpha for example.

David Carlisle
  • 757,742