I use the "report" document class for a document written in swedish (that's got åäöÅÄÖ). I also use the babel-package for swedish. It works as supposed, but now LaTeX has troubles hyphenating some of my special words, so I had to add this:
\hyphenation{
nät-spänn-ing
nät-spänn-ing-ar
lik-spänn-ing
spänn-ing
spänn-ing-en
belys-nings-lamp-orna
}
However, to hyphenate swedish words I also need to add:
\usepackage[T1]{fontenc}
otherwise I got some fatal errors, and google told me to use the above line.
But, when using T1, all åäöÅÄÖ are stripped away from every chapter name in the whole document. The document itself still has åäöÅÄÖ, but chapter names are gone.
Question: How do I add special hyphenation rules for swedish words without breaking the section names containing swedish characters?
(see updated question at the bottom)
EDIT
My question was incomplete as it lacks proper examples. Here's a screenshot of the error in question:
This is the source:
% -*- latex -*-
\documentclass[12pt,a4paper,twoside]{report}
\newif\iflargephoto
\largephototrue
\usepackage{xjobb}
\usepackage[T1]{fontenc}
\hyphenation{
nät-spänn-ing
nät-spänn-ing-ar
lik-spänn-ing
spänn-ing
spänn-ing-en
belys-nings-lamp-orna
}
\usepackage[swedish]{babel} % date format and hyphenation rules(?)
\selectlanguage{swedish}
\usepackage[utf8]{inputenc}
\begin{document}%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\pagenumbering{arabic}
\chapter{Swedish chars: å and ä and ö}
Swedish chars: å and ä and ö
\end{document}
If I remove the line \usepackage[T1]{fontenc}
then the swedish characters can be seen in the chapter heading, but then the \hyphenation{}
breaks completely:
! Improper \hyphenation will be flushed.
\leavevmode ->\unhbox
\voidb@x
l.12 nä
t-spänn-ing
! Not a letter.
\leavevmode ->\unhbox \voidb@x
l.12 nä
t-spänn-ing
! Improper \hyphenation will be flushed.
[...lots of repeated errors cut away...]
The fancy chapter names are obviously generated by the package xjobb
(swedish slang for "ex-jobb", which is "thesis"). Removing this and åäöÅÄÖ can be seen in the chapter names, but the look is awfully boring so I really do not want to remove it.
I have not written, nor touched, the xjobb
-package. A lot of other people at my university has used it for their thesis, but the difference here is that they wrote it in English and never had my problem, and that's probably why no-one has noticed the errors.
The xjobb
-package is quite small so I add it here:
% START xjobb-package
%
% Package file with options making me feel better...
% (Author: Stefan Langemark)
%
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{xjobb}[1999/04/16 Class setup for xjobb]
\RequirePackage{parskip}
\RequirePackage{geometry}
\RequirePackage[utf8]{inputenc}
\RequirePackage{fancyhdr}
%
%--------------------------------
% Paper layout
% (no room for margin notes)
%--------------------------------
%
% paper=b5paper,
\geometry{
paperwidth = 165mm, paperheight = 240mm,
% paper = a4paper,
total = {130mm,220mm},
% marginparsep = 2mm,
% marginparwidth = 15mm,
includemp = false,
%twosideshift = 10pt
}
\addtolength{\headheight}{3pt}
%-------------------------------
% Header/Footer
%-------------------------------
\renewcommand{\headrulewidth}{0.4pt}
\fancyhf{}
\fancyhead[LO]{\bfseries\rightmark}
\fancyhead[RE]{\bfseries\leftmark}
\fancyhead[RO,LE]{\bfseries\thepage}
\pagestyle{fancy}
%\pagestyle{plain}
\fancypagestyle{plain}{%
\fancyhf{}%
\renewcommand{\headrulewidth}{0pt}
}
%
%-------------------------------
% Redefining section styles
% to suit parskip > 0
%-------------------------------
%
%\addtocounter{secnumdepth}{1}% Number subsubsections too
%\addtocounter{tocdepth}{1}% Include subsections in table of contents.
\renewcommand\section{\@startsection%
{section}%
{1}%
{\z@}%
{-2.5ex \@plus -1ex \@minus -.2ex}%
{1.3ex \@plus.2ex}%
{\normalfont\Large\bfseries}%
}
\renewcommand\subsection{\@startsection%
{subsection}%
{2}%
{\z@}%
{-2.25ex\@plus -1ex \@minus -.2ex}%
{0.5ex \@plus .2ex}%
{\normalfont\large\bfseries}%
}
\renewcommand\subsubsection{\@startsection%
{subsubsection}%
{3}%
{\z@}%
{-2.25ex\@plus -1ex \@minus -.2ex}%
{0.1pt \@plus .2ex}%
{\normalfont\mdseries\large\itshape}%
}
%
%-------------------------------------
% Redefine {chapter,section}mark to
% remove ugly all-uppercase
%-------------------------------------
%
\renewcommand{\chaptermark}[1]{\markboth{\chaptername\ \thechapter.\enspace #1}{}}
\renewcommand{\sectionmark}[1]{\markright{\thesection\enspace #1}}
%
%
\renewcommand\tableofcontents{%
\if@twocolumn
\@restonecoltrue\onecolumn
\else
\@restonecolfalse
\fi
\chapter*{\contentsname}%
\markboth{\contentsname}{\contentsname}%
\@starttoc{toc}%
\if@restonecol\twocolumn\fi
}
\renewcommand\listoffigures{%
\if@twocolumn
\@restonecoltrue\onecolumn
\else
\@restonecolfalse
\fi
\chapter*{\listfigurename}%
\markboth{\listfigurename}{\listfigurename}%
\@starttoc{lof}%
\if@restonecol\twocolumn\fi
}
\renewcommand\listoftables{%
\if@twocolumn
\@restonecoltrue\onecolumn
\else
\@restonecolfalse
\fi
\chapter*{\listtablename}%
\markboth{\listtablename}{\listtablename}%
\@starttoc{lot}%
\if@restonecol\twocolumn\fi
}
%
%-------------------------------------------
% Chapter (stolen from Kluwer book style)
%-------------------------------------------
%
\font\chapnumber=cmbx10 at 50pt %% chapter number
%\font\chaptitle=cmbx10 scaled\magstep3 %% chapter title
\font\chaptitle=cmbx10 at 20pt %% chapter title
\def\bigraggedleft{\leftskip0pt plus1fil\relax}
\def\@makechapterhead#1{%\null\vskip-5pc
\vbox to 14pc{\hbox to\textwidth{\hfill\chapnumber\thechapter}
\hyphenpenalty=10000 % No hyphenation in chapter heads
\vskip8pt
\hrule height 1.5pt
\vskip12pt\vskip-\parskip
\def\\ {\vskip-\parskip}\parfillskip=0pt
\bigraggedleft
\LARGE\chaptitle{\def\\ {\vskip-\parskip}#1}\vskip1sp
\vfill}}
\def\@makeschapterhead#1{\vbox to 7.5pc{
\hrule height 1.5pt
\hyphenpenalty=10000 % No hyphenation in chapter heads
\vskip12pt\vskip-\parskip
\def\\ {\vskip-\parskip}\parfillskip=0pt
\LARGE\bigraggedleft
\chaptitle{#1}\vskip1sp\vfill}}
% END xjobb-package
Hopefully I have now gathered all the required information for this question, and I really hope I still can use the xjobb
-package because I really like the look of it.
So, question: Is it the xjobb
-package that breaks åäöÅÄÖ in the chapter names? If so, how can I rewrite it so it works?
\documentclass
and the appropriate packages that sets up the problem. While solving problems can be fun, setting them up is not. Then, those trying to help can simply cut and paste your MWE and get started on solving the problem.inputenc
package with the optionutf8
. Incidentally, ifbabel
is loaded with the optionswedish
, the only word that needs help in terms of finding valid hyphenation points isbelysningslamporna
; the other five words get hyphenated correctly without further help ifbabel
is loaded with the optionswedish
.