gregorio-project / gregorio

The Gregorio Project
http://gregorio-project.github.io
Other
164 stars 43 forks source link

Superscript numbers in commentary #1537

Open smpklimach opened 3 years ago

smpklimach commented 3 years ago

I have scores that need commentaries with superscript numbers (e.g. M²). On one computer with gregorio 5.1.1. it works without problems. Now on a new computer with gregorio 5.2. it doesn't work. The commentary is not shown at all. I get an error message with 'invalid escape sequence'. Anything I can do?

rpspringuel commented 3 years ago

Can you please post a copy of the non-working files so that we can examine them?

smpklimach commented 3 years ago

Example .gabc-file:

name:Martyr Dei qui; office-part: Hymnus ad Laudes; occasion: Commune martyrum (unius);

date: ante IX.s.; author: unknown; transcriber: ; transcription-date: 2013;

style: modern; annotation:vij. T.; book:LH / HW 184;

commentary:anonymus, IX. s., M² TM³;

%%

\textcolor{red}{M}ar(c3e)tyr(g) De(h)i,(i) qui/quæ(iji) ú(hg)ni(h)cum(i) \textcolor{red}{*}(,) Pa(j)tris(k) se(j)quén(i)do(h) Fí(g)li(fef)um,(e) (;) vic(i)tis(i) tri(ij)úm(l)phas(k) hós(j)ti(ih)bus,(gfg) (,) vic(e)tor/trix(g) fru(h)ens(f) cæ(g)lés(e)ti(d)bus.(e) (::)
smpklimach commented 3 years ago

and an according .tex-file:

\documentclass[fontsize=14.5pt,twoside]{scrreprt}

\usepackage{gregoriotex} \usepackage[latin]{babel} \usepackage[utf8]{luainputenc}

\begin{document} \gresetheadercapture{commentary}{grecommentary}{string}

\gregorioscore[a]{martyrdei}

\end{document}

smpklimach commented 3 years ago

As I said - it works fine on one computer and doesn't show the commentary at all on the other (different versions of gregorio).

Thanks for taking a look!

rpspringuel commented 3 years ago

It’s probably not the version of Gregorio at fault here but the font. Those superscripts are individual characters and if the font you’re using doesn’t have them, then they won’t show up. If you think you’re using the same font, then it’s probable that you have different versions of the font on each machine.

Sent with GitHawk

smpklimach commented 3 years ago

The font was my first thought, too. But when we started with the superscript numbers our font didn't have them. Trying to print them didn't result in any error message. The commentary would be printed, just omitting the superscript numbers (e.g. anonymus, IX. s., M TM) and when we didn't specifiy a font, it worked. But now on the new computer we get an error message (invalid escape sequence near IX.s., M{}), the commentary is not shown in the pdf at all und not specifiying any font isn't helping (also specifying other fonts doesn't help). If it's not the different versions of gregorio - could it be the different versions of luatex?

rpspringuel commented 3 years ago

If it's not the different versions of gregorio - could it be the different versions of luatex?

That would be my second guess. Gregorio simply doesn't do anything with those sorts of characters that I would expect to produce your problem. Can you use those characters in the document which does not contain a Gregorio score?

smpklimach commented 3 years ago

I tried to put the superscript numbers in different places and the results are: they are producing an error whenever they appear in the head of the .gabc-file (commentary, annotation, author, etc.) and they are displayed without any problem when they appear in the tex-file outside the .gabc-file AND when they appear in the score itself.

smpklimach commented 3 years ago

Example .gabc-file with working superscript numbers:

name:Martyr Dei qui; office-part: Hymnus ad Laudes; occasion: Commune martyrum (unius);

date: ante IX.s.; author: unknown; transcriber: ; transcription-date: 2013;

style: modern; annotation:vij. T.; book:LH / HW 184;

commentary:anonymus, IX. s.;

%%

\textcolor{red}{M}ar(c3e)tyr(g) De(h)i,(i) qui/quæ(iji) ú(hg)ni(h)cum(i) \textcolor{red}{*}(,) Pa(j)tris(k) se(j)quén(i)do(h) Fí(g)li(fef)um,(e) (;) vic(i)tis(i) tri(ij)úm(l)phas(k) hós(j)ti(ih)bus,(gfg) (,) vic(e)tor/trix(g) fru(h)ens(f) cæ(g)lés(e)ti(d)bus.M²(e) (::)

smpklimach commented 3 years ago

So, if the numbers don't cause a problem anywhere in the score, only in the header, doesn't that mean the problem is in gregorio?

rpspringuel commented 3 years ago

Agreed, it must be somewhere in the code dealing with the headers. I'll look into it.

leduc006 commented 3 years ago

This may not be the most helpful suggestion, but TeX has its own way of creating super and subscripts, and it would probably be better to use that in conjunction with LaTeX/LuaLaTeX etc.:

M\texstsuperscript{2}

If your command to process your header is of the form

\gresetheadercapture{commentary}{grecommentary}{}

(i.e. not using the "string" option) then the commentary entry can contain TeX commands.

Someone clever with the unix command sed could search and replace all your superscripts. That's tricky, but could fix everything in one swoop. Or maybe up to 9 swoops, since you need to replace the "superscript character" 3 with \textsuperscript{3}, and same for 1, 2, 4, etc.

The unix command grep could find every instance of superscript characters in all your gabc files to let you know all the possible values of superscripts there are. If you have two+ digit superscripts, things would get a little more complicated for easy search and replacing. Still doable, but requires some more thought.

The same thing could be done with subscripts if you have any, using the TeX command \textsubscript{}.

Anyway, I'd try an example converting just a couple of files in that way and compiling only those and seeing if it fixes your combined index/superscript problem.

Hope that helps!

Rob