3

I have chapters numbered with roman numerals and sections numbered with arabic numbers (starting from 1 for each new section, i.e. section I.3, section II.3, section III.3 - and so on - are all just displayed as "section 3").

I had to format my thesis in this way to comply to the guidelines of the Faculty and I did that by including these line in the preamble:

\renewcommand{\chaptername}{Capitolo}
\renewcommand{\thechapter}{\Roman{chapter}}
\renewcommand*\thesection{\arabic{section}}

Yet, given that - for example - section II.3 is labelled \label{sec:chap2sec3}, I'd like to have in the text something like "see section II.3" when in the code I write "see section \ref{sec:chap2sec3} (instead of just "see section 3" as I get at the moment).

What would be the easiest way to achieve this? Thanks in advance!

4
  • Package \cleveref and \cref{sec:chap2sec3}, but your labelling scheme is not really useful, in my point of view. As soon as the order of your sections etc. change sec3 isn't sec3 any longer.
    – user31729
    Commented Mar 11, 2017 at 16:55
  • Seee also for an example of more sophisticated approaches: tex.stackexchange.com/questions/353491/…
    – user31729
    Commented Mar 11, 2017 at 16:57
  • Apparently I'm confused about something. Does "external pressures" mean "must have chapters numbered with roman numerals and sections numbered with arabic numbers"? Or does "external pressures" mean "must have these three specific lines in the preamble"? Or something else?
    – Teepeemm
    Commented Mar 11, 2017 at 22:52
  • @teepeemm I edit the text, hope it's clearer now! Commented Mar 11, 2017 at 23:03

1 Answer 1

5

Here's the quick and dirty method, by changing the \p@section reference formatting macro to be prepended with \thechapter. and combining it with cleveref.

Note: \setcounter{section}{100} is just for testing purposes.

\documentclass{book}


\renewcommand{\chaptername}{Capitolo}
\renewcommand{\thechapter}{\Roman{chapter}}
\renewcommand*\thesection{\arabic{section}}

\makeatletter
\renewcommand{\p@section}{\thechapter.}
\makeatother

\usepackage{cleveref}


\begin{document}

See \cref{Foosection} for more information

\chapter{Other chapter}

\chapter{Foo} 

\setcounter{section}{100}
\section{Foo section} \label{Foosection}

\end{document}

enter image description here

Update The version without cref

\documentclass{book}


\renewcommand{\chaptername}{Capitolo}
\renewcommand{\thechapter}{\Roman{chapter}}
\renewcommand*\thesection{\arabic{section}}

\makeatletter
\renewcommand{\p@section}{\thechapter.}
\makeatother

\begin{document}

See \ref{Foosection} for more information

\chapter{Other chapter}

\chapter{Foo} 

\setcounter{section}{100}
\section{Foo section} \label{Foosection}

\end{document}
7
  • Is there a reason to prefer this over \renewcommand{\thesection}{\thechapter.\arabic{section}}?
    – Teepeemm
    Commented Mar 11, 2017 at 17:16
  • @Teepeemm: You will find the reason in the question. Don't blame me for requests done by O.P. or thesis boards or whatever ;-)
    – user31729
    Commented Mar 11, 2017 at 17:17
  • @ChristianHupfer Thanks very much! I don't understand the need for the "\setcounter{section}{100}" line: infact, what I wanted is best achieved by eliminating it. Only problem is that, instead of e.g. "I.3", "section I.3" is displayed when I write "\cref{label:chap2sec3}". How can I eliminate the word "section"? Commented Mar 11, 2017 at 18:02
  • @luciadefinetti: The \setcounter{section}{100} was just for testing purposes. And your question says see section II.3 ... so \cref{...} does explicitly add the word section to it. If you don't need this, don't write see section II.3 in your question ;-) Replace \cref by the ordinary \ref then.
    – user31729
    Commented Mar 11, 2017 at 18:09
  • 1
    Thanks very much @ChristianHupfer and, yes, my mistake! :-) Commented Mar 11, 2017 at 18:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .