Text FormattingPage w/ different numbering position and other stuff

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
fja
Posts: 24
Joined: Mon Dec 07, 2009 2:10 am

Page w/ different numbering position and other stuff

Post by fja »

Hi!!

I'm writing my thesis, and I have (only) two questions:
1. I need all the pages of the Intro (index, etc) numbered with roman (not Roman) centered in the bottom of the page, and the rest of the document (starting in \mainmatter) numbered with arabic in rigth position, top of the page. How could I do this??? I already know how to switch between roman/Roman/arabic, and I've tried something like this (but doesn't work):

Code: Select all

\renewpagestyle{plain}{%
  \sethead{}{}{\thepage}
  \setfoot{}{}{}
  }
and switching the \thepage, but it doesn't work (all the text results with the same first number position).

2. The chapters must be numbered with Romans (not roman), but within the sections, in arabic: (for example):
IV. Chapter 4
4.1. Section 1 (of the chapter 4)
4.1.1. Subsection…
4.1.1.1. …

How can I do this??

Finally, how can I produce an unnumbered page???

Thanks for your help!!

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

achim
Posts: 49
Joined: Wed Aug 05, 2009 2:29 pm

Page w/ different numbering position and other stuff

Post by achim »

You can customize the layout of the header and foot line with the fancyhdr package. I believe you could change the layout at anytime (check the documentation).

This *.pdf is a nice compilation which contains general hints on formatting...

In order to change the chapter numbering to Roman, copy the following line in your preamble:

Code: Select all

\def\thechapter{\Roman{chapter}}
OS: Kubuntu
Distribution: TexLive
Editor: Kile
User avatar
frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

Page w/ different numbering position and other stuff

Post by frabjous »

To answer a question like this, we need more information, such as what document class you're using, and so on. What would really speed things up is to provide a minimal working example we could modify to make work.
fja
Posts: 24
Joined: Mon Dec 07, 2009 2:10 am

Page w/ different numbering position and other stuff

Post by fja »

Ok, (I apologize about the delay…)
I'm using a MacTex2009, under MacOsX 10.6.4

And the code is:

Code: Select all

\documentclass[letterpaper,12pt,oneside]{book}
\usepackage[spanish,es-lcroman]{babel}
\usepackage{amsmath,appendix}
\usepackage{graphicx}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{color}
\usepackage[all]{xy}
\usepackage{setspace,mathrsfs,amsfonts,amssymb}
\usepackage{anysize}
\usepackage{tocbibind}
\usepackage{lscape}
\usepackage{multirow,array,paralist,longtable}
\usepackage[pdftex]{graphicx}


%\marginsize{3.7cm}{2.3cm}{2.3cm}{2.3cm}dimensiones texto: largo 25.4cm; ancho 16.1 cm
\usepackage[version=3]{mhchem}
\usepackage[pagestyles]{titlesec}
\renewpagestyle{plain}{%
  \sethead{}{}{}
  \setfoot{}{\thepage}{}
  }
 %\usepackage[numbered,framed]{mcode}==PARA ESCRIBIR CODIGO DE PROGRAMAS: LINEAS NUMERADAS CON UN MARCO. SE DEBE USAR 
 %\begin{lstlisting}


\pagestyle{plain}
\newcommand{\cur}{\emph} 	% escribir en cursiva
\newcommand{\n}{\textbf}		% escribir en negrita
\usepackage{fancyhdr} 

 \setlength{\parskip}{.5cm} %deja 0.5 cm entre parrafo
\setlength{\textwidth}{16.1cm}
 \setlength{\textheight}{23.44cm}
\addtolength{\hoffset}{1cm}
\addtolength{\voffset}{-0.8cm}
%% \setlength{\hoffset}{1cm}
% \setlength{\marginparwidht}{4.0cm}
% \setlenght{\voffset}{-1.5cm}
% \setlenght{\topmargin}{0.1cm}
% \setlenght{\headheight}{0.1cm}
% \setlenght{\headsep}{1.5cm}
 
 \newcommand{\HRule}{\rule{\linewidth}{0.7mm}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\renewcommand{\rmdefault}{phv} % Arial
\renewcommand{\sfdefault}{phv} % Arial
\sffamily
\renewcommand\contentsname{ÍNDICE}
\renewcommand\listfigurename{ÍNDICE DE F{}IGURAS}
\renewcommand\listtablename{ÍNDICE DE TABLAS}
\renewcommand{\bibname}{BIBLIOGRAFÍA}
\renewcommand{\tablename}{Tabla}
\onehalfspacing
%\doublespacing
\newpage
\titleformat{\chapter}
  {\center\normalfont\LARGE\bfseries}{\thechapter.}{0.5em}{}
\titlespacing*{\chapter} 
{16pt}{-2\baselineskip}{1\baselineskip}
%\maketitle
\input{./caratula.tex}%ESTA ES LA CARATULA
\renewcommand{\headrulewidth}{0.0pt}
\pagenumbering{roman}
\setcounter{page}{1}
\newpage
\tableofcontents
\newpage
\listoffigures
\newpage
\listoftables
\newpage

%\addtocontents{toc}{\contentsline {section}{\numberline {}Resumen}{}}

\mainmatter
\pagenumbering{arabic}
\setcounter{page}{1}
\renewpagestyle{plain}{%
  \sethead{}{}{\thepage}
  \setfoot{}{}{}
  }
\include{marco_teorico}
\end{document}
So, what I'm trying to do is, in the first part, use the following code:

Code: Select all

\renewpagestyle{plain}{%
  \sethead{}{}{}
  \setfoot{}{\thepage}{}
  }
and for the \mainmatter:

Code: Select all

\renewpagestyle{plain}{%
  \sethead{}{}{\thepage}
  \setfoot{}{}{}
  }
But, of course, it doesn't work!! I tried with

Code: Select all

\thispagestyle{plain}{
\sethead{}{}{}
  \setfoot{}{\thepage}{}
  }
for each page, but doesn't work either.

And, for the chapter numbering issue, I don't know what to do!!
User avatar
frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

Page w/ different numbering position and other stuff

Post by frabjous »

I do wish you had clicked the link I had given describing how to construct a minimal working example. A minimal example is just that: minimal. It shouldn't load packages and include commands that have nothing to do with your question. More importantly, it shouldn't use \include or \input commands to include subdocuments that others do not have access to. What is someone supposed to do with your code when it cannot be compiled? How is someone supposed to answer your question when they don't know how commands in those subdocuments might affect the situation? See the Post on Avoidable Mistakes.

Hence, what I have below is mainly just a guess about what you may want.

Some observations:
  • On a mac, it's unlikely that you should be using latin1 encoding; it's more likely that you're using UTF8 (Unicode).
  • You load the graphicx package twice. Take out the second call to it. These days it's usually better to let the driver (pdftex) be automatically detected rather than load it as an option.
  • You're loading both titlesec and fancyhdr, two different packages that affect headers and footers. You should choose one or the other and stick with it. Since the commands you mentioned are titlesec commands, perhaps we should stick to those.
  • The \frontmatter command automatically makes page numbers roman style, so you don't need to explicitly turn that on. The \mainmatter command automatically resets the numbering to 1 and switches to arabic numbers, so there's no need to manually do this.
  • Normally, plain style is only used for the first page of a chapter, so if you want it for every page, you need to use the \pagestyle{plain} command; you had, but I think you needed to re-do it after \mainmatter.
  • Below is some sample code that as far as I can tell produces the desired result. (Note that the lipsum package and \lipsum commands are not part of the solution, but are just there to produce filler text.)

Code: Select all

\documentclass[letterpaper,12pt,oneside]{book}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

\usepackage{lipsum} % for generating filler text

\usepackage[pagestyles]{titlesec}
\renewpagestyle{plain}{%
  \sethead{}{}{}
  \setfoot{}{\thepage}{}
  }

\pagestyle{plain}

\renewcommand{\thechapter}{\Roman{chapter}}
\renewcommand{\thesection}{\arabic{chapter}.\arabic{section}}

\begin{document}
\frontmatter
\chapter{Dedication}
\lipsum[1-4] % filler text
\chapter{Preface}
\lipsum[20-22]
\newpage
\tableofcontents
\newpage
\listoffigures
\newpage
\listoftables

\mainmatter
\renewpagestyle{plain}{%
  \sethead{}{}{\thepage}
  \setfoot{}{}{}
  }
\pagestyle{plain}
\chapter{First one}
\section{A section}
\lipsum[1-5]
\section{Another section}
\lipsum[51-52]
\subsection{A subsection}
\lipsum[57-59]
\chapter{Another one}
\section{Its section}
\lipsum[6-12]
\section{Yet another section}
\lipsum[13-16]
\end{document}
fja
Posts: 24
Joined: Mon Dec 07, 2009 2:10 am

Page w/ different numbering position and other stuff

Post by fja »

frabjous wrote:I do wish you had clicked the link I had given describing how to construct a minimal working example. …
I'm sorry, you're right. (but this was a very busy week… :oops:)

Fortunately (for me), with your help I could solve my problems!!!! Thank you very much :D :D
Post Reply