4

Here is a working example

\documentclass{book}
\usepackage[utf8]{inputenc}  
\linewidth 150mm    
\usepackage[spanish]{babel}

\usepackage{soul}               
\sodef\secso{\scshape}{.125bp}{0.33em plus.1em minus.1em}{0.33em plus.1em minus.1em}

\let\secso\scshape

\usepackage{titlesec}            
\newcommand{\secformat}[1]{\parbox[t]{\linewidth}{%
    \Large\selectfont
    \filright{{\secso{#1}}}}}
\titleformat{\section}[hang]{\filright}{}{}{\secformat}
\titlespacing*{\section}{0pt}{26pt}{13pt}

\def\thesection {\relax}         
\setcounter{secnumdepth}{0}

\begin{document}
\pagestyle{plain}
\selectlanguage{spanish}

\noindent Test text.

\section{Observation}

\noindent Test text 2.

\section{Observación}

\noindent Test text 3.

\end{document}

It works well. But when I take out the command \let\secso\scshape with the aim to use the soul definition of \secso , the second title does not work. The letter ó leads to an error:

! Argument of \UTFviii@two@octets has an extra }.

            \par 

l.34 \section{Observación}

What is the best/simplest solution to this problem?

Thank you very much in advance for any help. It is for the Spanish translation of my free Motion Mountain Physics book, and the issue is holding up the translation.

P.S. The file is stored as UTF-8. The latest version of soul is used.

  • 1
    This is a well known problem with soul, try the soulutf8 package, or consider using the microtype interface instead as that works on the font level where as soul is on a macro level. – daleif Apr 01 '20 at 14:08
  • There is no error with UTF-8 engines (I tested XeTeX and LuaTeX). Not sure what it is useful for, though... Besides, setting \linewidth this way doesn't seem right. The geometry package is usually fine for these things. – frougon Apr 01 '20 at 14:13

2 Answers2

3

As daleif posted, \usepackage{soulutf8} solves the problem.

Vincent
  • 20,157
0

You could use the command \'o for ó. There are also similar commands for different accents.

Someone
  • 539