如何更改 Tufte-book 样式的主字体

如何更改 Tufte-book 样式的主字体

我尝试在 Tufte 图书文档类中更改我的主要字体样式。文档说可以使用nofonts类选项来实现,但没有任何效果。我尝试了该\setmainfont函数和其他棘手的解决方案,但没有结果。以下是我的软件包:

\documentclass[11pt, justified]{tufte-handout}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
  \setkeys{Gin}{width=\linewidth,totalheight=\textheight,keepaspectratio}
  \graphicspath{{graphics/}}
\usepackage{lmodern}
\usepackage{amsmath, amssymb, amsfonts, euscript}
\usepackage{mathabx, mathrsfs, mathptmx}
\usepackage{booktabs}
\usepackage{units}
\usepackage{multicol}
\usepackage{lipsum}
\usepackage{fancyvrb}
\fvset{fontsize=\normalsize}
\usepackage[frenchb]{babel}
\usepackage{titlesec}
\usepackage{bibentry}
\usepackage{xcolor}
\usepackage{enumerate}
\usepackage{enumitem}
\usepackage{microtype}
\usepackage{todonotes}
\usepackage{fontawesome}
\usepackage{listings}
\usepackage{geometry}
\usepackage{theorem}
\usepackage{fancyhdr}
\usepackage[most]{tcolorbox}
\usepackage[framemethod=TikZ]{mdframed}
\usepackage{ifthen}
\usepackage{tikz}

\usetikzlibrary{shadows}
\lstset{language=C}

感谢您的帮助。

梅威瑟:

这是我正在尝试做的最小代码,请记住我只是想更改文档中的文本

\documentclass[nofonts, justified]{tufte-handout}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage{amsmath, amssymb, amsfonts}
\usepackage{mathabx, mathrsfs, mathptmx}
\usepackage{booktabs}
\usepackage{units}
\usepackage{multicol}
\usepackage{fancyvrb}
\usepackage{titlesec}
\usepackage{bibentry}
\usepackage{xcolor}
\usepackage{enumitem}
\usepackage{microtype}
\usepackage{todonotes}
\usepackage{listings}
\usepackage{theorem}
\usepackage{fancyhdr}
\usepackage[most]{tcolorbox}
\usepackage{ifthen}
\usepackage{tikz}

%-----------For test-----------------------------------
\usepackage{lipsum}
%------------------------------------------------------

\setkeys{Gin}{width=\linewidth,totalheight=\textheight,keepaspectratio}
\graphicspath{{graphics/}}
\usetikzlibrary{shadows}
\lstset{language=C}

%=======================================================
%                       COLORS
%=======================================================
\definecolor{grey}{rgb}{0.9,0.9,0.9}

%=======================================================
%                  TITLES OPTIONS
%=======================================================
\titleformat*{\section}{\fontfamily{pag}\selectfont\huge\bfseries}
\titleformat*{\subsection}{\fontfamily{pag}\selectfont\LARGE\bfseries}
\titleformat*{\subsubsection}{\large\bfseries}
\titleformat*{\paragraph}{\large\bfseries}
\titleformat*{\subparagraph}{\large\bfseries}

\titlespacing{\section}{0pt}{*0}{*0}
\titlespacing{\subsection}{0pt}{*0}{*0}
\titlespacing{\subsubsection}{0pt}{*0}{*0}
\titlespacing{\paragraph}{0pt}{*2}{*2}

\renewcommand{\thesubsubsection}{\thesection.\thesubsection\alph{subsubsection}}


\title{Test - tex.stackexchange.com}
\author[The Author]{The author}


%=======================================================
%                        MACROS
%=======================================================
\newcommand{\doccmd}[1]{\texttt{\textbackslash#1}}
\newcommand{\docopt}[1]{\ensuremath{\langle}\textrm{\textit{#1}}\ensuremath{\rangle}}
\newcommand{\docarg}[1]{\textrm{\textit{#1}}}
\newcommand{\docenv}[1]{\textsf{#1}}
\newcommand{\docpkg}[1]{\texttt{#1}}
\newcommand{\doccls}[1]{\texttt{#1}}
\newcommand{\docclsopt}[1]{\texttt{#1}}
\renewcommand{\rmdefault}{pplx}

\newcommand{\etal}{\textit{et al}.}
\newcommand{\ie}{\textbf{\textit{i}.\textit{e}. }}
\newcommand{\eg}{\textbf{\textit{e}.\textit{g}. }}
\newcommand{\cfr}{\textit{cfr}. }

\geometry{
  left=15mm,
  textwidth=140mm,
  headsep=10mm,
  headheight = 0mm,
  marginparsep=7mm,
  marginparwidth=50mm,
  bottom = 1.5cm, 
  top = 1.7cm
}

%=======================================================
%                    HEADER/FOOTER
%=======================================================
\pagestyle{fancy}{
\fancyhf{}
\rhead{The Author}
\lhead{TEST - tex.stackexchange.com}
\rfoot{Page \thepage}
}

%=======================================================
%                      DOCUMENT
%=======================================================
\begin{document}

%---------------------------------------------------------------
\begin{titlepage}
    \fontfamily{pag}
    \begin{center}
        \noindent\begin{minipage}{1\textwidth}
            \includegraphics[draft]{example-image}
        \end{minipage}
    \end{center}
    \vfill
    \centering
    \colorbox{grey}{
        \parbox[t]{1.2\textwidth}{
            \parbox[t]{1.2\textwidth}{
                \vspace{0.2cm}
                \begin{center}
                \fontsize{13pt}{0pt}\selectfont
                \text{TEST - tex.stackexchange.com}\\
                \fontsize{50pt}{0pt}\selectfont\bfseries
                \vspace{0.3cm}\underline{Base project}\end{center} {\Huge2019}
                \vspace{0.7cm}
            }
        }
    }

    \vfill
    %------------------------------------------------
    %   Author name and informations
    %------------------------------------------------

    \parbox[t]{1.2\textwidth}{
        \raggedleft
        \large
        {\Large Author}\\[4pt]
        University\\
        \hfill\rule{0.2\linewidth}{1pt}
    }

\end{titlepage}
%---------------------------------------------------------------

\renewcommand{\headrulewidth}{1pt}

\section{Chapter 1:}
\lipsum[2]
\lipsum[3]

\begin{marginfigure}
\lipsum[1]
\end{marginfigure}
\end{document}

答案1

您的代码存在问题,您通过使用诸如 之类的命令明确选择字体来覆盖序言中的任何字体设置\renewcommand{\rmdefault}{pplx}

在删除所有显式字体选择和其他一些不合你心意的代码后,你现在可以使用自己选择的字体了。我试过Linux Libertine 和 Biolinum 字体\usepackage{libertine}

\documentclass[nobib,nofonts,justified]{tufte-handout}
\usepackage{graphicx}
\usepackage{microtype}


\usepackage{libertine} % <-- Here



%-----------For test-----------------------------------
\usepackage{lipsum}
%------------------------------------------------------
%                  TITLES OPTIONS
%=======================================================
\titleformat*{\section}{\huge\bfseries}
\titleformat*{\subsection}{\LARGE\bfseries}
\titleformat*{\subsubsection}{\large\bfseries}
\titleformat*{\paragraph}{\large\bfseries}
\titleformat*{\subparagraph}{\large\bfseries}

\titlespacing{\section}{0pt}{*0}{*0}
\titlespacing{\subsection}{0pt}{*0}{*0}
\titlespacing{\subsubsection}{0pt}{*0}{*0}
\titlespacing{\paragraph}{0pt}{*2}{*2}

\renewcommand{\thesubsubsection}{\thesection.\thesubsection\alph{subsubsection}}


\title{Test - tex.stackexchange.com}
\author[The Author]{The author}


%=======================================================
%                      DOCUMENT
%=======================================================
\begin{document}

%---------------------------------------------------------------
\begin{titlepage}
    \begin{center}
        \noindent\begin{minipage}{1\textwidth}
            \includegraphics[draft]{example-image}
        \end{minipage}
    \end{center}
    \vfill
    \centering
    \colorbox{gray}{
        \parbox[t]{1.2\textwidth}{
            \parbox[t]{1.2\textwidth}{
                \vspace{0.2cm}
                \begin{center}
                \fontsize{13pt}{0pt}\selectfont
                TEST - tex.stackexchange.com\\
                \fontsize{50pt}{0pt}\selectfont\bfseries
                \vspace{0.3cm}\underline{Base project}\end{center} {\Huge2019}
                \vspace{0.7cm}
            }
        }
    }

    \vfill

    %------------------------------------------------
    %   Author name and informations
    %------------------------------------------------

    \parbox[t]{1.2\textwidth}{
        \raggedleft
        \large
        {\Large Author}\\[4pt]
        University\\
        \hfill\rule{0.2\linewidth}{1pt}
    }

\end{titlepage}
%---------------------------------------------------------------

\renewcommand{\headrulewidth}{1pt}

\section{Chapter 1:}
\lipsum[2]
\lipsum[3]

\begin{marginfigure}
\lipsum[1]
\end{marginfigure}
\end{document}

pdffonts显示没有加载其他字体:

name                                 type              encoding         emb sub uni object ID
------------------------------------ ----------------- ---------------- --- --- --- ---------
QFROIV+LinLibertineMT                Type 1            Custom           yes yes no      13  0
GYBFUK+LinLibertineT                 Type 1            Custom           yes yes no      14  0
AWSGUC+LinLibertineTB                Type 1            Custom           yes yes no      15  0
GYBFUK+LinLibertineT                 Type 1            Custom           yes yes no      21  0

答案2

欢迎加入本小组...

你没有提到要更改的字体名称。通过使用代码\usepackage{palatino,mathpazo}可以将主字体更改为 Palatino

相关内容