My TeX code (including parameters in command definitions) that creates lyrics sheets and chord sheets of songs is generated dynamically by other code accessing database data and processing it line by line, so my stripped-down MWE may seem odd, but bear with me.

The intent of the code snippet you see is that in addition to the basic line spacing associated with the two font sizes (which matters when lines wrap), an additional 0.3em is between each "paragraph" (line of lyrics) for clarity. However, whenever a line of romaji occurs immediately after a line of Japanese, I don't want that extra parskip, so I try to negate it with a \vspace of the negative of the same amount. So far, so good - the following file works:

\usepackage[a4paper, margin=6mm]{geometry}


賛美して目を向けてる あなたに\par
\romaji{sambi\ shite\ me\ o\ muketeru,\ anata\ ni\par}
もとめて待ち望んでる あなたを\par
\romaji{motomete\ machi\ nozonderu,\ anata\ o\par}


But when a style for romaji is added (in my test case, italic), it breaks and I get a huge hunk of extra space. The only difference between the left and right screenshots below is the addition of \textit{...} in the romaji command definition:


Here is the output of the two:

mysterious spacing http://l4jp.com/tmp/TeX-tests.png

The complaint in the log file is:

Runaway argument?
{{sambi\ shite\ me\ o\ muketeru,\ anata\ ni !
Paragraph ended before \text@command was complete.

That makes sense, but I only get that error when the \textit{} is there - perhaps the parser can't navigate the double braces? Moving the \par after the closing brace makes the error go away, but then the \vspace is ignored in all cases.

  • 1
    Have you tried \itshape instead of \textit? – erik Mar 24 '16 at 4:37
  • 1
    ...use {\itshape ...} instead of \textit{...}. – Werner Mar 24 '16 at 4:57
  • Yup, that works - thanks @erik and @Werner for the duet answer. So I guess you're saying that the way I'm doing the font size and \vspace and \par is not wrong (I thought I had bad form in there somewhere and the parser was just putting up with it), but I need to avoid using any styling inside the group that has "argument" syntax? – OsakaWebbie Mar 24 '16 at 21:35
  • @erik An answer? – egreg Dec 3 '16 at 22:43

The problem lies in how you're telling \romaji to use italics. The command \textit{} expects an argument, thus cannot handle paragraph breaks. This is why it complains when it encounters \par. One option is to simply omit \par from the end of every \romaji command. Perhaps a better option is to use {\itshape …}, which applies to whatever follows and can handle paragraph breaks. See the following MWE for an example.

\newcommand{\romaji}[1]{\begingroup\fontsize{10}{11.5}\selectfont{\itshape {#1}}\endgroup}

\textit{sambi\ shite\ me\ o\ muketeru,\ anata\ ni}

{\itshape sambi\ shite\ me\ o\ muketeru,\ anata\ ni\par}

\romaji{sambi\ shite\ me\ o\ muketeru,\ anata\ ni\par}

enter image description here

  • Thanks for making your comment into an answer so I can accept it, as well as a bit more explanation to help others who may come across this question. – OsakaWebbie Dec 4 '16 at 23:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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