0

I have a question about the interaction of the packages afterpage and cuted in two-column mode near the document end - or about cuted's strip environment in otherwise empty documents for that matter.

afterpage offers the command \afterpage which allows me to execute some code on the next page. cuted offers the environment strip which can temporarily switch from two-column to one-column mode.

It seems to me that if I use \afterpage to delay the layout of a strip environment, in some cases, this environment is not laid out at all. In particular, this seems to happen near the end of a document.

I believe that this is caused by an issue in cuted: strip environments may not get laid out if they appear in otherwise empty documents.

I would like to know how to fix this, i.e., how to obtain the expected behavior: the strip being laid out properly on the next (i.e., last) page of the document. (I need that for the figureSeries package I am working on).

In the following, I will present several MWEs exhibiting different behaviors, which may help to solve this question.

1. The Problem Case

\afterpage is used as only command in the document. It contains a strip environment. Executing this program with pdflatex will not produce any output document.

1.1. The MWE Code

\documentclass[twocolumn]{article}%
\usepackage{cuted}%
\usepackage{afterpage}%
\begin{document}%
\afterpage{%
\begin{strip}%
A B C%
\end{strip}%
}%
\end{document}%

1.2. The Log File Produced by pdflatex

This is pdfTeX, Version 3.1415926-2.5-1.40.14 (TeX Live 2013/Debian) (format=pdflatex 2015.5.1)  13 JUL 2015 08:48
entering extended mode
 restricted \write18 enabled.
 %&-line parsing enabled.
**test
(./test.tex
LaTeX2e <2011/06/27>
Babel <3.9h> and hyphenation patterns for 78 languages loaded.
(/usr/share/texlive/texmf-dist/tex/latex/base/article.cls
Document Class: article 2007/10/19 v1.4h Standard LaTeX document class
(/usr/share/texlive/texmf-dist/tex/latex/base/size10.clo
File: size10.clo 2007/10/19 v1.4h Standard LaTeX file (size option)
)
\c@part=\count79
\c@section=\count80
\c@subsection=\count81
\c@subsubsection=\count82
\c@paragraph=\count83
\c@subparagraph=\count84
\c@figure=\count85
\c@table=\count86
\abovecaptionskip=\skip41
\belowcaptionskip=\skip42
\bibindent=\dimen102
)
(/usr/share/texlive/texmf-dist/tex/latex/lipsum/lipsum.sty
Package: lipsum 2011/04/14 v1.2 150 paragraphs of Lorem Ipsum dummy text
\c@lips@count=\count87
)
(/usr/share/texlive/texmf-dist/tex/latex/sttools/cuted.sty
Package: cuted 2012/10/04 v1.5 Mixing onecolumn and twocolumn modes
\At@ViperColsBreak=\toks14
\v@aaa=\box26
\v@ccc=\box27
\lastskip@a=\skip43
\lastskip@b=\skip44
\lastskip@d=\skip45
\lastbox@a=\box28
\stripsep=\skip46
\@viper=\box29
\viper@penalty=\count88
\hold@viper=\box30
\ht@viper=\dimen103
) (./afterpage.sty
Package: afterpage 2014/10/28 v1.08 After-Page Package (DPC)
\AP@output=\toks15
\AP@partial=\box31
\AP@footins=\box32
)
(./test.aux)
\openout1 = `test.aux'.

LaTeX Font Info:    Checking defaults for OML/cmm/m/it on input line 5.
LaTeX Font Info:    ... okay on input line 5.
LaTeX Font Info:    Checking defaults for T1/cmr/m/n on input line 5.
LaTeX Font Info:    ... okay on input line 5.
LaTeX Font Info:    Checking defaults for OT1/cmr/m/n on input line 5.
LaTeX Font Info:    ... okay on input line 5.
LaTeX Font Info:    Checking defaults for OMS/cmsy/m/n on input line 5.
LaTeX Font Info:    ... okay on input line 5.
LaTeX Font Info:    Checking defaults for OMX/cmex/m/n on input line 5.
LaTeX Font Info:    ... okay on input line 5.
LaTeX Font Info:    Checking defaults for U/cmr/m/n on input line 5.
LaTeX Font Info:    ... okay on input line 5.
Extra height:0.0pt when 0.0pt
(2)Left:0.0pt Right:0.0pt Output:0.0pt
- LAST -
Left:0.0pt
Right:0.0pt
Output:0.0pt
 (./test.aux) )
Here is how much of TeX's memory you used:
 435 strings out of 493304
 5019 string characters out of 6139872
 144451 words of memory out of 5000000
 3970 multiletter control sequences out of 15000+600000
 3640 words of font info for 14 fonts, out of 8000000 for 9000
 957 hyphenation exceptions out of 8191
 23i,4n,19p,151b,52s stack positions out of 5000i,500n,10000p,200000b,80000s

No pages of output.
PDF statistics:
 0 PDF objects out of 1000 (max. 8388607)
 0 named destinations out of 1000 (max. 500000)
 1 words of extra memory for PDF output out of 10000 (max. 10000000)

2. Without strip, afterpage Works Near the Document End

The error is definitely related to the strip environment from cuted in conjunction with \afterpage, because without strip, \afterpageing something in an otherwise blank document works and produces one page of output.

2.1. The MWE Code (without strip)

\documentclass[twocolumn]{article}%
\usepackage{afterpage}%
\begin{document}%
\afterpage{%
A B C%
}%
\end{document}%

3. The Problem Case without \afterpage

Interestingly, having a strip environment in a blank document also produces no output either.

3.1. The MWE Code (without \afterpage)

\documentclass[twocolumn]{article}%
\usepackage{cuted}%
\begin{document}%
\begin{strip}%
A B C
\end{strip}%
\end{document}%

3.2. The Log File Produced by pdflatex

This is pdfTeX, Version 3.1415926-2.5-1.40.14 (TeX Live 2013/Debian) (format=pdflatex 2015.5.1)  13 JUL 2015 09:36
entering extended mode
 restricted \write18 enabled.
 %&-line parsing enabled.
**test
(./test.tex
LaTeX2e <2011/06/27>
Babel <3.9h> and hyphenation patterns for 78 languages loaded.
(/usr/share/texlive/texmf-dist/tex/latex/base/article.cls
Document Class: article 2007/10/19 v1.4h Standard LaTeX document class
(/usr/share/texlive/texmf-dist/tex/latex/base/size10.clo
File: size10.clo 2007/10/19 v1.4h Standard LaTeX file (size option)
)
\c@part=\count79
\c@section=\count80
\c@subsection=\count81
\c@subsubsection=\count82
\c@paragraph=\count83
\c@subparagraph=\count84
\c@figure=\count85
\c@table=\count86
\abovecaptionskip=\skip41
\belowcaptionskip=\skip42
\bibindent=\dimen102
)
(/usr/share/texlive/texmf-dist/tex/latex/sttools/cuted.sty
Package: cuted 2012/10/04 v1.5 Mixing onecolumn and twocolumn modes
\At@ViperColsBreak=\toks14
\v@aaa=\box26
\v@ccc=\box27
\lastskip@a=\skip43
\lastskip@b=\skip44
\lastskip@d=\skip45
\lastbox@a=\box28
\stripsep=\skip46
\@viper=\box29
\viper@penalty=\count87
\hold@viper=\box30
\ht@viper=\dimen103
) (./test.aux)
\openout1 = `test.aux'.

LaTeX Font Info:    Checking defaults for OML/cmm/m/it on input line 3.
LaTeX Font Info:    ... okay on input line 3.
LaTeX Font Info:    Checking defaults for T1/cmr/m/n on input line 3.
LaTeX Font Info:    ... okay on input line 3.
LaTeX Font Info:    Checking defaults for OT1/cmr/m/n on input line 3.
LaTeX Font Info:    ... okay on input line 3.
LaTeX Font Info:    Checking defaults for OMS/cmsy/m/n on input line 3.
LaTeX Font Info:    ... okay on input line 3.
LaTeX Font Info:    Checking defaults for OMX/cmex/m/n on input line 3.
LaTeX Font Info:    ... okay on input line 3.
LaTeX Font Info:    Checking defaults for U/cmr/m/n on input line 3.
LaTeX Font Info:    ... okay on input line 3.
Extra height:0.0pt when 0.0pt
(2)Left:0.0pt Right:0.0pt Output:0.0pt
- LAST -
Left:0.0pt
Right:0.0pt
Output:0.0pt

(./test.aux) )
Here is how much of TeX's memory you used:
 237 strings out of 493304
 2693 string characters out of 6139872
 52430 words of memory out of 5000000
 3779 multiletter control sequences out of 15000+600000
 3640 words of font info for 14 fonts, out of 8000000 for 9000
 957 hyphenation exceptions out of 8191
 23i,4n,19p,150b,46s stack positions out of 5000i,500n,10000p,200000b,80000s

No pages of output.
PDF statistics:
 0 PDF objects out of 1000 (max. 8388607)
 0 named destinations out of 1000 (max. 500000)
 1 words of extra memory for PDF output out of 10000 (max. 10000000)

4. The Problem Case + \clearpage

I thought this can maybe be solved by adding a \clearpage at the end of the document, but to no avail:

4.1. The MWE Code (with \clearpage)

\documentclass[twocolumn]{article}%
\usepackage{cuted}%
\usepackage{afterpage}%
\begin{document}%
\afterpage{%
\begin{strip}%
A B C%
\end{strip}%
}%
\clearpage%
\end{document}%

4.2. The Log File Produced by pdflatex

This is pdfTeX, Version 3.1415926-2.5-1.40.14 (TeX Live 2013/Debian) (format=pdflatex 2015.5.1)  13 JUL 2015 08:50
entering extended mode
 restricted \write18 enabled.
 %&-line parsing enabled.
**test
(./test.tex
LaTeX2e <2011/06/27>
Babel <3.9h> and hyphenation patterns for 78 languages loaded.
(/usr/share/texlive/texmf-dist/tex/latex/base/article.cls
Document Class: article 2007/10/19 v1.4h Standard LaTeX document class
(/usr/share/texlive/texmf-dist/tex/latex/base/size10.clo
File: size10.clo 2007/10/19 v1.4h Standard LaTeX file (size option)
)
\c@part=\count79
\c@section=\count80
\c@subsection=\count81
\c@subsubsection=\count82
\c@paragraph=\count83
\c@subparagraph=\count84
\c@figure=\count85
\c@table=\count86
\abovecaptionskip=\skip41
\belowcaptionskip=\skip42
\bibindent=\dimen102
)
(/usr/share/texlive/texmf-dist/tex/latex/lipsum/lipsum.sty
Package: lipsum 2011/04/14 v1.2 150 paragraphs of Lorem Ipsum dummy text
\c@lips@count=\count87
)
(/usr/share/texlive/texmf-dist/tex/latex/sttools/cuted.sty
Package: cuted 2012/10/04 v1.5 Mixing onecolumn and twocolumn modes
\At@ViperColsBreak=\toks14
\v@aaa=\box26
\v@ccc=\box27
\lastskip@a=\skip43
\lastskip@b=\skip44
\lastskip@d=\skip45
\lastbox@a=\box28
\stripsep=\skip46
\@viper=\box29
\viper@penalty=\count88
\hold@viper=\box30
\ht@viper=\dimen103
) (./afterpage.sty
Package: afterpage 2014/10/28 v1.08 After-Page Package (DPC)
\AP@output=\toks15
\AP@partial=\box31
\AP@footins=\box32
)
(./test.aux)
\openout1 = `test.aux'.

LaTeX Font Info:    Checking defaults for OML/cmm/m/it on input line 5.
LaTeX Font Info:    ... okay on input line 5.
LaTeX Font Info:    Checking defaults for T1/cmr/m/n on input line 5.
LaTeX Font Info:    ... okay on input line 5.
LaTeX Font Info:    Checking defaults for OT1/cmr/m/n on input line 5.
LaTeX Font Info:    ... okay on input line 5.
LaTeX Font Info:    Checking defaults for OMS/cmsy/m/n on input line 5.
LaTeX Font Info:    ... okay on input line 5.
LaTeX Font Info:    Checking defaults for OMX/cmex/m/n on input line 5.
LaTeX Font Info:    ... okay on input line 5.
LaTeX Font Info:    Checking defaults for U/cmr/m/n on input line 5.
LaTeX Font Info:    ... okay on input line 5.
Extra height:0.0pt when 0.0pt
(2)Left:0.0pt Right:0.0pt Output:0.0pt
- LAST -
Left:0.0pt
Right:0.0pt
Output:0.0pt
 (./test.aux) )
Here is how much of TeX's memory you used:
 435 strings out of 493304
 5019 string characters out of 6139872
 144451 words of memory out of 5000000
 3970 multiletter control sequences out of 15000+600000
 3640 words of font info for 14 fonts, out of 8000000 for 9000
 957 hyphenation exceptions out of 8191
 23i,4n,19p,151b,52s stack positions out of 5000i,500n,10000p,200000b,80000s

No pages of output.
PDF statistics:
 0 PDF objects out of 1000 (max. 8388607)
 0 named destinations out of 1000 (max. 500000)
 1 words of extra memory for PDF output out of 10000 (max. 10000000)

5. The Problem Case + \strut\clearpage

Interestingly, if I add a \strut before the \clearpage, I get an ! LaTeX Error: Not in outer par mode.:

5.1. The MWE Code + \strut\clearpage

\documentclass[twocolumn]{article}%
\usepackage{cuted}%
\usepackage{afterpage}%
\begin{document}%
\afterpage{%
\begin{strip}%
A B C%
\end{strip}%
}%
\strut\clearpage%
\end{document}%

5.2. The Log File Produced by pdflatex

This is pdfTeX, Version 3.1415926-2.5-1.40.14 (TeX Live 2013/Debian) (format=pdflatex 2015.5.1)  13 JUL 2015 09:37
entering extended mode
 restricted \write18 enabled.
 %&-line parsing enabled.
**test
(./test.tex
LaTeX2e <2011/06/27>
Babel <3.9h> and hyphenation patterns for 78 languages loaded.
(/usr/share/texlive/texmf-dist/tex/latex/base/article.cls
Document Class: article 2007/10/19 v1.4h Standard LaTeX document class
(/usr/share/texlive/texmf-dist/tex/latex/base/size10.clo
File: size10.clo 2007/10/19 v1.4h Standard LaTeX file (size option)
)
\c@part=\count79
\c@section=\count80
\c@subsection=\count81
\c@subsubsection=\count82
\c@paragraph=\count83
\c@subparagraph=\count84
\c@figure=\count85
\c@table=\count86
\abovecaptionskip=\skip41
\belowcaptionskip=\skip42
\bibindent=\dimen102
)
(/usr/share/texlive/texmf-dist/tex/latex/sttools/cuted.sty
Package: cuted 2012/10/04 v1.5 Mixing onecolumn and twocolumn modes
\At@ViperColsBreak=\toks14
\v@aaa=\box26
\v@ccc=\box27
\lastskip@a=\skip43
\lastskip@b=\skip44
\lastskip@d=\skip45
\lastbox@a=\box28
\stripsep=\skip46
\@viper=\box29
\viper@penalty=\count87
\hold@viper=\box30
\ht@viper=\dimen103
) (./afterpage.sty
Package: afterpage 2014/10/28 v1.08 After-Page Package (DPC)
\AP@output=\toks15
\AP@partial=\box31
\AP@footins=\box32
)
(./test.aux)
\openout1 = `test.aux'.

LaTeX Font Info:    Checking defaults for OML/cmm/m/it on input line 4.
LaTeX Font Info:    ... okay on input line 4.
LaTeX Font Info:    Checking defaults for T1/cmr/m/n on input line 4.
LaTeX Font Info:    ... okay on input line 4.
LaTeX Font Info:    Checking defaults for OT1/cmr/m/n on input line 4.
LaTeX Font Info:    ... okay on input line 4.
LaTeX Font Info:    Checking defaults for OMS/cmsy/m/n on input line 4.
LaTeX Font Info:    ... okay on input line 4.
LaTeX Font Info:    Checking defaults for OMX/cmex/m/n on input line 4.
LaTeX Font Info:    ... okay on input line 4.
LaTeX Font Info:    Checking defaults for U/cmr/m/n on input line 4.
LaTeX Font Info:    ... okay on input line 4.


! LaTeX Error: Not in outer par mode.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...

l.10 \strut\clearpage
                     %
? x

Here is how much of TeX's memory you used:
 255 strings out of 493304
 3012 string characters out of 6139872
 52890 words of memory out of 5000000
 3795 multiletter control sequences out of 15000+600000
 3640 words of font info for 14 fonts, out of 8000000 for 9000
 957 hyphenation exceptions out of 8191
 23i,1n,19p,150b,36s stack positions out of 5000i,500n,10000p,200000b,80000s
No pages of output.
PDF statistics:
 0 PDF objects out of 1000 (max. 8388607)
 0 named destinations out of 1000 (max. 500000)
 1 words of extra memory for PDF output out of 10000 (max. 10000000)

6. Reasons

I need to figure out how to get this work for my figureSeries package.

This question is related to Float(s) lost: Problem (Possible) from afterpage + double-column: I use the strip environment from cuted as a replacement of my old layout routine for which I could not get the Float(s) lost to disappear.

  • I'm not surprised that afterpage and cuted are conflicting, because both try to change the output routine. My impression is that you simply want to use figure* that will insert the material as a two column object at the top of the next page. – egreg Jul 13 '15 at 6:59
  • I'm not surprised either, but I have little other options (and my LaTeX is much weaker than either Prof. Carlisle's or Prof. Tolušis') ^_^ ... Anyway, Prof. Tolušis sent me a quick fix suggestion via email. In my case, it seems to work. Once he has verified it deeper with his package, he may either choose to post it here (or I will do it for him later). – Thomas Weise Jul 13 '15 at 7:08
  • No, I want more: My (now much better working) figureSeries allows you to have something like a page-breaking figure* working both in one- and two-column documents. It can contain arbitrarily many sub-figures. If you have more sub-figures than what fits on a page, it will break over to the next page. This is needed because I programmatically generate LaTeX documents and don't know the number of sub-figures in advance (and I do not want to replicate LaTeX's layout engine in my program to determine how to break the figure series automatically into several figure*s automatically). – Thomas Weise Jul 13 '15 at 7:12

Your Answer

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

Browse other questions tagged or ask your own question.