2

I am using the "songs package" to compile a songbook. Originally I had an issue where none of the special characters in my native language would appear in the produced pdf. #Alan Munn helped me to resolve 99% of my original issue by adding the following to my .tex file:

\usepackage[T1]{fontenc}
\usepackage{lmodern}% load a font with all the characters

However with the resolution appeared a new issue namely the used apostrophe (') is displayed as (Š) character whereas is was also omitted previously. A futher proposal was to add:

\usepackage[utf8]{inputenc}

Adding this results in error message: "package inputenc error: keyboard character used is undefined (inputenc) in inputencoding 'utf8'

However logic dictates to my ignorant brain that the resolution could be instead in the previous measures as it is now not omitting the (') but displaying it incorrectly - maybe this can be manipulated? Can anybody advise me on this?

This is what I have so far:

\documentclass[letterpaper,10pt]{article}
\usepackage[bookmarks]{hyperref}
\usepackage[lyric]{songs}
% \includeonlysongs{2}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}% load a font with all the characters
\usepackage[afrikaans]{babel}

\setlength{\oddsidemargin}{0in}
\setlength{\evensidemargin}{0in}
\setlength{\textwidth}{6.5in}
\setlength{\topmargin}{0in}
\setlength{\topskip}{0in}
\setlength{\headheight}{0in}
\setlength{\headsep}{0in}
\setlength{\textheight}{9.5in}
\settowidth{\versenumwidth}{1.\ }
\pagestyle{empty}

\newindex{titleidx}{lbtitle}


\begin{document}

\showindex{Inhoudsopgawe}{titleidx}

\songsection{Dogter van Sion Liedere}
\begin{songs}{titleidx}
\beginsong{DAAR’S ‘n LEEU}
\textnote{sing 4x; eerste stadig dan 2 vinniger en laaste weer stadig}
\beginverse
 Daar’s ‘n Leeu wat brul uit die Suide -
 dis die Leeu van Judah.
\endverse
\endsong
\end{songs}

\end{document}

The verse quoted above is an extract from the file songs.sdb which basically only contains songs and verses.

It produces a pdf that replaces the apostrophy (in the first line) with a (Š) character:

DaarŠs Sn Leeu wat brul uit die Suide - 
dis die Leeu van Judah.
Gert
  • 55
  • 7
  • 1
    This has nothing to do with the songs package per se. See How to type special/accented letters in LaTeX?. – Alan Munn Feb 20 '16 at 19:52
  • Thank you Alan, You solved 99% of my issue. I still remain with the ( ' ) character not being displayed correctly. It produces (Š) in pdf. Any advice on this?

    I added:

    \usepackage{inputenc} \usepackage[T1]{fontenc} \usepackage{lmodern} % load a font with all the characters

    – Gert Feb 20 '16 at 21:17
  • Perhaps you can edit your code to show just that problem? – Alan Munn Feb 20 '16 at 21:18
  • Alan I am really a dummy and still learning the ropes. Please bare with me. Could you explain "edit your code"? – Gert Feb 20 '16 at 21:20
  • No problem. Below your question you should see an "edit" link. If you click on it, you can edit your question. So remove the original code sample you gave and replace it with one that shows your new problem. – Alan Munn Feb 20 '16 at 21:24
  • I replaced the code above with what I have now. As mentioned earlier I am using the "songs" package. It produces a couple of pdf files. In my native language the (') character is being used similar to the apostrophe in English - thus with various letters like 's, 'n, 't etc. currently the pdf produces a (Š) character instead of the ( ' ) – Gert Feb 20 '16 at 21:45
  • One other useful thing to know: if you select the code and click on the {} icon it will be formatted as code. (Code is formatted with 4 spaces before each line). But your edit itself, doesn't show the problem, since it depends on songs.sbd which we don't have. But we shouldn't need that whole file, just the line of it that causes the problem. – Alan Munn Feb 20 '16 at 21:48
  • I edited the code to display the problem – Gert Feb 20 '16 at 22:04
  • Are you sure you have saved your file as utf8 and you are loading inputenc with the utf8 encoding? (i.e. \usepackage[utf8]{inputenc}) – Alan Munn Feb 20 '16 at 23:10
  • the example posted can not be run on its own so does not allow anyone to reproduce the problem, please make the example self contained from \documentclass to \end{document} – David Carlisle Feb 21 '16 at 01:52
  • At the bottom right of the TeXworks window you see three small boxes; the rightmost one tells you the position of the cursor; the center one is for the file encoding: click on it and select UTF-8 from the drop down menu; then redo it selecting the top item (Reload using selected encoding). You should check each of the files you input, I'm afraid. – egreg Feb 21 '16 at 10:03
  • I have checked al four .tex files produced when running the songs package. they all display the utf8 in the middle box on opening. Thus issue remain... – Gert Feb 21 '16 at 10:13
  • Is it obvious where the file songs.sbd might be obtained from? – Mico Feb 21 '16 at 10:31
  • hyperref should be loaded last, with few exceptions. It should not be the first package loaded. – cfr Feb 21 '16 at 19:43
  • Are you intentionally using curly quotation marks (opening and closing) in the source rather than straight ones? I don't know the language so I don't know if it is usual to use ‘n, for example, but ’s. It works for me, regardless - even with hyperref loaded first, although that'll probably cause other problems. – cfr Feb 21 '16 at 19:53
  • The curly quot. marks are the way I inherited the "songs package". Yes it is the usual way to use ('n - meaning "a") whereas 's would be same as in English apostrophe ' .

    Moving the hyperref does not make any difference. The moment I add the utf8 command it bails and result in the error message mentioned in the question.

    – Gert Feb 21 '16 at 20:09
  • Daai ronde aanhalingstekens is die probleem. Use Unicode Character 'APOSTROPHE' (U+0027), that works in XeLaTeX using Alan's example below. – McGafter Feb 22 '16 at 11:39
  • Big vote to last comments. Solved my mystery! All resolved. Thank you so much guys!! – Gert Feb 22 '16 at 18:17

1 Answers1

1

The curly quotes is the problem. With using Unicode Character 'APOSTROPHE' (U+0027) instead of those curly single quotes, this example works great.

\documentclass[letterpaper,10pt]{article}
\usepackage[bookmarks]{hyperref}
\usepackage[lyric]{songs}
% \includeonlysongs{2}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}% load a font with all the characters
\usepackage[afrikaans]{babel}

\setlength{\oddsidemargin}{0in}
\setlength{\evensidemargin}{0in}
\setlength{\textwidth}{6.5in}
\setlength{\topmargin}{0in}
\setlength{\topskip}{0in}
\setlength{\headheight}{0in}
\setlength{\headsep}{0in}
\setlength{\textheight}{9.5in}
\settowidth{\versenumwidth}{1.\ }
\pagestyle{empty}

\newindex{titleidx}{lbtitle}


\begin{document}

\showindex{Inhoudsopgawe}{titleidx}

\songsection{Dogter van Sion Liedere}
\begin{songs}{titleidx}
\beginsong{DAAR'S 'n LEEU}
\textnote{sing 4x; eerste stadig dan 2 vinniger en laaste weer stadig}
\beginverse
 Daar's 'n Leeu wat brul uit die Suide -
 dis die Leeu van Judah.
\endverse
\endsong
\end{songs}

\end{document}
McGafter
  • 2,266