2017-03-14

In a document comparing Indo European languages, I try to define some shorthand notations for marking text in different languages, and hyphenating them each correctly. Being a programmer new to LaTeX, I also use cases like this to learn the LaTeX language.

By reducing the code to a minimal working example, the meaning may have been lost. What I try to do, is establish shorthand notations for all the languages that I can pass to babel's \foreignlanguage as argument, and encapsulate that into a few different commands that mark up grammatic roles of words in each of these languages.

But this short code still shows the problem well. When I redefine babel's \foreignlanguage command to do something visible with it's arguments, this works:

The result of this is fine:



At least this proves that my definition \newcommand{\said} has a working syntax, for a \foreignlanguage command that takes 2 arguments. Now if I comment out the line redefining \renewcommand{\foreignlanguage}, so that the original babel definition \foreignlanguage{<language>}{<text>} comes into force again, then the code stops working. I get a loop of these error messages

Use of \said doesn't match its definition. \said{Niets}

Argument of \@firstoftwo has an extra }. \said{Niets}

Paragraph ended before \@firstoftwo was complete. \said{Niets}

The log expands on this:

If I comment out the line with

I get the same error messages for the line with

Probably the stack of errors got full before getting to that second line.

What is the difference between babel's \foreignlanguage and my dummy redefinition, that makes the code not work for babel's?

Show more