Page Layout ⇒ \previouspage command?
-
- Posts: 6
- Joined: Tue Mar 29, 2011 7:25 pm
\previouspage command?
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!
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?
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
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
-
- Posts: 6
- Joined: Tue Mar 29, 2011 7:25 pm
Re: \previouspage command?
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
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Re: \previouspage command?
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
-
- Posts: 6
- Joined: Tue Mar 29, 2011 7:25 pm
Re: \previouspage command?
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
\previouspage command?
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}
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
-
- Posts: 6
- Joined: Tue Mar 29, 2011 7:25 pm
Re: \previouspage command?
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
\previouspage command?
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}
Nicola Talbot
Creating a Minimal Example: http://www.dickimaw-books.com/latex/minexample/
-
- Posts: 6
- Joined: Tue Mar 29, 2011 7:25 pm
\previouspage command?
This is a promising solution! Now how do I work with full page-width tables (see the image)? Also, this is causing issues with text not staying inside the column, as shown here:
Thoughts?
Chad
\previouspage command?
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:climatologist wrote:Now how do I work with full page-width tables (see the image)?
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}
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.Also, this is causing issues with text not staying inside the column, as shown here:
Regards
Nicola Talbot
Creating a Minimal Example: http://www.dickimaw-books.com/latex/minexample/