Estou escrevendo algumas letras de músicas. Se possível, páginas parcialmente vazias devem ser preferidas às quebras de página dentro de parágrafos. Usando \widowpenalties 1 10000
e \raggedbottom
não funcionou.
Até agora, só consegui obter o comportamento desejado colocando \filbreak
após cada parágrafo (= estrofe).
\documentclass[12pt]{article}
\usepackage[paperwidth=16cm, paperheight=9cm]{geometry}
\usepackage{nopageno}
\setlength\parindent{0pt}
\setlength\parskip{1em}
% Manually adding \filbreak at the end of stanza. This works as expected:
\begin{document}
\raggedright
Roads go ever ever on,\\
Over rock and under tree,\\
By caves where never sun has shone,\\
By streams that never find the sea;\\
Over snow by winter sown,\\
And through the merry flowers of June,\\
Over grass and over stone,\\
And under mountains in the moon.\filbreak
Roads go ever ever on\\
Under cloud and under star,\\
Yet feet that wandering have gone\\
Turn at last to home afar.\\
Eyes that fire and sword have seen\\
And horror in the halls of stone\\
Look at last on meadows green\\
And trees and hills they long have known.\filbreak
\end{document}
No entanto, não quero digitar isso manualmente após cada parágrafo. Eu tentei usar o método deesseresponder. O problema é que também preciso usar \\
para conseguir quebras de linha corretas entre os versos. Usando o método da resposta mencionada acima, recebo \filbreak
at every \\
, então não está funcionando.
\documentclass[12pt]{article}
\usepackage[paperwidth=16cm, paperheight=9cm]{geometry}
\usepackage{nopageno}
\setlength\parindent{0pt}
\setlength\parskip{1em}
% Trying to add \filbreak after each paragraph automatically. Not working:
\makeatletter
\def\filbreak{!\@@par\vfil\penalty-200\vfilneg}
% Exclamation mark is there just to show, that \\ is also treated like \par.
\makeatother
\begin{document}
\raggedright
\let\par\filbreak
Roads go ever ever on,\\
Over rock and under tree,\\
By caves where never sun has shone,\\
By streams that never find the sea;\\
Over snow by winter sown,\\
And through the merry flowers of June,\\
Over grass and over stone,\\
And under mountains in the moon.
Roads go ever ever on\\
Under cloud and under star,\\
Yet feet that wandering have gone\\
Turn at last to home afar.\\
Eyes that fire and sword have seen\\
And horror in the halls of stone\\
Look at last on meadows green\\
And trees and hills they long have known.
\end{document}
É possível colocar de alguma forma o comando personalizado ( \filbreak
) após cada parágrafo, mas não depois de cada \\
? Como estão \par
e \\
realmente conectados? Prefiro não usar algum outro pacote de poesia, pois estou escrevendo o meu próprio com algum outro comportamento específico, não relevante para esta questão.
Responder1
Sugiro mudar \\
para \newline
dentro de um poem
ambiente, no qual você definiu \interlinepenalty=10000
, para que quebras de página só sejam permitidas entre parágrafos.
\documentclass[12pt]{article}
\usepackage[paperwidth=16cm, paperheight=9cm]{geometry}
\usepackage{nopageno}
\setlength\parindent{0pt}
\setlength\parskip{1em}
\newenvironment{poem}{%
\begin{flushleft}\let\\\newline
\interlinepenalty=10000
}{\end{flushleft}}
\begin{document}
\begin{poem}
Roads go ever ever on,\\
Over rock and under tree,\\
By caves where never sun has shone,\\
By streams that never find the sea;\\
Over snow by winter sown,\\
And through the merry flowers of June,\\
Over grass and over stone,\\
And under mountains in the moon.
Roads go ever ever on\\
Under cloud and under star,\\
Yet feet that wandering have gone\\
Turn at last to home afar.\\
Eyes that fire and sword have seen\\
And horror in the halls of stone\\
Look at last on meadows green\\
And trees and hills they long have known.
\end{poem}
\end{document}
Responder2
Você pode usar um para
gancho para adicionar \filbreak
e desencorajar quebras de página em uma estrofe, definindo um valor alto\interlinepenalty
\documentclass[12pt]{article}
\usepackage[paperwidth=16cm, paperheight=9cm]{geometry}
\usepackage{nopageno}
\setlength\parindent{0pt}
\setlength\parskip{1em}
\AddToHook{para/after}{\filbreak}
\showoutput
% Manually adding \filbreak at the end of stanza. This works as expected:
\begin{document}
\interlinepenalty=9000
Roads go ever ever on,\\
Over rock and under tree,\\
By caves where never sun has shone,\\
By streams that never find the sea;\\
Over snow by winter sown,\\
And through the merry flowers of June,\\
Over grass and over stone,\\
And under mountains in the moon.
Roads go ever ever on\\
Under cloud and under star,\\
Yet feet that wandering have gone\\
Turn at last to home afar.\\
Eyes that fire and sword have seen\\
And horror in the halls of stone\\
Look at last on meadows green\\
And trees and hills they long have known.
\end{document}