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.

Arch Stanton
  • 1,497

2 Answers2

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.

Werner
  • 603,163
  • 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 08:06
  • It works due to this answer: https://tex.stackexchange.com/questions/119117/translate-paragraph-environment, 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 02 '19 at 19:14
  • @Nick: I'm sufficiently unfamiliar with LyX setup to not know whether that's possible or not. Sorry. – Werner Mar 02 '19 at 19:29
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}% }