7

I'm bothered about the language format of TeX.

I mean I want to know why the CR is converted into a space and % must be at the end of a line to avoid the matter. To make matters worse, a blank line means the end of a paragraph.

I know these functions are useful in most cases. But, in macros or something like that, they bother me; I guess many package writers too.

My questions are "Can I nullify these functions using some macros (such as \catcode)?" and "Can I make TeX completely free-form?"

6
  • I'm not sure what you mean by 'completely free-form'.
    – Joseph Wright
    Commented Sep 29, 2013 at 9:16
  • Excuse me for my less explanation. I mean free-form computer language. Commented Sep 29, 2013 at 9:45
  • 6
    Could you give a link to something explaining what that is? I'm not a CS person, so I've no idea what a 'free-form computer language' means (or what it would mean specifically for TeX). When I looked at en.wikipedia.org/wiki/Free-form_language, the description seemed to be about indentation, which TeX already ignores.
    – Joseph Wright
    Commented Sep 29, 2013 at 9:51
  • 1
    TeX's ability to change \catcode's might be tempting and powerful. However, it hurts much more than it seems. In general, a good practice is to avoid it whenever you can and limit its application to the smallest possible scope and to the most specialized use-cases (like verbatim printing). It almost always breaks other packages. Commented Sep 29, 2013 at 21:20
  • Mr.Wright, I read your link. But it also says "frequently ends of lines are insignificant," in the second line. Isn't it about line-breaks? In fact, I am a Japanese and Japanese Wikipedia (ja.wikipedia.org/wiki/…) says "空白や改行文字," which means spaces and line-breaks. So, now I don't know which is right. If I made some mistakes, I apologize you all. Commented Oct 3, 2013 at 14:04

1 Answer 1

22

TeX is a typesetting system, and so the standard set up is biased toward document 'text': the normal conventions work well for this at the cost of slightly more work for 'programming'. (Other parts of TeX's programming model are more 'work' in this regard, but that is a separate issue.)

It certainly is possible to modify the standard behaviour. For example, in the expl3 language used for LaTeX3 programming (a 'work in progress'), the set up is based on something similar to

\catcode`\^^I = 9 %
\catcode`\  = 9 %
\catcode`\^^M = 10 %
\endlinechar = `\  %
\relax
Hello world

more text
\bye

which you could modify to simply

\catcode`\^^M = 10 %
\endlinechar = `\ %
\relax
Hello world

more text
\bye

if you only want the change in end-of-line behaviour. Note that this then requires you to explicitly add in paragraphs using \par.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .