3

I want to teach a child reading German. For that purpose I want to produce texts in which the different syllables are marked in two different colours, a common technique to facilitate reading for slow learners.

I just couldn't come up with a simple (or even any) solution. Does anyone have an idea?

5
  • 1
    soul has a syllable analyser, and there is showhyphens (a lua package). Commented Mar 13, 2015 at 23:22
  • 3
    A picture of what you want may help us. Will there be any particular scheme determining the colors? E.g., will all prepositions compounded with verbs get one color, and all declensional endings another?
    – Thérèse
    Commented Mar 13, 2015 at 23:24
  • 6
    Warning: hyphenation is only a subset of syllabification. The objectives of a hyphenation algorithm should be (1) to find enough (but not necessarily all) correct hyphenation points for typesetting purposes and (2) to avoid all plausible but wrong hyphenations, like wee-knights or the-rapists in English. For example TeX doesn't hyphenate "manuscript" in English, though it clearly has 3 syllables.
    – alephzero
    Commented Mar 14, 2015 at 3:03
  • Thank you for your help so far. It is supposed to look like [this] (abc-der-tiere.de/fileadmin/abc-der-tiere/newsletter/NLSIL/…) in the end.
    – Benjamin
    Commented Mar 14, 2015 at 13:04
  • There are several answers to your question, oddly enough, on tex.stackexchange.com/questions/233085/basics-of-scanning Commented Mar 16, 2015 at 13:59

1 Answer 1

4

As mentioned by @UlrikeFischer in a comment, you may want to look into using the showhyphens package, which inserts little red markers at every hyphenation point known to LaTeX. (To handle German hyphenation, be sure to load the babel package with the option ngerman -- or something broadly equivalent, say, naustrian.) Providing such markers doesn't go as far as does assigning different colors to the syllables, but it should help your student nevertheless.

I assume you're aware of the fact that in German not all syllable boundaries are valid hyphenation break points. E.g., if a word starts and/or ends with a one-letter syllable (Abend, aber, Atem, Atom, Element, Elend, Idylle, ober, oder, über; Arie, etc), hyphenation is not performed after the first syllable or before the final syllable. Thus, even though the word "Arie" has three syllables, it's usually not hyphenated. A separate case of hyphenation not being performed at a syllable boundary occurs if hyphenating a compound word would risk changing its meaning. E.g., while it's OK to hyphenate the word "Instinkt" after "In", the compound word "Urinstinkt" should never be hyphenated at the second syllable boundary.

Here's an example that uses the first paragraph of Thomas Mann's novel Tonio Kröger. (Of course, some might say that not only children but many adults as well may need help parsing anything written by Thomas Mann...) Only the word "über" is missing a syllable break marker, but that's to be expected.

enter image description here

% !TEX TS-program = lualatex
\documentclass[ngerman]{article}
\usepackage{fontspec,babel,showhyphens}
\setlength\textwidth{8cm} % just for this example
\begin{document}
\raggedright % disables hyphenation at line ends

Die Wintersonne stand nur als armer Schein, milchig und matt hinter 
Wolkenschichten über der engen Stadt. Naß und zugig war's in den 
giebeligen Gassen, und manchmal fiel eine Art von weichem Hagel, nicht 
Eis, nicht Schnee.
\end{document}

Addendum, to accommodate the OP's follow-up comment that he/she is willing to "bend" the hyphenation rules to allow hyphenation after the first letter in words such as aber, ober, über, and Abend.

I assume you'll be loading the babel package with the option ngerman. To let the showhyphens package insert little red markers after the first letters of words such as aber, ober, über, and Abend, issue the instruction

\renewcommand\ngermanhyphenmins{12}

in the preamble. (The default setting is "22", by the way.) Then, re-run LuaLaTeX and check if all words are still hyphenated correctly: some words may still be missing valid hyphenation points, while others may now display invalid hyphenation points. For example, in the case of the Tonio Kröger excerpt shown above, it turns out that the word über isn't hyphenated after the letter "ü". To rectify this, one could issue the command

\hyphenation{ü-ber}

(after loading babel). Interestingly, the words aber, ober, and Abend need no extra tweeking.

Conversely, if one were to modify the preceding example to include the novel's second paragraph as well, one would find that the word "Jupiterbart" features a fourth, spurious hyphenation point -- between "b" and "a". To correct this error, one could issue another command, viz., \hyphenation{ju-pi-ter-bart}. The two commands can be combined as

\hyphenation{ju-pi-ter-bart ü-ber}
5
  • +1 for Tonio Kröger and the comment on parsing thomas mann. (an english speaker.) Commented Mar 14, 2015 at 13:00
  • [I had some trouble editing my comment, sorry about this. I am very grateful for your help. This is what I wanted to write:] This already helps but is not perfect. I know about the difference but since I don't know a way to identify syllable boundaries in LaTeX, I thought hyphenation might be a good alternative. Especially because I think the one-letter rule is a pretty new one. Maybe one could use outdated hyphenation-rules or just change the exceptions manually.
    – Benjamin
    Commented Mar 14, 2015 at 13:32
  • @Benjamin - I've provided an addendum to my answer, in which I indicate how to enable hyphenation of words after the very first letter. I also provide suggestions for tweaking hyphenation exceptions in case a word is either missing valid hyphenation points or features invalid hyphenation points.
    – Mico
    Commented Mar 14, 2015 at 16:03
  • @Mico I think this should do the trick. I will give it a try and maybe we can start reading Tonio Kröger right away.
    – Benjamin
    Commented Mar 14, 2015 at 16:48
  • @Benjamin - Glad I was able to help. Most German hyphenation rules assume that words aren't hyphenated after the very first letter; hence, after setting \renewcommand\ngermanhyphenmins{12}, do be prepared to encounter quite a few incorrectly hyphenated words, and thus be ready to let the list of words included in the argument of \hyphenation{ } grow steadily.
    – Mico
    Commented Mar 14, 2015 at 17:23

You must log in to answer this question.

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