0

The longfbox package is proving very useful as a way to break long verses across pages, something I have been searching for for years. With 3 out of 4 of the longfbox configurations, however, text that is longer than the width of the page does not wrap properly. Even with this limitation, the single longfbox configuration that does wrap properly will prove a valuable addition within my LaTeX project and document.

Before I make wholesale changes to my LaTeX project and document across the board to implement the longfbox package, I have two questions:

  1. Am I missing something with the longfbox LaTeX code that is preventing the text from wrapping in 3 out of the 4 configurations? (See MWE below.)
  2. On Nov 17, 2020, a LaTeX bug within the longfbox package was documented on SE at Error with longfbox package. The bug has not been corrected within the longfbox package itself. Given the hiatus since the original 2015-12-05 release of the package in 2015 (7 years), and the lack of an update for the known bug, I am wondering if the longfbox package is still being maintained? If not, should I hold off before I incorporate the longfbox package throughout my LaTeX project wholesale to see if there is a more current, replacement package that is being maintained?
\documentclass{article}
\usepackage{longfbox}

% See 'Error with longfbox package' at \url{https://tex.stackexchange.com/questions/571207/error-with-longfbox-package} \makeatletter \newdimen@tempdimd \makeatother

% The longfbox \newfboxstyle+\lfbox macro combination does not wrap the text as it should. \newfboxstyle{textfbox}{ breakable=true, border-width=0.4pt, border-top-color=blue, border-bottom-color=blue, border-style={solid,none,solid,none}, padding={2pt,5pt}, margin={3pt,3pt,1cm,3pt}, width={\dimexpr\textwidth-14pt}, baseline-skip=true }

% And this \mylbox+\lfbox macro combination doesn't seem to wrap the text as it should either. \newcommand*{\mylbox}[1]{% \lfbox[ breakable=true, border-width=0.4pt, border-top-color=blue, border-bottom-color=blue, border-style={solid,none,solid,none}, padding={2pt,5pt}, margin={3pt,3pt,1cm,3pt}, width={\dimexpr\textwidth-14pt}, baseline-skip=true ] {#1} }

\begin{document}

\noindent\lfbox[textfbox]{An \textbf{initial} \textsf{longfbox} configuration using \textbf{newfboxstyle}+\textbf{lfbox}. A longfbox can contain much longer content and will by default be as wide as the current line width.}

\noindent\mylbox{A \textbf{second} \textsf{longfbox} configuration using \textbf{mylbox}+\textbf{lfbox}. A longfbox can contain much longer content and will by default be as wide as the current line width.}

\fboxset{ breakable=true, border-width=0.4pt, border-top-color=blue, border-bottom-color=blue, border-style={solid,none,solid,none}, padding={2pt,5pt}, margin={3pt,3pt,1cm,3pt}, width={\dimexpr\textwidth-14pt}, baseline-skip=true }

\noindent\lfbox{A \textbf{third} \textsf{longfbox} configuration using \textbf{fboxset}+\textbf{lfbox}. A longfbox can contain much longer content and will by default be as wide as the current line width.}

% But when using the \longfbox macro directly (without the \newfboxstyle+\lfbox or \mylbox+\lfbox combination macros), the text wraps as it should. \begin{longfbox}[ breakable=true, border-width=0.4pt, border-top-color=blue, border-bottom-color=blue, border-style={solid,none,solid,none}, padding={2pt,5pt}, margin={3pt,3pt,1cm,3pt}, width={\dimexpr\textwidth-14pt}, baseline-skip=true ] {A \textbf{final} \textsf{longfbox} configuration using just \textbf{longfbox} alone. A longfbox can contain much longer content and will by default be as wide as the current line width.} \end{longfbox}

\end{document}

Results from 4 configurations of the longfbox package.

RosesBouquet
  • 569
  • 3
  • 13
  • I just looked at the package and this is the documented behaviour, right at the start, it says "Just like the regular \fbox command, the \lfbox command sets the content in a horizontal box and cannot break the content over multiple lines" – David Carlisle Nov 25 '22 at 23:47
  • @David Carlisle - Thank you for the clarification ... I guess that rules out 3 out of the 4 options. Still, the longfbox package is a gift when it comes to breaking verses across pages. The question that remains, before I go and wholesale replace my current code to implement longfbox across the board is ... is the package being maintained given the lack of an update to include the @tempdimd bug? (It has been 7 years since the package was released.) – RosesBouquet Nov 25 '22 at 23:52
  • I have no idea I do not think I had heard of the package until 5 minutes ago, Have you tried reporting the issue to the package author? – David Carlisle Nov 25 '22 at 23:54
  • @David Carlisle - Thanks ... I'll try to contact the author ... in the meantime, if you create an answer to the question that includes your comment re how "\lfbox command sets the content in a horizontal box and cannot break the content over multiple lines", I'll accept your answer so you'll get the credit (although my guess is you don't need the points!). Thank you for the fast response!! – RosesBouquet Nov 26 '22 at 00:11
  • @David Carlisle - In the The longfbox package, Daan Leijen is listed as the author, but I don't see an email address? CTAN states "Please consult the package documentation to find the email addresses.", but I don't see an email in the longfbox documentation. The longfbox package is quite amazing ... it would be a shame if it is no longer being maintained. – RosesBouquet Nov 26 '22 at 00:20
  • not that unusual, ctan has a lot of stuff of uncertain origin google would suggest https://conf.researchr.org/profile/daanleijen – David Carlisle Nov 26 '22 at 00:29
  • Have you tried tcolorbox? – John Kormylo Nov 26 '22 at 04:59
  • @John Kormylo - I've used tcolorbox for other LaTeX work, but not for this application. Can you provide an example of how I could use tcolorbox as a wrap-around for verse (as I am with the longfbox package) to allow it to break with pages? Thanks for your comment! – RosesBouquet Dec 01 '22 at 07:55
  • Actually, it would be easier just to create your own environment using \hrule at the start and end. – John Kormylo Dec 01 '22 at 14:52
  • @John Kormylo - Thank you for the suggestion. As a LaTeX novice, can you point me to an example here or anywhere else to demonstrate how to do that? Wouldn't be the first time (and likely not the last) that my code is just too convoluted. Thanks again! – RosesBouquet Dec 09 '22 at 02:10

2 Answers2

2

This is the documented behaviour, right at the start of the package Overview, it says

Just like the regular \fbox command, the \lfbox command sets the content in a horizontal box and cannot break the content over multiple lines

David Carlisle
  • 757,742
  • Thanks again ... always nice to receive one of your responses. Take care and enjoy your holidays!! – RosesBouquet Nov 26 '22 at 00:22
  • It appears that Daan Leijen is over at Microsoft Research (https://www.microsoft.com/en-us/research/people/daan/) Makes sense given the quality of the longfbox package. The email listed as: daan@microsoft.com. I'll try to contact him. Thanks again!! – RosesBouquet Nov 26 '22 at 00:30
0

DIY longbox. (I wasn't sure whether you wnated to reduce the width of the text or increase the width of the rules.)

\documentclass{article}
\usepackage{xcolor}

\newenvironment{mybox}{\par\medskip{\color{blue}\hrule height0.4pt}% \leftskip=3pt \rightskip=3pt \parindent=0pt \strut\ignorespaces}{\strut {\color{blue}\hrule height0.4pt}\medskip}

\begin{document} %\noindent\rule{\textwidth}{43\baselineskip}% test page breaking

\begin{mybox} A \textbf{final} \textsf{longfbox} configuration using just \textbf{longfbox} alone. A longfbox can contain much longer content and will by default be as wide as the current line width. \end{mybox}

Some text after. \end{document}

John Kormylo
  • 79,712
  • 3
  • 50
  • 120