我正在测试几个章节样式以使用kerkis
希腊语字体。奇怪的是,虽然我加载了包,但字体样式并没有在文档中传递。我的第一次尝试如下
它的代码是
%---------------- Square Box on Top Right Corner -----------------------
\documentclass{book}
\usepackage[margin=2.8cm,a4paper]{geometry}
\usepackage[english,greek]{babel}
\usepackage[iso-8859-7]{inputenc}
%\usepackage[utf8]{inputenc}
\usepackage{kerkis}
\usepackage{pifont}
\usepackage[explicit]{titlesec}
\usepackage{titletoc}
\usepackage{tikz}
\usepackage{epigraph}
\usepackage{xpatch}
\usepackage{lmodern}
\usepackage{lipsum}
\newlength\ChapWd
\settowidth\ChapWd{\huge\chaptertitlename}
\definecolor{myblue}{RGB}{0,0,122}
\titleformat{\chapter}[display]
{\normalfont\filcenter\sffamily}
{\tikz[remember picture,overlay]
{
\node[fill=myblue,font=\fontsize{60}{72}\selectfont\color{white},anchor=north east,minimum size=\ChapWd]
at ([xshift=-15pt,yshift=-15pt]current page.north east)
(numb) {\thechapter};
\node[rotate=90,anchor=south,inner sep=0pt,font=\huge] at (numb.west) {\chaptertitlename};
}
}{0pt}{\fontsize{33}{40}\selectfont\color{myblue}#1}[\vskip10pt\Large***]
\titlespacing*{\chapter}
{0pt}{50pt}{10pt}
\makeatletter
\xpatchcmd{\ttl@printlist}{\endgroup}{{\noindent\color{myblue}\rule{\textwidth}{1.5pt}}\vskip30pt\endgroup}{}{}
\makeatother
\newcommand\DoPToC{%
\startcontents[chapters]
\printcontents[chapters]{}{1}{\noindent{\color{myblue}\rule{\textwidth}{1.5pt}}\par\medskip}%
}
\setlength\epigraphrule{0pt}
\renewcommand\textflush{flushright}
\renewcommand\epigraphsize{\normalsize\itshape}
\begin{document}
%\selectfont{kekris}
\chapter{Title of the first chapter}
\epigraph{A brainy quote -- Its Author}{}
\DoPToC
\lipsum[4]
\section{A test section}
\lipsum[4]
\subsection{A test subsection}
\lipsum[4]
\subsection{A test subsection}
\lipsum[4]
\section{Another test section}
\lipsum[4]
\section{Yet another test section}
\lipsum[4]
\subsection{A test subsection}
\lipsum[4]
\subsection{A test subsection}
\lipsum[4]
\chapter{Title of the second chapter}
\DoPToC
\lipsum[4]
\section{A test section}
\lipsum[4]
\subsection{A test subsection}
\lipsum[4]
\subsection{A test subsection}
\lipsum[4]
\subsection{A test subsection}
\lipsum[4]
\section{Another test section}
\lipsum[4]
\subsection{A test subsection}
\lipsum[4]
\subsection{A test subsection}
\lipsum[4]
\end{document}
您可以看到,尽管正在加载kerkis
,但字体根本不是 kerkis。另一种样式也会出现同样的情况,如下图所示
那里,虽然chaptername
确实是 kerkis,但其他一切都是babel
的默认设置。代码如下
%------------------- Round Boxes ------------------------------
\documentclass{book}
\usepackage[english,greek]{babel}
\usepackage[iso-8859-7]{inputenc}
%\usepackage[utf8]{inputenc}
\usepackage{kerkis}
\usepackage{pifont}
\usepackage[explicit]{titlesec}
\usepackage{fourier}
%\usepackage{kerkis}
\usepackage{tikz}
\usepackage{epigraph}
\usepgflibrary{qrr.shapes.openrectangle}
\definecolor{mybluei}{RGB}{0,173,239}
\definecolor{myblueii}{RGB}{63,200,244}
\definecolor{myblueiii}{RGB}{199,234,253}
\tikzset{
mynode/.style={
rounded corners=30pt,
shape=open rectangle,
open rectangle fill=myblueii,
open rectangle sides=#1,
}
}
\titleformat{\chapter}[display]
{\normalfont\huge\sffamily}
{}
{20pt}
{%
\begin{tikzpicture}[remember picture,overlay]
\node[
anchor=west,
rectangle,
minimum height=4cm,
text width=\paperwidth,
xshift=-\the\dimexpr\oddsidemargin+1in\relax,
outer sep=0pt,
fill=myblueiii] (titlerect) {};
\node[
anchor=south west,
xshift=2cm,
text width=\textwidth]
at ([yshift=5pt]titlerect.south west) {\fontsize{30}{36}\selectfont#1};
\node[
mynode=nw,
anchor=south east,
fill=myblueii,
inner xsep=1.5cm,
outer sep=0pt,
font=\color{white},
minimum height=30pt]
at (current page.east|-titlerect.north)
{\bfseries\MakeUppercase{\chaptertitlename}\ \thechapter};
\end{tikzpicture}%
}
\titleformat{name=\chapter,numberless}[display]
{\normalfont\huge\sffamily}
{}
{20pt}
{%
\begin{tikzpicture}[remember picture,overlay]
\node[
anchor=west,
rectangle,
minimum height=4cm,
text width=\paperwidth,
xshift=-\the\dimexpr\oddsidemargin+1in\relax,
outer sep=0pt,
fill=myblueiii] (titlerect) {};
\node[
anchor=south west,
xshift=2cm,
text width=\textwidth]
at (titlerect.south west) {\Huge#1};
\end{tikzpicture}%
}
\titlespacing*{\chapter}
{0pt}{-20pt}{60pt}
% \setlength\beforeepigraphskip{1.5\baselineskip}
% \setlength\afterepigraphskip{2\baselineskip}
% \setlength\epigraphwidth{6.8cm}
% \setlength\epigraphrule{0pt}
% \renewcommand\epigraphsize{\large}
% \renewcommand\textflush{flushright}
%
% \let\oldepigraph\epigraph \renewcommand\epigraph[2]{%
% \oldepigraph{\color{mybluei}\itshape #1}{#2}}
\usepackage{epigraph}
\usepackage[margin=2.8cm]{geometry}
\setlength\beforeepigraphskip{1.5\baselineskip}
\setlength\afterepigraphskip{2\baselineskip}
\setlength\epigraphwidth{6.8cm}
\setlength\epigraphrule{0.1pt}
\renewcommand\epigraphsize{\large}
\renewcommand\textflush{flushright}
\let\oldepigraph\epigraph \renewcommand\epigraph[2]{%
\oldepigraph{\color{blue}\itshape #1}{#2}}
% \makeatletter
% \xpatchcmd{\ttl@printlist}{\endgroup}{{\noindent\color{blue}\rule{\textwidth}{1.5pt}}\vskip30pt\endgroup}{}{}
% \makeatother
\usepackage{titletoc}
\newcommand\DoPToC{%
\startcontents\printcontents{}{1}{\noindent{\color{blue}\rule{\textwidth}{.5pt}}\par\medskip}}
\usepackage{xpatch}
\begin{document}
\chapter{From the Ground Up!}
\epigraph{In theory there is no difference \\ between theory and practice. \\ In practice there is.}{Lawrence ``Yogui'' Berra,1925 \\ New York Yankees baseball player}
\DoPToC
\chapter*{A test unnumbered chapter}
\DoPToC
\chapter{Another chapter}
\epigraph{In theory there is no difference \\ between theory and practice. \\ In practice there is.}{Lawrence ``Yogui'' Berra,1925 \\ New York Yankees baseball player}
\DoPToC
\section{A simple section}
\section{Another simple section}
\end{document}
知道为什么会发生这种情况吗?如何解决?
答案1
您的字体包有冲突。在第一个代码中,您有\usepackage{lmodern}
,\usepackage{kerkis}
因此 LaTeX 首先被指示使用 Kerkis,然后将字体更改为 Latin Modern。
类似地,在第二个代码中\usepackage{fourier}
,您有指示 LaTeX 使用 Utopia 来处理文本和傅里叶形式数学的调用。删除该调用。
答案2
您可以使用 OpenType 版本的 Kerkis (http://iris.math.aegean.gr/kerkis/),然后运行xelatex
或lualatex
:
\documentclass{book}
\usepackage{pifont}
\usepackage{fontspec}
\setmainfont[BoldFont=Kerkisbold,
ItalicFont=Kerkisitalics]{Kerkis}
\setsansfont{KerkisSans}
\usepackage[english,greek]{babel}
\usepackage[margin=2.8cm,a4paper]{geometry}
\usepackage[explicit]{titlesec}
\usepackage{titletoc}
\usepackage{tikz}
\usepackage{epigraph}
\usepackage{xpatch}
\usepackage{lipsum}
\newlength\ChapWd
\settowidth\ChapWd{\huge\chaptertitlename}
\definecolor{myblue}{RGB}{0,0,122}
\titleformat{\chapter}[display]
{\normalfont\filcenter\sffamily}
{\tikz[remember picture,overlay]
{
\node[fill=myblue,font=\fontsize{60}{72}\selectfont\color{white},anchor=north east,minimum size=\ChapWd]
at ([xshift=-15pt,yshift=-15pt]current page.north east)
(numb) {\thechapter};
\node[rotate=90,anchor=south,inner sep=0pt,font=\huge] at (numb.west) {\chaptertitlename};
}
}{0pt}{\fontsize{33}{40}\selectfont\color{myblue}#1}[\vskip10pt\Large***]
\titlespacing*{\chapter}
{0pt}{50pt}{10pt}
\makeatletter
\xpatchcmd{\ttl@printlist}{\endgroup}{{\noindent\color{myblue}\rule{\textwidth}{1.5pt}}\vskip30pt\endgroup}{}{}
\makeatother
\newcommand\DoPToC{%
\startcontents[chapters]
\printcontents[chapters]{}{1}{\noindent{\color{myblue}\rule{\textwidth}{1.5pt}}\par\medskip}%
}
\setlength\epigraphrule{0pt}
\renewcommand\textflush{flushright}
\renewcommand\epigraphsize{\normalsize\itshape}
\begin{document}
\chapter{Title of the first chapter}
\epigraph{Ένας έξυπνος απόσπασμα - Συγγραφέας του}{}
\DoPToC
Είμαι δοκιμές μερικές μορφές κεφαλαίου να συνεργαστεί με γραμματοσειρά Κέρκης στα ελληνικά. Το περίεργο είναι Παρόλο που δεν φορτώσει το πακέτο, το στυλ γραμματοσειράς δεν χωράει μέσα στο έγγραφο. Η πρώτη μου προσπάθεια είναι η ακόλουθη:
\section{A test section}
\subsection{A test subsection}
\lipsum[4]
\end{document}