2

This doesn't make any sense to me, but for some reason, \usepackage{babel} is causing \partname not to work as expected.

Here's a MWE. \renewcommand{\partname}{} should give an output text without the word "Pars"—just the Roman numeral and the name of the part. If I remove babel, it works fine.

Is there a way I can fix this?

\documentclass[12pt,openright]{book}
\usepackage{fontenc}[utf8]
\usepackage[english,main=latin]{babel}      

\renewcommand{\partname}{}

\begin{document}
\part{Pīrāta Veterānus}
\end{document}
3
  • 1
    at begin document babel sets everything up for the main language so latin here. You need to use the babel features to redefine the latin partname to empty, or do the simple overwrite after begin document so after babel has installed the latin version Commented May 16, 2020 at 22:06
  • Does it produce \partname=PARS? :-)
    – Bernard
    Commented May 16, 2020 at 22:45
  • @Bernard It does. Commented May 16, 2020 at 23:48

1 Answer 1

2

You modify the fixed word by doing

\addto\extraslatin{\renewcommand{\partname}{}}

Your attempt doesn't work, because \begin{document} issues \selectlanguage{latin}, which sets \partname to “Pars” unless modified.

However, this is not a particularly good way to remove the word, because it wouldn't remove the space.

\documentclass[12pt,openright]{book}
\usepackage[T1]{fontenc}
\usepackage[english,main=latin]{babel}

\addto\extraslatin{\renewcommand{\partname}[1]{}}

\begin{document}
\part{Pīrāta Veterānus}
\end{document}

enter image description here

Compare with the result if you just use \renewcommand{\partname}{}:

enter image description here

Sorry for the images with different size, but check the alignment and you'll see that in the latter picture the I is moved to the right.

The book class only uses \partname in the definition of \@part. This is however not guaranteed to work with other packages such as titlesec.


The line \usepackage{fontenc}[utf8] is meaningless. I changed it to \usepackage[T1]{fontenc}.

You possibly wanted to do \usepackage[utf8]{inputenc}, but this is no longer needed on recent TeX distributions.

3
  • Thank you so much (for both answers)! Commented May 16, 2020 at 22:15
  • In another document I did the same thing with chapters by adding \renewcommand{\chaptername}. Does that cause the same problem (not removing the space), and, if it does, what do you suggest as a solution? Commented May 16, 2020 at 22:27
  • @JoelDerfner Knowing the context would be important.
    – egreg
    Commented May 16, 2020 at 22:32

You must log in to answer this question.

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