Page Layout\previouspage command?

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
climatologist
Posts: 6
Joined: Tue Mar 29, 2011 7:25 pm

\previouspage command?

Post by climatologist »

Howdy,

I have a \documentclass[twocolumn]{article} that I'm using with pdflatex. The top half of the first page needs to be a single column. I have achieved this by \onecolumn. The bottom half of the first page and the rest of the document should be two columns. This is accomplished with the \twocolumn command, except that \twocolumn forces a pagebreak.

Is there a command akin to \previouspage or \undopagebreak that I can put in after \twocolumn so the bottom half of my first page is not blank?

I realize I could use a multicolumn environment, but the drawbacks in formatting floats outweigh its benefits. Alternatively, if someone can explain to me in detail (I'm a bit of a latex novice) how to later \twocolumn to suppress its inherent page break, that may help. I'm using Kile on Ubuntu, if that's relevant.

Thanks!
Last edited by climatologist on Fri Apr 01, 2011 7:22 pm, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

\previouspage command?

Post by localghost »

Try another approach. Set up your document with a single column and use the multicol package. See code below for a short example. For more details refer to the package manual.

Code: Select all

\documentclass[11pt,a4paper,english]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{multicol}
\usepackage{blindtext}

\begin{document}
  \blindtext

  \begin{multicols}{2}
    \blindtext
  \end{multicols}
\end{document}

Best regards and welcome to the board
Thorsten
climatologist
Posts: 6
Joined: Tue Mar 29, 2011 7:25 pm

Re: \previouspage command?

Post by climatologist »

Hi Thorsten,

Thank you for your response. Unfortunately, your suggested change results in a warning that floats are not allowed inside a multicols environment. My figures and floats are handled beautifully when I use the \onecolumn and \twocolumn combination, whereas I'd have to exit the multicols environment for every figure to manually place each one.

Any other tricks up your sleeve?

Thanks again,
Chad
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Re: \previouspage command?

Post by localghost »

You can insert floats that span both columns by using the starred versions of the known float environments.
climatologist
Posts: 6
Joined: Tue Mar 29, 2011 7:25 pm

Re: \previouspage command?

Post by climatologist »

How about single-column floats?
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

\previouspage command?

Post by localghost »

You can place figures and tables inside a single column, but you can't use float environments. The caption package provides the \captionof command which allows to add captions outside float environments. In principal such objects inside a column could look like shown below.

Code: Select all

\documentclass[11pt,a4paper,english]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage[font=small,labelfont=bf,tableposition=top]{caption}
\usepackage{multicol}
\usepackage{blindtext}

\begin{document}
  \blindtext

  \begin{multicols}{2}
    \blindtext

    \medskip
    \noindent
    \begin{minipage}{\linewidth}
      \centering
      \rule{0.75\linewidth}{0.5\linewidth}
      \captionof{figure}{Dummy figure}\label{fig:dummy}
    \end{minipage}
    \medskip

    \blindtext

    \medskip
    \noindent
    \begin{minipage}{\linewidth}
      \captionof{table}{Dummy table}\label{tab:dummy}
      \centering
      \rule{0.75\linewidth}{0.5\linewidth}
    \end{minipage}

    \medskip
    \blindtext
  \end{multicols}
\end{document}
climatologist
Posts: 6
Joined: Tue Mar 29, 2011 7:25 pm

Re: \previouspage command?

Post by climatologist »

I don't know if we're zeroing in on a solution or getting further from it. Minipages won't float--they are placed exactly where they lie in the text. I suspect that the the \onecolumn and \twocolumn route still may be best for my article because multicols won't allow single-column floats. Manually placing a dozen figures after every revision of my article could add up to several days of tedium over the course of this paper.

Due to the pagebreak inherent with the \twocolumn command, following it with a command that would write overtop of the previous page would be a great solution. No such command?

Chad
User avatar
nlct
Posts: 276
Joined: Thu Nov 06, 2008 11:15 am

\previouspage command?

Post by nlct »

You could try the flowfram package:

Code: Select all

\documentclass{article}

\usepackage{flowfram}
\usepackage{lipsum}% dummy text for sample document

% Frames for page 1:
\twocolumntop[1]{flow}{0.5\textheight}

% set up 2 columns for page 2 onwards:
\twocolumn[>1] 

\begin{document}

\lipsum[1-2]

% Needed to move to a columns with different width from 
% the previous column:
\framebreak

\lipsum

\end{document}
Regards
Nicola Talbot
climatologist
Posts: 6
Joined: Tue Mar 29, 2011 7:25 pm

\previouspage command?

Post by climatologist »

Nicola,

This is a promising solution! Now how do I work with full page-width tables (see the image)?
table-full-width.png
table-full-width.png (87.55 KiB) Viewed 6793 times
Also, this is causing issues with text not staying inside the column, as shown here:
columns-problem.png
columns-problem.png (22.88 KiB) Viewed 6793 times

Thoughts?
Chad
User avatar
nlct
Posts: 276
Joined: Thu Nov 06, 2008 11:15 am

\previouspage command?

Post by nlct »

climatologist wrote:Now how do I work with full page-width tables (see the image)?
You can't use the usual column spanning floats with flowfram as the columns have arbitrary numbers, dimensions and locations (as opposed to standard two column layout). The only way to achieve it is to create a different frame layout for the pages requiring the wide float and have a wide static or dynamic frame to put the table in. Modifying the example code I gave:

Code: Select all

\documentclass{article}

\usepackage{flowfram}
\usepackage{lipsum}% dummy text for sample document

% Frames for page 1

\twocolumntop[1]{flow}{0.5\textheight}

\twocolumn[2-4,>5] % set up 2 columns for given page list

% Wide table on page 5:

\twocolumntop[5]{dynamic}{0.2\textheight}% adjust height to fit table

% Give dynamic frame a label to make it easier to identify:

\setdynamicframe{1}{label=table1}

\begin{document}

\lipsum[1-2]

% Needed to move to a columns with different width from 
% the previous column:
\framebreak

\lipsum[3-22]

\setdynamiccontents*{table1}{%
  \begin{statictable}
  \centering
  A very wide table
  \caption{Sample table}
  \end{statictable}
}

\lipsum[23-30]

\end{document}
Also, this is causing issues with text not staying inside the column, as shown here:
This is a problem that will happen with narrow columns. The narrower the column, the harder it is for TeX to work out the best place to break the lines.

Regards
Nicola Talbot
Post Reply