Have one page "normal" while using twocolumn documentclass option - latex

I'm using this configuration in my Latex document:
\documentclass[a4paper,landscape, twocolumn, 10pt]{article}
I'm using twocolumn because I want to have two columns on every page. But now I want to have one page (only one) with only one column (as if I didn't use the twocolumn option) and have the remainder of the document with two columns.

You can issue \onecolumn which will force a page break and start typesetting with the usual one column. When you are finished, issue \twocolumn, which will issue anothe page break and resume typesetting with two columns.
If you don't want page breaks, look at Frank Mittelbach's multicol package.
There's more Latex expertise at tex.stackexchange.com than here, these days.

Related

How to count the page number using Arabic numbers from the first page in Latex

I recently got a template for my report. It has a cls file defining several attributes of the template. However, I found that the table of contents and abstract are numbered using Roman numbers rather than the Arabic numbers.
My intention is to count the page number from the first page using Arabic numbers, including the cover page, the abstract and the table of contents. I guess I should modify the cls file or add some new commands but I have no idea how to do. I would be grateful if you could help me !
For documentclasses that work similar to the standard classes, you can put
\mainmatter
after \begin{document} to switch to Arabic numerals and avoid restarting the numbering.
(before you do that, check with the guidelines for your report. The numbering you currently have is actually pretty much the standard in many countries)
After \begin{document} (or in the document preamble), issue
\renewcommand{\thepage}{\roman{page}}% Roman page numbers
On the page where you want it to change to Arabic numbering, use
\renewcommand{\thepage}{\arabic{page}}% Arabic page numbers

Last-page column equalization for latex IEEEtran class?

In the documentation for the IEEEtran LaTeX class, it's mentioned that the two columns on the last page need to be manually adjusted in order to be balanced (have the same length).
I see that \newpage will allow me to break the first column so the rest of the content is on the second column. This allows for paragraph-level equalization, and looks good, but I'm having trouble with line-level equalization, that is, breaking the column by lines instead of by paragraphs.
When I insert \newpage in the middle of a paragraph (instead of between paragraphs), LaTeX effectively splits the paragraph in two. The second part goes to the top of the second column (as desired) and the first part remains in the first column. There are two issues I've found with this, and I've only solved one of them.
The first issue is that the partial paragraph on the top of the second column is treated by LaTeX as a new paragraph, so it's indented. I fixed this by adding \noindent after \newpage so that it's not indented.
The second issue is that for the partial paragraph in the first column, the paragraph is justified (as expected), but the last line is ragged (no justification). Is there a way to force justification of this last line? LaTeX has environments and commands to disable justification, but I can't find anything to fully justify a paragraph, including the last line.
Two possibilities:
Ending a line with \linebreak will force the line to be justified, no matter how empty it is.
To do what you are trying to do you could replace \newpage \noindent with \linebreak \newpage \noindent.
Note this will create a blank line before the end of the page, which may or may not be a problem. In certain cases it could create an empty page between your pages.
Another option would be \pagebreak. It tells LaTeX to start a new page when you get to the end of the current line. You don't have control of the exact word where the page break occurs.
What about making the last page (column) shorter using
\enlargethispage{-50mm}
and maybe forcing LaTeX to split after the appropriate line? Of course the amount of shortening should be guessed by trial and error, and re-guessed after changing the text. (Just an idea, may be impossible to implement in your case.)
(Posting for the googlers landing here)
The quickest solution is
\usepackage{pbalance}
(Package documentation at https://ctan.org/pkg/pbalance?lang=de)
In case that does not work, one can try the special command \IEEEtriggeratref{10}, which adds a column break before reference 10. Replace 10 by the actual number of the reference. See the documentation of IEEEtran, section "XIV. Last Page Column Equalization" for more details).
You can adjust the following lengths to make LaTeX fill the last line of a paragraph. Put this in your preamble:
\newcommand{\filllastline}[1]{
\setlength\leftskip{0pt}
\setlength\rightskip{0pt}
\setlength\parfillskip{0pt}
#1}
Then in your document do this:
\filllastline{The text for your partial para in 1st col goes here...}
(For future LaTeX questions you should probable post to https://tex.stackexchange.com/)

Smart page breaks to make chapters print modularly

I'm writing a booklet for my debate club in LyX, and it is a collection of Prep Cases - each prep case is a chapter. Currently I have a "new page" after every chapter, but I want something more - I want to make sure chapters begin in odd numbered pages, so that when I print the whole booklet in duplex - each prep case will be a standalone, separable unit. Is that possible in LyX or plain LaTeX?
Edit: silly me. I meant to say sections and not chapters. Is this possible with sections?
I'm not sure how to do this in Lyx, but if it will let you slip in some raw LaTeX, put this in your preamble:
\let\originalsection=\section
\renewcommand\section{\par\cleardoublepage\originalsection}
Normally, this is done using the openright option on the document class. This causes \chapter to use \cleardoublepage internally, thus starting on an odd page.
You can also use \cleardoublepage manually instead but just using the option is more convenient.
I am using the Exam class (based on Article) and I got this to work in LyX 2.2 with the following:
Document>Document Settings>Page Layout>Two-sided document
Insert>Formatting>Clear Double Page whenever you want to force a part of your document to start on an odd-numbered page.

manually define page numbers in latex?

I am editing a 100+ page document in latex, document class is "book".
The first few pages of the document have roman page numbers, the rest have arabic page numbers starting with one.
I.e. the document has page numbers i-iv, followed by pages 1-120.
However, want I want is the pages to be: vii-ix, followed by pages 1-120.
(reason: I am inserting some other PDF pages preceding the PDF ultimately generated by latex, and this obviously leads to all following page numbers beeing higher).
So how can I increase the roman page numbers to start from a higher number (but not increase the arabic page numbers at the samee time)?
Thank you.
You don't need to use \setcounter{page}{1} when arabic numbers start. This happens automatically:
\documentclass{book}
\begin{document}
\pagenumbering{roman}
\setcounter{page}{3}
a
\newpage
\pagenumbering{arabic}
b
\end{document}
has page iii followed by page 1.
use \setcounter{page}{7} after \begin{document} and if necessary \setcounter{page}{1} when the arabic page numbers start.
Try using the pdfpages package (CTAN), which allows you to insert PDF documents into your Latex document, and assign page numbers to them. You need to use this with pdftex.
Not very useful aside — if you used Context, you'd be able to add page numbers to the PDF document you import, as well as other decoration. But that is a big step away from Latex.
The book (and report) classes define \frontmatter, \mainmatter, and \backmatter, to switch the page style and handling of sectioning. In particular \frontmatter switches the page numbers to roman, and \mainmatter to arabic.
To account for unprinted pages at the beginning, you still have to use \setcounter{page}{7} before your front matter content.

Excluding a chapter from TOC

In my LaTeX document I've got a table of contents that is automatically generated by collecting everything that is of the form \chapter.
However, I've got an acknowledgements chapter before the table of contents and I don't want it to be automatically labelled "Chapter 1" or captured in the table of contents. Should I be avoiding \chapter altogether and use \section instead? I want to keep the font/formatting that other chapters have though.
The usual way to handle that kind of thing is with the \frontmatter command. Put it after the \begin{document}, and then put \mainmatter right before the \chapter you want to correspond to chapter 1. This may only work in the book class. If you're using \chapter in a report, then \chapter* should also create a chapter that has no number and won't show up in the table of contents.
Indeed, as unknown (google) mentioned, using \frontmatter and \mainmatter is the best solution. This will also adjust your page numbering to lowercase roman numerals for the front matter. However, it works only on book and similar document classes.
In case you're using report, try \chapter*. This will create a chapter without a number that does not appear in the table of contents.
For articles \chapter* does not appear to work. Instead use \section*.

Resources