Page LayoutCentering sections

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
Post Reply
adarpodracir
Posts: 2
Joined: Mon Feb 21, 2011 5:20 am

Centering sections

Post by adarpodracir »

Hi.

I am using article as document class to write a paper. But I need to put the sections at the center of the page. Is there any package/way to do that? Thank you!

Ricardo.

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

Frits
Posts: 169
Joined: Wed Feb 02, 2011 6:02 pm

Centering sections

Post by Frits »

This question is not very clear, since no minimal work example is provided..

I can think of two scenarios. First, you have the following stated in your preamble:

Code: Select all

\documentclass[twoside]{article}
If you remove the 'twoside' option, every page will be the same and you text will be pretty much centered.

The other scenario is that you'd like to recreate a Word document:

Code: Select all

\begin{document}
\centering
Random text here..
\end{document}
howtoTeX.com - Your LaTeX resource site (Tips, Tricks, Templates and more!)
Follow howtoTeX on twitter
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Centering sections

Post by localghost »

adarpodracir wrote:[…] But I need to put the sections at the center of the page. […]
Assumed that you mean section headings, you can do that very easy by the titlesec package. Details in the package manual.

Code: Select all

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

\titleformat{\section}{\normalfont\Large\bfseries\filcenter}{\thesection}{1em}{}

\begin{document}
  \blinddocument
\end{document}
The blindtext package is only for creating dummy text thus not part of the solution.


Best regards and welcome to the board
Thorsten
adarpodracir
Posts: 2
Joined: Mon Feb 21, 2011 5:20 am

Re: Centering sections

Post by adarpodracir »

Dear Frits. Sorry not to be clear. I don't know the latex's terminology yet. But thank you very much for your kind of help!

Dear localghost. Thank you very much. That was exactly what I was looking for! :D

Ricardo.
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Centering sections

Post by localghost »

adarpodracir wrote:[…] That was exactly what I was looking for! […]
Then please mark the topic accordingly as you have already been directed and as written in the Board Rules (to be read before posting).
Post Reply