4

How does one add a dash to the text in Lilypond? I would like what corresponds to --- in LaTex and — in HTML. With \addlyrics I have tried -, -- and ---, but these attempts are not interpreted as punctuation that should not be associated with a note.

2 Answers 2

3

Well, you can just add literally if your editor and/or input system has some way to generate it (mine works with Compose - - - for an emdash or Compose - - . for an endash) or copy and paste from some text with the right Unicode in it.

You can also write

\include "text-replacements.ly"
#(include-special-characters)

and then literally use — in your lyrics.

2
  • generates a dash all right, but the dash is associated with a note. I do not want it to be associated with a note (my language in the question is convoluted). Jul 17, 2022 at 13:47
  • 1
    Well, then don't separate it with a space from notes. Or if you do, enclose the whole in spaces or \markup { ... }. Or if you don't actually mean that you want an emdash, try "__" or "--" after the syllable in question separated with a space. Or maybe show an image of what you actually want.
    – user87796
    Jul 17, 2022 at 14:01
2

If you can't type it directly on your keyboard, lookup the unicode value, and enter it as a special character:

  • in decimal: \markup{ \char #8212 }, or
  • in hexadecimal: \markup{ \char ##x2014 }

As seen in this page of the documentation:
3.4.4 Special Characters - Unicode


Edit:

After reading you comment to the other answer, and then reading your question again more carefully, I see you are trying to get the symbol into lyrics.

Two dashes i.e. -- is supposed to be used for syllable separation in lyrics, but I guess it's not as long as you want it.

Update:

If you want to make theses inter-syllable hyphens to appear longer, still type them as --, but add the following override to the \addlyrics block:

\override LyricHyphen.length = #2.0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.