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.

  • 1
    Have you tried \renewcommand{\partname}{Experiment}? – Corentin Aug 29 '13 at 17:06
  • In the preamble right? It doesn't work... I've added my preamble in the question. – Arch Stanton Aug 29 '13 at 17:19
  • 1
    Welcome to TeX.SX! You can have a look on our starter guide to familiarize yourself further with our format. – Claudio Fiandrino Aug 29 '13 at 17:21
  • See if tex.stackexchange.com/questions/119117/… helps. – Torbjørn T. Aug 29 '13 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). – Arch Stanton Aug 30 '13 at 6:46
9

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.

  • it does not work for me... my document language is English, so this is not the problem. do you know what it is? – bobsacameno Nov 26 '18 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 Nov 26 '18 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? – bobsacameno Nov 29 '18 at 8:06
  • It works due to this answer: tex.stackexchange.com/questions/119117/…, by adding \AtBeginDocument{% ... } to wrap the command in this answer. – bobsacameno Dec 20 '18 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 Mar 2 at 19:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.