
XeTeX
사용하려는 문서를 편집 titlesec
하고 titling
일부 제목에 대해 다른 글꼴을 설정하는 데 사용하고 있습니다 .
나는 다음과 같이 제안된 접근 방식을 사용하고 있습니다.비슷한 질문에 답하다, 그러나 지금까지 나의 성공은 정말 부분적이었습니다.
및 제목 section
은 subsection
원하는 대로 글꼴을 변경하지만 chapter
제목은 설정을 무시합니다.
내 코드의 일부는 다음과 같습니다.
%%% to allow custom headings
\usepackage{titlesec}
% to change titles font family
\usepackage{titling}
%%% declare fonts and set some formats
% fontspec to use non-latex with xetex
\usepackage{xunicode}
\usepackage{fontspec}
\usepackage{xltxtra}
% font declaration and title settings
\newfontfamily\headingfont[]{Armata}
\titleformat{\chapter}{\LARGE\headingfont}
\titleformat*{\section}{\LARGE\headingfont}
\titleformat*{\subsection}{\Large\headingfont}
\renewcommand{\maketitlehooka}{\headingfont}
챕터 설정은 위 링크에서 제공하는 솔루션을 흉내내면서 시도한 것입니다. 장 제목에서는 작동하지 않기 *
때문에 제거가 필요하다는 것을 배웠습니다 . easy mode
아직 이유를 찾지 못했습니다. 하지만 사실은 별표를 제거하면 오류도 제거된다는 것입니다. 하지만 글꼴 설정과 관련하여 작동하지 않는 것 같습니다.
어떤 아이디어가 있나요?
감사해요 :)
편집: 정말 어리석은 오류를 발견하여 (부분) 솔루션을 찾았고 새로운 오류가 표시되었습니다. 방금 설정했는데 \documentclass{book}
이제 렌더러가 원하는 글꼴을 넣으려고 시도하지만 titlesec
오류가 발생합니다.
Titles must not be nested
LaTeX 코드는 다음과 같습니다.
\begin{document}
\chapter{First Chapter}
The title above does not show any font.
\section{First Section}
Works as desired.
\subsection{Subsection}
Hiya! This also shows up as expected.
\subsubsection{Subsubsection}
We have not declared a titleformat for this heading, and so it is shown with the default font.
\section{Second section}
Repeating the success
\end{document}
제목 chapter
은 titlesec 오류를 유발하는 제목입니다.
답변1
라인
\titleformat{\chapter}{\LARGE\headingfont}
범인입니다. 구문이 잘못되었습니다. 오른쪽은
\titleformat{\chapter}[display]
{\huge\headingfont}{\chaptertitlename\ \thechapter}{20pt}{\Huge}
따라서 MWE(해당 글꼴이 설치되어 있지 않기 때문에 Armata 대신 Arial을 사용했습니다):
\documentclass{book}
%%% to allow custom headings
\usepackage{titlesec}
% to change titles font family
\usepackage{titling}
%%% declare fonts and set some formats
% fontspec to use non-latex with xetex
\usepackage{xunicode}
\usepackage{fontspec}
\usepackage{xltxtra}
% font declaration and title settings
\newfontfamily\headingfont[]{Arial}
\titleformat{\chapter}[display]
{\huge\headingfont}{\chaptertitlename\ \thechapter}{20pt}{\Huge}
\titleformat*{\section}{\LARGE\headingfont}
\titleformat*{\subsection}{\Large\headingfont}
\renewcommand{\maketitlehooka}{\headingfont}
\begin{document}
\chapter{First Chapter}
The title above does not show any font.
\section{First Section}
Works as desired.
\subsection{Subsection}
Hiya! This also shows up as expected.
\subsubsection{Subsubsection}
We have not declared a titleformat for this heading, and so it is shown with the default font.
\section{Second section}
Repeating the success
\end{document}
다음과 같은 결과가 나옵니다