章节中的丹麦符号存在问题

章节中的丹麦符号存在问题

我尝试使用此代码,但丹麦符号“å”出现问题:

\documentclass[
  11pt,
  pagesize=auto,
  version=last,
  chapterprefix=true
  ]{scrbook}
\usepackage[danish]{babel}
\usepackage[babel=true]{csquotes}
\usepackage[T1]{fontenc}
\usepackage[explicit]{titlesec}
\usepackage{xcolor}
\usepackage{charter}

\definecolor{mybluei}{HTML}{999999}
\definecolor{myblueii}{HTML}{999999}

\newcommand\ChapterFont{\usefont{T1}{qhv}{b}{n}\selectfont\huge}
\newcommand\SectionFont{\usefont{T1}{qhv}{b}{n}\selectfont}

\titleformat{\chapter}[display]
  {\normalfont\ChapterFont\huge\color{myblueii}}
  {}
  {0pt}
  {\parbox[b]{70pt}{\mbox{}}%
    \parbox[b]{50pt}{\colorbox{mybluei}{%
      \parbox[b][60pt][t]{45pt}{\centering%
        \color{white}%
        {\itshape\rmfamily\small\chaptertitlename}%
        \vfill{\fontsize{50}{120}\selectfont\thechapter}%
        }%
      }%
    }\hspace{15pt}%
    \parbox[b]{\dimexpr\textwidth-150pt}{%
      \raggedright\scshape#1\vskip6pt%
    }%
  }

\titleformat{name=\chapter,numberless}[display]
  {\normalfont\ChapterFont\huge\color{myblueii}}
  {}
  {0pt}
  {\parbox[b]{70pt}{\mbox{}}%
    \hspace{15pt}%
    \parbox[b]{\dimexpr\textwidth-150pt}{%
      \raggedright\scshape#1\vskip6pt%
    }%
  }

\titleformat{\section}
  {\normalfont\small\sffamily\SectionFont\color{myblueii}}
  {\colorbox{mybluei}{%
    \parbox[c][16pt][c]{40pt}{%
      \centering\textcolor{white}{\SectionFont\Large\rmfamily\thesection}%
      }%
    }%
  }
  {1em}
  {#1}
  [\vspace{-1.2\baselineskip}%
    \color{myblueii}\hspace*{\dimexpr40pt+2\fboxsep\relax}%
    \rule{\dimexpr\textwidth-40pt-2\fboxsep\relax}{1pt}%
  ]

\begin{document}

\chapter{Her står kapitlet}

\section{Test sektion}

\end{document}

答案1

只需添加

\usepackage[utf8]{inputenc}

请注意,您发布的几乎所有代码都与问题无关。您的 MWE 应该只有几行。

章节

相关内容