0

How do I get rid of the unwanted line shift between the second and third line?

\documentclass[12pt]{book}
\usepackage{verse}
\PassOptionsToPackage{bookmarks, colorlinks=false, hidelinks}{hyperref}
% Use PoetryTeX; http://www.ctan.org/pkg/poetrytex
\usepackage[numberpoems, clearpageafterpoem, useincipits]{poetrytex}

% Use the PA5 paper size
\usepackage[paperwidth=140mm,paperheight=210mm]{geometry}



\begin{document}


\begin{poem}{~}

    \poemtitle{Poem name}
    \settowidth{\versewidth}{And objects at rest tended to remain at rest tended to remain at rest}

    \begin{verse}[\versewidth]
        This is the first line\\
        \mbox{The second line is much longer than the first} \\
        \mbox{The third has unwanted space from the second}
    \end{verse} 

\end{poem}
\end{document} 
Skillmon
  • 60,462
  • 1
    I'm not sure whether this is also true for your input file, but after the last line (just after the closing brace) there was an invisible character U+2028 that you should remove if it's in your file, too. – Skillmon Jan 04 '20 at 20:08
  • After \end{document}? – Frode Alfson Bjørdal Jan 04 '20 at 20:12
  • No, after \mbox{The third has unwanted space from the second} (I removed it from your MWE). – Skillmon Jan 04 '20 at 20:12
  • There is no such character there with me. – Frode Alfson Bjørdal Jan 04 '20 at 20:15
  • If you don't already, try compiling with pdfLaTeX once and see whether it complains about that U+2028 character, if it doesn't it really just somehow crept in during copying/editing in the browser, else it is in your file (as I said, it's invisible, some editors might display it as a space or similar, some might hide it completely). – Skillmon Jan 04 '20 at 20:19
  • I always compile with pdfLaTeX, I think, and in this case I do not get an error message. – Frode Alfson Bjørdal Jan 04 '20 at 20:23
  • Although the answer resetting the width obviously works, I would try removing the space before the \\ on the second line, after the \mbox. Since that line is longer than the default width, the space would cause that line to go to a second output line. – barbara beeton Jan 04 '20 at 20:31
  • That doesn't seem to work. – Frode Alfson Bjørdal Jan 04 '20 at 20:56

1 Answers1

2

The problem is that your lines are too long for A5 paper, so either let verse do its job and remove the \mbox, or lie properly about the length of a line:

\documentclass[12pt]{book}
\usepackage{verse}
\PassOptionsToPackage{bookmarks, colorlinks=false, hidelinks}{hyperref}
% Use PoetryTeX; http://www.ctan.org/pkg/poetrytex
\usepackage[numberpoems, clearpageafterpoem, useincipits]{poetrytex}

% Use the PA5 paper size
\usepackage[paperwidth=140mm,paperheight=210mm]{geometry}



\begin{document}


\begin{poem}{~}

    \poemtitle{Poem name}
    \settowidth{\versewidth}{And objects at rest tended to remain at rest tended to remain at rest}

    \begin{verse}[\versewidth]
        This is the first line\\
        \makebox[\linewidth][l]{The second line is much longer than the first} \\
        \makebox[\linewidth][l]{The third has unwanted space from the second}
    \end{verse} 

\end{poem}
\end{document} 

enter image description here

Skillmon
  • 60,462