Multiple Columns - Overleaf, Online LaTeX Editor PDF
Multiple Columns - Overleaf, Online LaTeX Editor PDF
Multiple columns
Two-column documents can be easily created by passing the parameter \twocolumn to the
document class statement. If you need more exibility in the column layout, or to create a
document with multiple columns, the package multicol provides a set of commands for that.
This article explains how to import and use that package.
Contents
1. Introduction
2. Column separation
3. Unbalanced columns
4. Inserting oating elements
5. Inserting vertical rulers
6. Further reading
Introduction
A exible tool to handle multicolumn documents in LATEX is multicol, as used in the
following example:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{multicol}
\begin{document}
\begin{multicols}{3}
[
\section{First Section}
All human things are subject to decay. And when fate summons,
Monarchs must obey.
]
Hello, here is some text without a meaning. This text should show
what
a printed text will look like at this place.
If you read this text, you will get no information. Really? Is
there
no information? Is there...
\end{multicols}
\end{document}
To import the package, the line
\usepackage{multicol}
is added to the preamble. Once the package is imported, the environment multicols can be
used. The environment takes two parameters:
Number of columns. This parameter must be passed inside braces, and its value is 3 in
the example.
"Header text", which is inserted in between square brackets. This is optional and will
be displayed on top of the multicolumn text. Any LATEX command can be used here,
except for oating elements such as gures and tables. In the example, the section title
and a small paragraph are set here.
The text enclosed inside the tags \begin{multicols} and \end{multicols} is printed in
multicolumn format.
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{multicol}
\setlength{\columnsep}{1cm}
\begin{document}
\begin{multicols}{2}
[
\section{First Section}
All human things are subject to decay. And when fate summons,
Monarchs must obey.
]
Hello, here is some text without a meaning. This text should show
what
a printed text will look like at this place.
If you read this text, you will get no information. Really? Is
there
no information? Is there...
\end{multicols}
\end{document}
Here, the command \setlength{\columnsep}{1cm} sets the column separation to 1cm.
See Lengths in LaTeX (/learn/Lengths_in_LaTeX) for a list of available units.
Unbalanced columns
In the default multicols environment the columns are balanced so each one contains the
same amount of text. This default format can be changed by the stared environment
multicols*:
\begin{multicols*}{3}
[
\section{First Section}
All human things are subject to decay. And when fate summons,
Monarchs must obey.
]
Hello, here is some text without a meaning. This text should show
what
a printed text will look like at this place.
If you read this text, you will get no information. Really? Is
there
no information? Is there...
\end{multicols*}
\end{document}
In this case the text is printed in a column till the end of the page is reached, then the in
continues in the next column and so on.
Open an example of the multicols package in Overleaf
(https://www.sharelatex.com/project/new/template?
zipUrl=/project/535bfe1742dd0d0775cc7d7e/download/zip&templateName=Multiple%2
0Columns%202&compiler=pd atex)
Hello, here is some text without a meaning. This text should show
what
a printed text will look like at this place.
If you read this text, you will get no information. Really? Is
there
no information? Is there.
\vfill
\begin{wrapfigure}{l}{0.7\linewidth}
\includegraphics[width=\linewidth]{./lion-logo.jpg}
\caption{This is the former Share\LaTeX{} logo}
\end{wrapfigure}
A blind text like this gives you information about the selected font,
how
the letters are written and an impression of the look. This text
should
contain all...
\begin{wraptable}{l}{0.7\linewidth}
\centering
\begin{tabular}{|c|c|}
\hline
Name & ISO \\
\hline
Afghanistan & AF \\
Aland Islands & AX \\
Albania &AL \\
Algeria &DZ \\
American Samoa & AS \\
Andorra & AD \\
Angola & AO \\
\hline
\end{tabular}
\caption{Table, floating element}
\label{table:ta}
\end{wraptable}
\end{multicols}
\end{document}
Floats in the multicol package are poorly supported in the current version. Elements
inserted with the conventional figure* and table* environments will show up only at the
top or bottom of the next page after they are inserted, and will break the layout. The
example presented here is a workaround, but you may expect some rough edges. For
instance, if the oat width is set to \linewidth it causes a weird text overlapping. This said,
below is a brief description of the commands:
\usepackage{wrapfig}. Put this line in the preamble to import the package wrap g
The environment wrapfigure will insert a gure wrapped in the text. For more
information and further examples about this environment see Positioning images and
tables (/learn/Positioning_images_and_tables).
The environment wraptible is the equivalent to wrap gure but for tables. See
Positioning images and tables (/learn/Positioning_images_and_tables) for more
information.
\usepackage{multicol}
\usepackage{color}
\usepackage{comment}
\setlength{\columnseprule}{1pt}
\def\columnseprulecolor{\color{blue}}
\begin{document}
\begin{multicols}{3}
[
\section{First Section}
All human things are subject to decay. And when fate summons,
Monarchs must obey.
]
Hello, here is some text without a meaning. This text should show
what
a printed text will look like at this place.
\columnbreak
\end{document}
As you see, the column separator can be set to a speci c colour also. Below a description of
each command:
\usepackage{color}.
This line is inserted in the preamble to enable the use of several colours within the
document.
\setlength{\columnseprule}{1pt}
This determines the width of the ruler to be used as column separator, it's set to 0 by
default. In the example a column whose width is 1pt is printed.
\def\columnseprulecolor{\color{blue}}
The colour of the separator ruler is set to blue. See the article about using colours in LATEX
(/learn/Using_colours_in_LaTeX) for more information on colour manipulation.
\columnbreak
This command inserts a column breakpoint. In this case, the behaviour of the text is
different from what you may expect. The column break is inserted, then the paragraphs
before the breakpoint are evenly distributed to ll all available space. In the example, the
second paragraph is at the bottom of the column and a blank space is inserted in between
the second and the rst paragraphs.
Open an example of the multicols package in Overleaf
(https://www.sharelatex.com/project/new/template?
zipUrl=/project/535bfe1742dd0d0775cc7d7e/download/zip&templateName=Multiple%2
0Columns%202&compiler=pd atex)
Further reading
For more information see:
Overleaf guides
Creating a document in Overleaf (/learn/Kb/Creating_a_document_in_Overleaf)
Uploading a project (/learn/Kb/Uploading_a_project)
Copying a project (/learn/Kb/Copying_a_project)
Creating a project from a template (/learn/Kb/Creating_a_project_from_a_template)
Using the Overleaf project menu (/learn/Kb/Using_the_Overleaf_project_menu)
Including images in Overleaf (/learn/Kb/Including_images_in_ShareLaTeX)
Exporting your work from Overleaf (/learn/Kb/Exporting_your_work_from_ShareLaTeX)
Working of ine in Overleaf (/learn/Kb/Working_Of ine_in_Overleaf_v2)
Using Track Changes in Overleaf (/learn/Kb/Track_Changes_in_Overleaf_v2)
Using bibliographies in Overleaf (/learn/Kb/Using_bibliographies_in_ShareLaTeX)
Sharing your work with others (/learn/Kb/Sharing_your_work_with_others)
Using the History feature (/learn/Using_the_History_feature)
Debugging Compilation timeout errors (/learn/Kb/Debugging_Compilation_timeout_errors)
How-to guides (/learn/Kb/Knowledge_Base)
LaTeX Basics
Creating your rst LaTeX document (/learn/Creating_a_document_in_LaTeX)
Choosing a LaTeX Compiler (/learn/Choosing_a_LaTeX_Compiler)
Paragraphs and new lines (/learn/Paragraphs_and_new_lines)
Bold, italics and underlining (/learn/Bold,_italics_and_underlining)
Lists (/learn/Lists)
Errors (/learn/Errors)
Mathematics
Mathematical expressions (/learn/Mathematical_expressions)
Subscripts and superscripts (/learn/Subscripts_and_superscripts)
Brackets and Parentheses (/learn/Brackets_and_Parentheses)
Matrices (/learn/Matrices)
Fractions and Binomials (/learn/Fractions_and_Binomials)
Aligning Equations (/learn/Aligning_equations)
Operators (/learn/Operators)
Spacing in math mode (/learn/Spacing_in_math_mode)
Integrals, sums and limits (/learn/Integrals,_sums_and_limits)
Display style in math mode (/learn/Display_style_in_math_mode)
List of Greek letters and math symbols (/learn/List_of_Greek_letters_and_math_symbols)
Mathematical fonts (/learn/Mathematical_fonts)
Languages
Multilingual typesetting on Overleaf using polyglossia and fontspec
(/learn/Multilingual_typesetting_on_Overleaf_using_polyglossia_and_fontspec)
Multilingual typesetting on Overleaf using babel and fontspec
(/learn/Multilingual_typesetting_on_Overleaf_using_babel_and_fontspec)
International language support (/learn/International_language_support)
Quotations and quotation marks (/learn/Typesetting_quotations)
Arabic (/learn/Arabic)
Chinese (/learn/Chinese)
French (/learn/French)
German (/learn/German)
Greek (/learn/Greek)
Italian (/learn/Italian)
Japanese (/learn/Japanese)
Korean (/learn/Korean)
Portuguese (/learn/Portuguese)
Russian (/learn/Russian)
Spanish (/learn/Spanish)
Document structure
Sections and chapters (/learn/Sections_and_chapters)
Table of contents (/learn/Table_of_contents)
Cross referencing sections and equations (/learn/Cross_referencing_sections_and_equations)
Indices (/learn/Indices)
Glossaries (/learn/Glossaries)
Nomenclatures (/learn/Nomenclatures)
Management in a large project (/learn/Management_in_a_large_project)
Multi- le LaTeX projects (/learn/Multi- le_LaTeX_projects)
Hyperlinks (/learn/Hyperlinks)
Formatting
Lengths in LATEX (/learn/Lengths_in_LaTeX)
Headers and footers (/learn/Headers_and_footers)
Page numbering (/learn/Page_numbering)
Paragraph formatting (/learn/Paragraph_formatting)
Line breaks and blank spaces (/learn/Line_breaks_and_blank_spaces)
Text alignment (/learn/Text_alignment)
Page size and margins (/learn/Page_size_and_margins)
Single sided and double sided documents (/learn/Single_sided_and_double_sided_documents)
Multiple columns (/learn/Multiple_columns)
Counters (/learn/Counters)
Code listing (/learn/Code_listing)
Code Highlighting with minted (/learn/Code_Highlighting_with_minted)
Using colours in LaTeX (/learn/Using_colours_in_LaTeX)
Footnotes (/learn/Footnotes)
Margin notes (/learn/Margin_notes)
Fonts
Font sizes, families, and styles (/learn/Font_sizes,_families,_and_styles)
Font typefaces (/learn/Font_typefaces)
Supporting modern fonts with XƎLATEX (/learn/XeLaTeX)
Presentations
Beamer (/learn/Beamer)
Powerdot (/learn/Powerdot)
Posters (/learn/Posters)
Commands
Commands (/learn/Commands)
Environments (/learn/Environments)
Field speci c
Theorems and proofs (/learn/Theorems_and_proofs)
Chemistry formulae (/learn/Chemistry_formulae)
Feynman diagrams (/learn/Feynman_diagrams)
Molecular orbital diagrams (/learn/Molecular_orbital_diagrams)
Chess notation (/learn/Chess_notation)
Knitting patterns (/learn/Knitting_patterns)
CircuiTikz package (/learn/CircuiTikz_package)
Pgfplots package (/learn/Pgfplots_package)
Typing exams in LaTeX (/learn/Typing_exams_in_LaTeX)
Knitr (/learn/Knitr)
Attribute Value Matrices (/learn/Attribute_Value_Matrices)
Class les
Understanding packages and class les (/learn/Understanding_packages_and_class_ les)
List of packages and class les (/learn/List_of_packages_and_class_ les)
Writing your own package (/learn/Writing_your_own_package)
Writing your own class (/learn/Writing_your_own_class)
Tips (/learn/Tips)
Advanced TeX/LaTeX
In-depth technical articles on TeX/LaTeX (/learn/Articles)