要清楚的是,一般情况下可以让它工作,而且我已经在最小文档中让它工作了。但是,我就是无法让它在我的实际论文中工作。我没有成功创建一个真正的最小问题示例,因此我将转储一个简短的示例,其中包含我的整个序言和基本上整个文档结构:
%% LyX 2.2.0 created this file. For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclass[12pt,english,ngerman,openany]{book}
\usepackage{helvet}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[charter,expert]{mathdesign}
\usepackage[a4paper]{geometry}
\geometry{verbose,tmargin=2.5cm,lmargin=4.5cm,rmargin=3.5cm,headheight=15mm}
\usepackage{fancyhdr}
\pagestyle{fancy}
\usepackage{refstyle}
\usepackage{float}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage[demo]{graphicx}
\usepackage{setspace}
\onehalfspacing
\makeatletter
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LyX specific LaTeX commands.
\AtBeginDocument{\providecommand\figref[1]{\ref{fig:#1}}}
\AtBeginDocument{\providecommand\eqref[1]{\ref{eq:#1}}}
\AtBeginDocument{\providecommand\subsecref[1]{\ref{subsec:#1}}}
\AtBeginDocument{\providecommand\algref[1]{\ref{alg:#1}}}
\AtBeginDocument{\providecommand\secref[1]{\ref{sec:#1}}}
\AtBeginDocument{\providecommand\tabref[1]{\ref{tab:#1}}}
%% Because html converters don't know tabularnewline
\providecommand{\tabularnewline}{\\}
\floatstyle{ruled}
\newfloat{algorithm}{tbp}{loa}[chapter]
\providecommand{\algorithmname}{Algorithmus}
\floatname{algorithm}{\protect\algorithmname}
\RS@ifundefined{subsecref}
{\newref{subsec}{name = \RSsectxt}}
{}
\RS@ifundefined{thmref}
{\def\RSthmtxt{theorem~}\newref{thm}{name = \RSthmtxt}}
{}
\RS@ifundefined{lemref}
{\def\RSlemtxt{lemma~}\newref{lem}{name = \RSlemtxt}}
{}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Textclass specific LaTeX commands.
\numberwithin{equation}{section}
\numberwithin{figure}{section}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
\usepackage{XCharter}
\usepackage{lipsum}
\usepackage{babel}
\usepackage[tracking,kerning=true,letterspace=60,babel]{microtype}
\usepackage[dvipsnames]{xcolor}
\usepackage{pstricks}
\usepackage{siunitx}
\usepackage{placeins}
\usepackage{mdframed}
\usepackage{csquotes}
\usepackage[width=0.85\textwidth]{caption}
\usepackage{quoting}
\usepackage{varioref}
\usepackage[style=numeric,backend=biber,isbn=false,url=true,doi=true]{biblatex}
\usepackage[toc,page]{appendix}
\usepackage[calcwidth]{titlesec}
\usepackage[unicode=true,pdfusetitle,
bookmarks=true,bookmarksnumbered=false,bookmarksopen=false,
breaklinks=false,pdfborder={0 0 1},backref=false,colorlinks=false,hidelinks=true]
{hyperref}
%%%%%%%%%%%5
%Setup units
%%%%%%%%%%
\sisetup{copy-decimal-marker}
\DeclareSIUnit[number-unit-product=\,]\rpm{rpm}
\captionsetup[figure]{font=small,labelfont=bf,textfont=sl}
%%%%%%%%%%%
%Custom figures
%%%%%%%%%%%%
\let\figoldstart\figure
\let\figoldend\endfigure
\renewenvironment*{figure}[1][btph]{\figoldstart[#1]{}\begin{mdframed}[userdefinedwidth=0.9\textwidth{},align=center]\bgroup\centering}{\egroup\end{mdframed}\figoldend{}}
%%%%%%%%
%Bibliography
%%%%%%%%%%%%%5
\addbibresource{literatur.bib}
%%%%%%%
%Custom section formats
%%%%%%%%%%
%\newcommand{\chapterbreak}{\clearpage}
\titleformat{\chapter}[block]
{\filcenter\Large\scshape}
{\Huge\rmfamily\bfseries\color{Mahogany}\thechapter}
{0.5em}
{}
[{
\begingroup
\setlength{\titlewidth}{0.88\textwidth}
\titleline*[c]{\titlerule[.3pt]}
\endgroup
\addvspace{3pt}
\begingroup
\color{Mahogany}
\setlength{\titlewidth}{0.44\textwidth}
\titleline*[c]{\titlerule[0.5pt]}
\endgroup
\addvspace{2pt}
\begingroup
\setlength{\titlewidth}{0.66\textwidth}
\titleline*[c]{\titlerule[.3pt]}
\endgroup
}]
\titlespacing*{\chapter}{0pt}{-1\baselineskip}{\baselineskip}
\newcommand*{\spacedUpCase}[1]{\textls{\MakeUppercase{#1}}}
\titleformat{\section}{\sffamily\large}{{\fcolorbox{White}{Mahogany}{\color{White}\rmfamily\itshape\thesection}}}{0.5em}{\spacedUpCase}%\textls{\MakeUppercase{#1}}}
\titlespacing*{\section}{0pt}{1.5\baselineskip}{1ex}
\newcommand*{\dashafter}[1]{#1\ ---}
\titleformat{\subsection}[block]{\bfseries\centering}{\thesubsection}{0.5em}{}[]
\titlespacing*{\subsection}{0pt}{2ex}{0.5ex}
\titleformat{\subsubsection}[runin]{\itshape}{\thesubsubsection}{0pt}{}[\,{\color{Mahogany}\Large--}]
\titlespacing{\subsubsection}{0pt}{\baselineskip}{1.5ex}
%%%%%%%%%
%Custom references
%%%%%%%%%%%%
\newref{fig}{refcmd={\textsl{Abbildung~\textsf{\ref{#1}}}~\vpageref{#1}}}
\newref{sec}{refcmd={Abschnitt \textbf{\ref{#1}}}}
\newref{subsec}{refcmd={\textsl{Abschnitt~\textsf{\ref{#1}}}}}
\newref{alg}{refcmd={\textsl{Algorithmus~\textsf{\ref{#1}}}~\vpageref{#1}}}
\newref{eq}{refcmd={\textsl{Gleichung~\textsf{\ref{#1}}}}}
\setcounter{errorcontextlines}{9999}
%%%%%%%%%%%%%5
%Custom quotes
%%%%%%%%%%%%
\newcommand*{\boldopenquote}{{\color{Mahogany}\upshape\textbf{,,}}}
\newcommand*{\boldendquote}{{\color{Mahogany}\fontshape{n}\fontseries{b}\selectfont\textquotedblright}}
\quotingsetup{font=itshape,begintext=\boldopenquote,endtext=\boldendquote}
\renewenvironment*{quote}{\begin{quoting}}{\end{quoting}}
\renewenvironment*{quotation}{\begin{quoting}}{\end{quoting}}
%header spacing
\setlength{\headsep}{\baselineskip}
%appendix name
\renewcommand*{\appendixpagename}{Anhang}
\renewcommand*{\appendixtocname}{\appendixpagename}
%%%%%%%%%%%%%%
%Page header setup macro
%%%%%%%%%%%%
\newcommand*{\pghdrsetup}[0]{
\fancyhead[LE]{\includegraphics[width=15mm, height=8mm]{logo}\hspace{2mm} \textit{\small Max Mustermann}}
\fancyhead[RO]{ \textit{\small Max Mustermann }\hspace{2,25mm} \includegraphics[width=15mm, height=8mm]{logo}}
\fancyhead[RE,LO]{}
\chead{\scshape\small Title of \\my Thesis}
\fancyheadoffset[LR]{2cm}}
\fancypagestyle{plain}{\pghdrsetup}
%%%%%%%%%%%%%%%%
%prevent empty pages
%%%%%%%%
\let\cleardoublepage\clearpage
%%%%%%%%%%%%
%microtype extra settings
%%%%%%%%%%
\SetExtraKerning[inputenc=utf8]{encoding={*}, family={bch}}{„={,1000},\textquotedblright={1000,}}
\makeatother
\usepackage{babel}
\addto\captionsenglish{\renewcommand{\algorithmname}{Algorithm}}
\addto\captionsngerman{\renewcommand{\algorithmname}{Algorithmus}}
\begin{document}
\raggedbottom{}\newgeometry{left=3cm,right=3cm,top=2cm,bottom=2cm}\begin{titlepage}
\begin{center}
\includegraphics[width=4cm]{logo}\bigskip{}
\par\end{center}
\begin{center}
\linespread{1.2}\Huge Title of my thesis
\par\end{center}
\vspace*{1.5em}
\begin{singlespace}
\begin{center}
{\large{}Max Mustermann}
\par\end{center}{\large \par}
\begin{center}
\textsf{\large{}\today}
\par\end{center}{\large \par}
\end{singlespace}
\vfill{}
\begin{center}
\includegraphics[width=7.5cm]{something}
\par\end{center}
\medskip{}
\begin{singlespace}
{\centering\large\textls[250]{\textsc{Thesis}}\par}
\end{singlespace}
\medskip{}
{\centering Additional Stuff here (omitted)\par}
\vfill{}
\end{titlepage}\restoregeometry{}
\frontmatter\lipsum[1]
\newpage{}
\lipsum[1]\newpage{}
%\pagestyle{plain}
%\pagenumbering{Roman}
\tableofcontents{}
\pagebreak{}
\mainmatter
\pagestyle{fancy}
\pghdrsetup
\chapter{A frustraing excercise in Latex}
\section{Why won't this freaking work?}
\subsection{Lo and behold}
\lipsum[1]
\selectlanguage{english}%
\begin{quotation}
Some quotation goes here, not that short in size either\@. Not long enough to use lipsum however\@. Unfortunately kerning doesn't work\@.
\end{quotation}
\selectlanguage{ngerman}%
\lipsum[1]
\noindent %\backmatter
\printbibliography
\appendix
\pagebreak{}
%\rhead{Anhang}
\appendixpage
\end{document}
另一方面,在这个最小的例子中,它似乎工作得很好
\documentclass[english,ngerman]{book}
\usepackage[charter]{mathdesign}
\usepackage{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{XCharter}
\usepackage[kerning,babel]{microtype}
\usepackage[dvipsnames]{xcolor}
\usepackage{quoting}
\newcommand*{\boldopenquote}{{\color{Mahogany}\upshape\textbf{,,}}}
\newcommand*{\boldendquote}{{\color{Mahogany}\fontshape{n}\fontseries{b}\selectfont\textquotedblright}}
\quotingsetup{font=itshape,begintext=\boldopenquote,endtext=\boldendquote}
\SetExtraKerning[inputenc=utf8]{encoding={*}, font={bch}, series={b}}{„={,1000},\textquotedblright={1000,}}
\begin{document}
\selectlanguage{english}%
\begin{quoting}
lorem ipsum
\end{quoting}
\end{document}
我只是不知道我的实际文档中存在什么问题。我正在使用最新的 MikTex。如果能提供任何建议我将不胜感激。
答案1
您在工作示例中使用了font={bch}
。这是错误的键语法,会导致警告,但实际上会被忽略:
Package microtype Warning: family axis is empty in font specification
(microtype) `bch////'. Using `XCharter-TLF' instead on input line 38.
在非工作示例中,您使用了正确的键,family
但值是错误的bch
。正确的应该是family=XCharter-TLF
。