Redefine \Rbar \Vbar

118 views
Skip to first unread message

ja mous

unread,
Apr 13, 2021, 4:51:39 PM4/13/21
to Gregorio Users

Dear Gregorio-Friends,

I do have a font called antiphonaire which has a predefined  \Rbar (which replaces the  ® symbol) and \Vbar (which replaces the  £ symbol). I would like to redefine \Rbar \Vbar to be always in the font Antiphonaire, because I will use another main font. I tried

\def\Rbar{Antiphonaire}{®}

\def\Vbar{Antiphonaire}{£}

but this won't work. I think there is probably an easy solution, but my TEX knowledge is to small...

Thank you very much.

Jakob

seminarian

Sr. Maria Ruth Malagoli

unread,
Apr 14, 2021, 12:01:03 AM4/14/21
to gregori...@googlegroups.com
Dear Jakob,
I'm not a TEX expert, but I would try something like this (you need the package fontspec to do this):

\def\myVbar{\fontspec{Antiphonaire}\selectfont{£}}
\def\myRbar{\fontspec{Antiphonaire}\selectfont{®}}

then you may use the commands \myRbar and \myVbar instead of \Rbar and \Vbar in your scores and documents.

Hope this helps. God bless you,
Sr. M. Ruth 

Rob Leduc

unread,
Apr 14, 2021, 8:55:35 AM4/14/21
to Gregorio Users
As Sr. M. Ruth said, those commands using fontspec will work. However,  if you prefer to keep the command sequence as \Vbar and \Rbar, make sure you execute the fontspec commands in that message after you have loaded the Gregorio TeX package; otherwise the \usepackage{gregoriotex} command would cause the commands to be redefined back to the V/ and R/ symbols.

I don't know how Gregorio Tex evaluates the gabc tags <sp>V/</sp> and <sp>R/</sp>.  If you're doing this in a Latex file that is going to process .gabc, you may find pound signs and registered trademarks turning up in your typeset scores.  In that case, you might also need to use \gresetspecial{} to redefine the V/ and R/ tags to the proper symbols. 

In general, users of Latex (as opposed to package writers) may prefer the latex commands \newcommand and \renewcommand rather than \def in most cases.  One main difference is that \newcommand checks to see if a command is already defined and gives an error if you try to reuse something.  That can prevent unexpected conflicts if you are using a lot of packages and accidentally redefine a command from a package using \def without realizing it.  The command \renewcommand allows you to redefine an old command, so it is not locked in stone by \newcommand.  Using \renewcommand just forces you to explicitly acknowledge you are redefining an existing command and not creating something new - it would give an error if the command had NOT been previously defined.

The syntax is

\newcommand{commandname}[args]{ .... defining code ....}

The optional [args] allows you to define arguments passed to the command but can be left out if, as in this case, there is none, they can be omitted:

\newcommand{\Vbar}{\fontspec{Antiphonaire}\selectfont{£}}  

The command above would generate an error if used after loading Gregorio TeX because Gregorio TeX already defines the symbol \Vbar.  You could switch it to \renewcommand and it would work. 

\renewcommand has the same syntax as \newcommand, it just allows you to redefine an existing command.

So, to overly lengthen a long email on a trivial point:

\usepackage{gregoriotex}
\newcommand{\Vbar}{\fontspec{Antiphonaire}\selectfont{£}}

would generate an error, but


\usepackage{gregoriotex}
\renewcommand{\Vbar}{\fontspec{Antiphonaire}\selectfont{£}}

would work, even if that may be inadvisable for possibly causing functionality problems with Gregorio Tex.  That problem would be avoided by defining the commands as Sr. M. Ruth says: \myRbar, \myVbar.

Rob

Fr. Samuel Springuel

unread,
Apr 14, 2021, 1:26:22 PM4/14/21
to gregori...@googlegroups.com
> On 14 Apr, 2021, at 8:55 AM, Rob Leduc <rled...@gmail.com> wrote:
>
> I don't know how Gregorio Tex evaluates the gabc tags <sp>V/</sp> and <sp>R/</sp>.

These will get replaced by \Vbar and \Rbar, respectively, when typesetting the score.

> \usepackage{gregoriotex}
> \renewcommand{\Vbar}{\fontspec{Antiphonaire}\selectfont{£}}
>
> would work, even if that may be inadvisable for possibly causing functionality problems with Gregorio Tex. That problem would be avoided by defining the commands as Sr. M. Ruth says: \myRbar, \myVbar.

There should be no problem with redefining \Vbar and \Rbar in this fashion. I regularly do something similar in order to force them to always be liturgical red in my documents. However, the syntax given above is off. \selectfont is a switch, not a macro, so to properly use you need to move one of the opening braces to get the following:

\renewcommand{\Vbar}{{\fontspec{Antiphonaire}\selectfont £}}

Otherwise the switch to Antiphonaire will persist beyond that single character.

✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝
Fr. Samuel, OSB
(R. Padraic Springuel)
St. Anselm’s Abbey
4501 South Dakota Ave, NE
Washington, DC, 20017
202-269-2300
(c) 202-853-7036

PAX ☧ ΧΡΙΣΤΟΣ

ja mous

unread,
Apr 14, 2021, 3:04:36 PM4/14/21
to gregori...@googlegroups.com
Thank you very much!
The command \renewcommand{\Vbar}{{\fontspec{Antiphonaire}\selectfont £}}  works as expected. However if I want to apply the gregoriocolor (which I have previously redefined) as follows

\renewcommand{\Vbar}{{\fontspec{\color{gregoriocolor}Antiphonaire}\selectfont £}}

\renewcommand{\Rbar}{{\fontspec{\color{gregoriocolor}Antiphonaire}\selectfont ®}}


I get the error message

LaTeX Font Warning: Font shape `TU/plantinmtprosemibold(0)/m/it' undefined

(Font) using `TU/plantinmtprosemibold(0)/m/n' instead on input lin

e 17.


! Use of \@undeclaredcolor doesn't match its definition.

\@ifnextchar ... \reserved@d =#1\def \reserved@a {

#2}\def \reserved@b {#3}\f...


l.24 \GreSetFixedTextFormat

{2}\GreSetFixedNextTextFormat{2}\GreSyllable{\GreSe...


?


(plantinmtprosemibold is my main font)

Thanks again for your help!

Jakob


--
Gregorio homepage: http://gregorio-project.github.io
Archives for the old mailing list: http://www.mail-archive.com/gregori...@gna.org/
To report a bug, please post to: https://github.com/gregorio-project/gregorio/issues
---
You received this message because you are subscribed to a topic in the Google Groups "Gregorio Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/gregorio-users/00K0gn3Se7c/unsubscribe.
To unsubscribe from this group and all its topics, send an email to gregorio-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gregorio-users/A16AAAA0-27A2-4AF8-93B9-F1B42B7F15A9%40gmail.com.

Fr. Samuel Springuel

unread,
Apr 14, 2021, 4:56:03 PM4/14/21
to gregori...@googlegroups.com
> On 14 Apr, 2021, at 3:04 PM, ja mous <jakm...@gmail.com> wrote:
>
> \renewcommand{\Vbar}{{\fontspec{\color{gregoriocolor}Antiphonaire}\selectfont £}}
> \renewcommand{\Rbar}{{\fontspec{\color{gregoriocolor}Antiphonaire}\selectfont ®}}

The \fontspec command is solely for selecting the font and so its argument should be solely the font name. Changing the color is a separate switch. Try:

\renewcommand{\Vbar}{{\fontspec{Antiphonaire}\color{gregoriocolor}\selectfont £}}
\renewcommand{\Rbar}{{\fontspec{Antiphonaire}\color{gregoriocolor}\selectfont ®}}

✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝
Reply all
Reply to author
Forward
0 new messages