- 我想更改一个文档的所有公式中的字体样式,而不仅仅是单个公式。现在应用的字体是
- 我在这里发现了同样的问题,但它对我来说不起作用。
- 我的意思是,如何强制 Latex 更改方程式的整个字体样式?例如此字体样式:
我使用的软件包列表
\documentclass[11pt,a4paper]{article}
\usepackage[left=1.5cm,top=1cm,right=1.5cm,bottom=60pt]{geometry}
\usepackage[T1]{fontenc}
\usepackage{amsmath,bm}
%\usepackage{kpfonts}
\usepackage[math]{blindtext}
%\usepackage[utf8]{inputenc}
\usepackage{kpfonts}
%% To show that the equation is important or not
\usepackage{bm}
%\usepackage[utf8]{inputenc}
\usepackage[english]{babel} % 'french', 'german', 'spanish', 'danish', etc.
%% To set time
\usepackage{datetime}
%\date{\currenttime}
%%% for set page number at right footer
\usepackage{fancyhdr}
%%\usepackage{lipsum}
%
%% Turn on the style
%\pagestyle{fancy}
%% Clear the header and footer
%%\fancyhead{}
%
%%\fancyfoot{}
%
%% Set the right side of the footer to be the page number
%\fancyfoot[R]{\thepage}
\pagestyle{fancy}
\fancyhf{}% to clear existing header/footer if you don't want it
\renewcommand\headrulewidth{0pt}
%\cfoot{abc}
\usepackage{lastpage}
\fancyfoot[R]{\thepage\ of \pageref{LastPage}}
%\cfoot{\thepage\ of \pageref{LastPage}}
%\cfoot{\thepage\ of \pageref{LastPage}}
\newcounter{mypagecount}% create a new counter
\setcounter{mypagecount}{0}% set it to something just in case
\newenvironment{interlude}{% create a new environment for the unnumbered section(s)
\clearpage
\setcounter{mypagecount}{\value{page}}% use the new counter we created to hold the page count at the start of the unnumbered section
\thispagestyle{empty}% we want this page to be empty (adjust to use a modified page style)
\pagestyle{empty}% use the same style for subsequent pages in the unnumbered section
}
{%
\clearpage
\setcounter{page}{\value{mypagecount}}% restore the incremented value to the official tally of pages so the page numbering continues correctly
}
%% To draw application fram
\usepackage[latin1]{inputenc}
\usepackage{tikz}
\usetikzlibrary{patterns}
\usepackage{verbatim}
%% To do list
\usepackage{enumitem,amssymb}
% For lettrine
\usepackage{lettrine}
\renewcommand{\LettrineTextFont}{\normalfont}
% For fancy chapter
%\usepackage[Bjornstrup]{fncychap}
%Bjornstrup
%% For minus shorter
%\usepackage{amsfonts} %% <- also included by amssymb
%\DeclareMathSymbol{\shortminus}{\mathbin}{AMSa}{"39}
%\usepackage{mathpazo} %% <- because the OP uses mathpazo, optional
% for graphics .eps
\usepackage{graphicx, epstopdf}
% for section numbering figure - caption
%\usepackage{chngcntr}
%\numberwithin{figure}{section}
\usepackage{chngcntr}
\counterwithin{figure}{section}
% caption
\usepackage{caption}
\usepackage{subcaption}
\captionsetup[figure]{name=Fig, labelsep=period, labelfont=bf}
% hyperref
\usepackage{url}
\usepackage{hyperref}
% math
\usepackage{amssymb}
\usepackage{amsmath}
% Landscape
\usepackage{pdflscape}
% forest
\usepackage{forest}
% enumerate
\usepackage{enumerate}
\usepackage{enumitem}
%\usepackage{itemize}
\usepackage{txfonts}
\usepackage{mathdots}
\usepackage[classicReIm]{kpfonts}
\usepackage{graphicx}
%% For Tables / Tabular
\usepackage{tabularx}
%\usepackage{tabfigures}
%\usepackage{tableau}
%\usepackage{newpsstyle}
\usepackage{mathtools}
% longtable
\usepackage{longtable}
%\usepackage{endheads}
% color table
\usepackage{colortbl}
%\usepackage[table]{xcolor}
% Space between columns
\setlength{\tabcolsep}{14pt}
% Space between rows
\renewcommand{\arraystretch}{1.8}
% for multirow tabular
\usepackage{multirow}
\usepackage{amsmath,amssymb ,amsfonts,xcolor,tikz}
\usepackage{multicol}
\usepackage{enumitem}
%% For capitale letter
\usepackage{stackengine,scalerel}
%%%%%%%%% Answer proposed for the Problem Box
\usepackage{tikz,contour}
\usepackage[most]{tcolorbox}
\usepackage{amsmath,amssymb}
\usepackage{multicol}
\usepackage{pgf,tikz,pgfplots}
\pgfplotsset{compat=1.15}
\usepackage{mathrsfs}
\usetikzlibrary{arrows}
\definecolor{candyapplered}{rgb}{1.0, 0.03, 0.0}
\definecolor{lime(colorwheel)}{rgb}{0.75, 1.0, 0.0}
\usetikzlibrary{shapes.geometric}
\renewcommand{\labelenumi}{%
\begin{tikzpicture}[baseline=(1.base)]
\node[draw,regular polygon,regular polygon sides=4,inner sep=.5mm,fill=white,font=\bfseries](1){\arabic{enumi}};
\end{tikzpicture}}
\renewcommand{\labelenumii}{%
\begin{tikzpicture}[baseline=(1.base)]
\node[draw ,inner sep=.5mm,fill=white,font=\bfseries\footnotesize,minimum size=5mm](1){\alph{enumii}};
\end{tikzpicture}}
\usepackage{fancyhdr}
\usepackage{multirow}
%\cfoot{\thepage/\pageref{LastPage}}
%% Definition Box
\usepackage[most]{tcolorbox}
%\newsavebox{\mybox}
%% To include pdf file
\usepackage{pdfpages}
% Make ligatures and stuff copiable from pdf:
\input{glyphtounicode}
\pdfgentounicode=1
%% For Flow chart
%\usepackage[tmargin=2cm,bmargin=1cm]{geometry}
\usepackage{tikz}
\usetikzlibrary{shapes,snakes}
%% For title format -- Section Style
%% to change font color
%\usepackage{xcolor}
%\usepackage{sectsty}
%\sectionfont{\color{col1}}
%\usepackage{titlesec} %block %display %drop %leftmargin %wrap
%\usepackage{xcolor}
\usepackage[explicit]{titlesec}
\usepackage[dotinlabels]{titletoc}
%% for bib
\usepackage{nameref}
%% For Fancy Part
%% For Draw PV module
\usepackage{circuitikz}
\usetikzlibrary{calc}
%% For minitoc of a subsection
%\usepackage{times}
\usepackage{minitoc}
\usepackage{mdframed}
%\usepackage[undotted]{minitoc} % remove dots from minitoc
%% To Force figure placement in text
%https://tex.stackexchange.com/questions/8625/force-figure-placement-in-text
% Don't use the center environment but the \centering command for figures.
\usepackage{placeins}
% Or the shirt answer
\usepackage{float}
%\begin{figure}[H]
%% Quad-Rotor Draw
%\usepackage{float}
\usepackage{listings}
\usepackage{color}
\usepackage{textcomp}
\usepackage{graphicx}
%\usepackage{tikz}
\usepackage{tikz-3dplot}
\usepackage{relsize}
%\usepackage{blindtext}
\newcommand{\CoverName}{Cover}
\newcommand{\RefName}{Ref}
%% For Smile Face
\usepackage{tikz-network}
%% Write text in a shape of heart
%\usepackage{fontspec,microtype,shapepar,xcolor}
%\setmainfont{TeX Gyre Chorus}
%\documentclass{article}
\usepackage{blindtext}
\usepackage{shapepar}
谢谢。
答案1
你几乎没有提供任何信息,但据我所知,你的第一个例子是使用 kpfonts
\documentclass{article}
\usepackage{kpfonts}
\begin{document}
\[y=\sin^2 x\]
\end{document}
所需的第二个示例是使用默认的 latex computer modern,因此您所要做的就是不要使用选择非标准字体集的包。
\documentclass{article}
\begin{document}
\[y=\sin^2 x\]
\end{document}
还有许多其他可用的字体集,例如 stix2:
\documentclass{article}
\usepackage{stix2}
\begin{document}
\[y=\sin^2 x\]
\end{document}
答案2
我使用例如TeX Gyre Pagella/数学字体与您的屏幕截图非常接近。请参阅此可使用 LuaLaTeX 编译的示例。
\documentclass[a4paper,12pt]{article}
\usepackage{fontspec}
\usepackage{unicode-math}
\setmainfont{TeX Gyre Pagella}
\setmathfont{TeX Gyre Pagella Math}
\begin{document}
\[\bar x = \sum^{n}_{i=1}{x_1 + x_2+\ldots +x_n}=y=\sin(x)\]
\end{document}