LyXChange default Names like Part, Section, …

Information and discussion about LyX, a WYSIWYM editor, available for Linux, Windows and Mac OS X systems.
Post Reply
auvajs
Posts: 22
Joined: Wed Dec 21, 2011 11:21 pm

Change default Names like Part, Section, …

Post by auvajs »

Well I am new to LyX. The very first thing I wanted to do was to change some default keywords like part, section, subsection etc. I googled a lot and found that for changing the "Part" word I needed to insert this into the Preamble (my language is Czech).

Code: Select all

\addto\captionsczech{%
  \renewcommand{\partname}{Zmensenanecojinyhokurva}%
}
However, nothing at all happens!! (and it really sucks ...)
Last edited by auvajs on Sun Jan 15, 2012 4:13 pm, edited 2 times in total.

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

Stefan Kottwitz
Site Admin
Posts: 10324
Joined: Mon Mar 10, 2008 9:44 pm

Re: Change default Names like Part, Section, …

Post by Stefan Kottwitz »

Hi auvajs,

welcome to the board!

Perhaps post a small LyX example with your current configuration as attachment to a forum post, so we could investigate it.

Stefan
LaTeX.org admin
auvajs
Posts: 22
Joined: Wed Dec 21, 2011 11:21 pm

Change default Names like Part, Section, …

Post by auvajs »

my lyx version is:
lyx --version
LyX 1.6.5 (2009-12-05)
Built on Jan 28 2010, 10:19:59
Configuration
Host type: i486-pc-linux-gnu
Special build flags: aiksaurus warnings use-aspell use-ispell
C Compiler: gcc
C Compiler LyX flags:
C Compiler flags: -g -O2
C++ Compiler: g++ (4.4.3)
C++ Compiler LyX flags:
C++ Compiler flags: -g -O2
Linker flags:
Linker user flags: -Wl,-Bsymbolic-functions -Wl,-z,defs -Wl,--as-needed -Wl,-z,defs -Wl,--as-needed
Qt 4 Frontend:
Qt 4 version: 4.6.0
Packaging: posix
LyX binary dir: /usr/bin
LyX files dir: /usr/share/lyx

source code:

Code: Select all

% Preview source code

%% LyX 1.6.5 created this file.  For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclass[czech]{article}
\usepackage[T1]{fontenc}
\usepackage[latin2]{inputenc}

\makeatletter
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
\addto\captionsczech{\renewcommand{\partname}{asdfasdfasdf}} 

\makeatother

\usepackage{babel}

\begin{document}

\part{První část}

Here should I write something


\part{Druhá část}
\end{document}
User avatar
Stefan Kottwitz
Site Admin
Posts: 10324
Joined: Mon Mar 10, 2008 9:44 pm

Change default Names like Part, Section, …

Post by Stefan Kottwitz »

Hi auvajs,

the order is important, use \addto after babel is loaded, not before, such as

Code: Select all

\usepackage{babel}
\addto\captionsczech{\renewcommand{\partname}{the name}}
Stefan
LaTeX.org admin
auvajs
Posts: 22
Joined: Wed Dec 21, 2011 11:21 pm

Change default Names like Part, Section, …

Post by auvajs »

thank you Stefan but even if I change the code it doesn't work:

Code: Select all

% Preview source code

%% LyX 1.6.5 created this file.  For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclass[czech]{article}
\usepackage[T1]{fontenc}
\usepackage[latin2]{inputenc}

\makeatletter
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
\usepackage{babel}
\addto\captionsczech{\renewcommand{\partname}{the name}}

\makeatother

\usepackage{babel}

\begin{document}

\part{ první část}

sdfsdfsdf

sdfsdsdf

sdsdf
\end{document}
and LyX duplicates the \usepackage{babel} tag... (dunno why)
User avatar
Stefan Kottwitz
Site Admin
Posts: 10324
Joined: Mon Mar 10, 2008 9:44 pm

Change default Names like Part, Section, …

Post by Stefan Kottwitz »

It works for me with this code.

However, if it really doesn't work with \addto for you, you could simply use

Code: Select all

\renewcommand{\partname}{the name}
within an ERT box at the beginning of the document body, i.e. after \begin{document}.

Stefan
LaTeX.org admin
auvajs
Posts: 22
Joined: Wed Dec 21, 2011 11:21 pm

Change default Names like Part, Section, …

Post by auvajs »

Code: Select all

% Preview source code

%% LyX 1.6.5 created this file.  For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclass[czech]{article}
\usepackage[T1]{fontenc}
\usepackage[latin2]{inputenc}
\usepackage{babel}

\begin{document}
\renewcommand{\partname}{the name}


\part{aaa}
\end{document}
even this doesn't work... :( strange...
User avatar
Stefan Kottwitz
Site Admin
Posts: 10324
Joined: Mon Mar 10, 2008 9:44 pm

Re: Change default Names like Part, Section, …

Post by Stefan Kottwitz »

Because it works fine when I compile with LaTeX, it could be a good idea to post the text example in .lyx format here, as attachment. I remember just certain file extensions are allowed, perhaps rename to .txt if necessary.

Stefan
LaTeX.org admin
auvajs
Posts: 22
Joined: Wed Dec 21, 2011 11:21 pm

Re: Change default Names like Part, Section, …

Post by auvajs »

Well I upgraded to LyX 2.0.0 and now it works when exporting the document - but it still doesn't work in LyX itself :roll:
Post Reply