2

This answer explains how to use expl3 to store a seq variable to place content later in a document. I'd like to write a command that:

  • Writes the first argument to the main flow of the page.
  • Writes the second argument to the contents of a floating element at the bottom of the page. (A tcolorbox box in this case, though not necessarily.) This argument will in practice only ever be a single sentence, and the command should concatenate them into a paragraph.
  • Writes these only if there is room for both on the current page. If not, it should begin a new page with the first argument, and a new floating element at bottom, containing the second argument.

It may be that expl3 is unnecessary here, in which case I welcome other approaches.

  • On first thought I don't find that expl3 seq features are needed here. With bottom you mean the footer? – user31729 Nov 4 '15 at 17:14
  • All is easy, but not the keeping on the same page ... – user31729 Nov 4 '15 at 17:53
  • @ChristianHupfer Yes, that's right. I avoided "footer" because I was unsure whether the term applied only to elements repeated over pages (numbering and the like). Keeping does seem to be the trouble. My brief read of this answer suggests that TeX's greedy float placement may pose an obstacle. – Sean Easter Nov 4 '15 at 18:14
  • In my point of view, you don't need the floating at all. You want to have some text with #1 and the second argument should be shifted to the footer. This isn't floating! Perhaps savelowerto is the better way. – user31729 Nov 4 '15 at 23:03
  • @ChristianHupfer Yes, I think you're right that the floating is rather unrelated. \savelowerto seems like the right idea. I think I'll dig through the source to see how to accomplish the same thing in my own commands. – Sean Easter Nov 5 '15 at 1:24
2

No full solution so far, only a test.

\documentclass{article}

\usepackage[a4paper,tmargin=1.5cm,bmargin=1.5cm,rmargin=1.5cm,lmargin=1.5cm]{geometry}
\usepackage{xparse}

\usepackage[most]{tcolorbox}


\newtcolorbox[auto counter]{myfooterbox}[1][]{
  colback=yellow!50!white,float,floatplacement={b},title={footer box \thetcbcounter},coltext=black,#1}


\NewDocumentCommand{\writemystuff}{O{}+m+m}{%
    #2
  \vfill %\push the box to the bottom
  \begin{myfooterbox}[#1]
    #3
  \end{myfooterbox}
}




\usepackage{blindtext}




\begin{document}

\writemystuff{\blindtext[3]}{\blindtext}


\writemystuff{\blindtext}{\blindtext}



\end{document}

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.