6

I'm using the article class. When creating a new part, I would like to change "Part 1" to "Experiment 1", "Part 2" to "Experiment 2" and so on, followed by my part title. How can I do that?

I've found this question, but the answers didn't work for me In Lyx, how to change the "Part" section to "Chapter"?

Thank you! :)

Edit: This is my preamble:

\usepackage[version=3]{mhchem}
\date{}
\usepackage{fancyhdr}
\usepackage{titlesec}
\setlength{\headheight}{15.2pt}
\pagestyle{fancy}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
\lhead[]{}
\rhead[]{}
\lhead[]{}
\rhead[]{}
\lfoot[\thepage]{}
\rfoot[]{\thepage}
\renewcommand{\partname}{Experiment}%added later

EDIT: The \renewcommand{\partname}{Experiment} line works fine with the language set to English, but i need to make this work in other languages, because now if I add the toc it's called "Contents", while I need an italian "Indice".

Edit: self-answer (for all who may find this helpful): use \renewcommand\contentsname{Indice} to change "Content" to "Indice" or whatever.

5
  • 1
    Have you tried \renewcommand{\partname}{Experiment}?
    – Corentin
    Commented Aug 29, 2013 at 17:06
  • In the preamble right? It doesn't work... I've added my preamble in the question. Commented Aug 29, 2013 at 17:19
  • 1
    Welcome to TeX.SX! You can have a look on our starter guide to familiarize yourself further with our format. Commented Aug 29, 2013 at 17:21
  • See if tex.stackexchange.com/questions/119117/… helps. Commented Aug 29, 2013 at 17:38
  • Thank you Werner and @Corentin! The preamble code works but I had to set the language to english first (I had it set to italian). Commented Aug 30, 2013 at 6:46

2 Answers 2

10

LyX just provides an interface (or front end) to LaTeX. So, while you may see

Part I  Some text

as your title inside the editor view, the LaTeX code associated with it

\part{Some text}

will output

Experiment I  Some text

if you add

\renewcommand{\partname}{Experiment}

to your preamble (Document > Settings... > LaTeX Preamble). If you wish to change this in the editor as well (so the visual matches the PDF output), you need to edit the stdsections.inc layout file; specifically the part style:

Style Part
  Category               Section
  Margin                 Dynamic
  LabelString            "Part \thepart"
  LabelType              Counter
  ...

You would have to update LabelString to read "Experiment \thepart" instead.

6
  • it does not work for me... my document language is English, so this is not the problem. do you know what it is? Commented Nov 26, 2018 at 14:18
  • @bobsacameno: You should provide enough information so one can replicate your issue. I can't with just the statement you provided.
    – Werner
    Commented Nov 26, 2018 at 16:22
  • sorry, I thought it was a common issue that an obvious fix is known. I have LyX Version 2.2.2 (10 October 2016), on a Mac. My TeX distribution is Full TeX Live 2015 Distribution V271. What other information should I provide? Commented Nov 29, 2018 at 8:06
  • It works due to this answer: tex.stackexchange.com/questions/119117/…, by adding \AtBeginDocument{% ... } to wrap the command in this answer. Commented Dec 20, 2018 at 16:25
  • Is it possible to update the view in the editor by adding a line to a custom my.layout file instead of changing stdsections.inc? Like an override?
    – Nick
    Commented Mar 2, 2019 at 19:14
0

You need to change the babel settings for your language, in your case is italian so an example is:

\addto\captionsitalian{% \renewcommand{\partname}% {Volume}% }

You must log in to answer this question.

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