求和符号在 PDF 中不可见,但在 Sublime Text 方程式快速概览中可见

求和符号在 PDF 中不可见,但在 Sublime Text 方程式快速概览中可见

如下所示,在 Sublime Text 中可以看到总结。 在此处输入图片描述

该方程的代码是

  \begin{equation}\label{cepl}
     L = \frac{ \displaystyle \sum\limits_{x=1}^N {T_{d}^{x} - {T_{i}^{x} }} } {N} 
  \end{equation}

然而,在实际文件中,事实并非如此。

在此处输入图片描述

无论如何,输出都是相同的\displaystyle。我做错了什么?

我的包文件的内容是

\documentclass[letterpaper,12pt,titlepage,final]{report}

\usepackage{amsmath} % for eqautions
\newcommand{\bmmax}{0}  
\newcommand{\hmmax}{0} 
\renewcommand{\baselinestretch}{1.5} % this is the default line space setting
\usepackage{xcolor}
\usepackage[norelsize, linesnumbered, ruled, lined, boxed, commentsnumbered,algochapter]{algorithm2e}
% \newcommand\mycommfont[1]{\footnotesize\ttfamily\textcolor{blue}{#1}}
\newcommand\mycommfont[1]{\footnotesize\ttfamily\textcolor{carmine}{#1}}
\SetCommentSty{mycommfont}
\SetKwComment{Comment}{$\triangleright$\ }{}
\usepackage{listings}
\usepackage{blindtext}
\usepackage{float}
\usepackage{titlesec}
\usepackage{newtxmath}
\usepackage{bm}
\usepackage{blindtext}
\usepackage{array}
\newcolumntype{C}[1]{>{\centering\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}

\SetKwRepeat{Do}{do}{while}%
\usepackage[skip=3pt]{caption} % example skip set to 2pt
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{algorithmic}
\usepackage{titlesec}
\usepackage[symbols,nogroupskip]{glossaries-extra}
\usepackage{nomencl}
\makenomenclature

\renewcommand{\glsnamefont}[1]{\textbf{#1}}

\newglossarystyle{modsuper}{%
  \glossarystyle{super}%
  \renewcommand{\glsgroupskip}{}
}

% \titlespacing*{<command>}{<left>}{<before-sep>}{<after-sep>}    --this is for managign title spacing 
\titleformat{\chapter}[display]
   {\normalfont\huge\bfseries}{\chaptertitlename\ \thechapter}{20pt}{\Huge}
\titlespacing*{\chapter}{0pt}{1pt}{10pt}
\titlespacing*{\section}{0pt}{3pt}{3pt}
\titlespacing*{\subsection}{0pt}{3pt}{3pt}

\newcommand{\package}[1]{\textbf{#1}} % package names in bold text
\newcommand{\cmmd}[1]{\textbackslash\texttt{#1}} % command name in tt font 
\newcommand{\href}[1]{#1} % does nothing, but defines the command so the


\usepackage[toc,page]{appendix} 
\usepackage{amsmath,amssymb,amstext} % Lots of math symbols and environments
\usepackage[pdftex]{graphicx} % For including graphics N.B. pdftex graphics driver 


 \usepackage[export]{adjustbox}

% only for \lipsum blind text
\usepackage{lipsum}

\usepackage[pdftex,pagebackref=false]{hyperref} % with basic options
\definecolor{carmine}{rgb}{0.59, 0.0, 0.09}
\definecolor{gren}{rgb}{34, 139, 34}


\hypersetup{
    plainpages=false,       % needed if Roman numbers in frontpages
    unicode=false,          % non-Latin characters in Acrobat’s bookmarks
    pdftoolbar=true,        % show Acrobat’s toolbar?
    pdfmenubar=true,        % show Acrobat’s menu?
    pdffitwindow=false,     % window fit to page when opened
    pdfstartview={FitH},    % fits the width of the page to the window
    pdftitle={Carleton\ LaTeX\ Thesis\ Template},    % title: CHANGE THIS TEXT!
    pdfauthor={Amarjit Singh},    % author: CHANGE THIS TEXT! and uncomment this 
    pdfnewwindow=true,      % links in new window
    colorlinks=true,        % false: boxed links; true: colored links
    % linkcolor=carmine,         % color of internal links
    linkcolor=black,         % color of internal links
    citecolor=black,        % color of links to bibliography
    filecolor=black,         % color of file links
    urlcolor=black           % color of external links
}

    % filecolor=magenta,      % color of file links


\setlength{\marginparwidth}{0pt}
\setlength{\marginparsep}{0pt} % width of space between body text and margin notes
\setlength{\evensidemargin}{0.1in} 
\setlength{\oddsidemargin}{0.1in} 
\setlength{\textwidth}{6.5in} 
\raggedbottom

\usepackage[noabbrev,nameinlink, capitalise]{cleveref}
\usepackage{makecell} % for giving center align to headings
\usepackage{array}
\usepackage{textcomp} % used for Apostophe
\usepackage{wrapfig}
\usepackage{subfig}
\usepackage{blindtext}% for list of publication , for not to move biblo in new page
\usepackage{etoolbox}%
\usepackage[utf8]{inputenc}
\usepackage{amsmath,tabularx}
\usepackage{siunitx}
\usepackage{lmodern}
\RequirePackage{fix-cm}
\usepackage{silence}

% removing the paragraph indentation  - tell it to jazz as well
\newlength\tindent
\setlength{\tindent}{\parindent}
\setlength{\parindent}{0pt}
\renewcommand{\indent}{\hspace*{\tindent}}

\usepackage{caption}
\urlstyle{same} %for same url instead fo monospace
\newcommand*\rot{\rotatebox{90}} % for rotating the text in table

\usepackage{xcolor,pifont}
\newcommand*\colourcheck[1]{%
  \expandafter\newcommand\csname #1check\endcsname{\textcolor{#1}{\ding{51}}}%
}
\colourcheck{blue}
\colourcheck{green}
\colourcheck{gren}


\usepackage{xcolor,pifont}
\newcommand*\colourmark[1]{%
  \expandafter\newcommand\csname #1mark\endcsname{\textcolor{#1}{\ding{55}}}%
}
\colourmark{red}
\colourmark{green}


% \newcommand{\cmark}{\ding{51}}%
\newcommand{\xmark}{\ding{55}}%


\usepackage{notoccite} %makes sure that the refs in caption are not cited at first, means the order is maintained.
\usepackage{color}
\usepackage{eso-pic}
\definecolor{lightgray}{gray}{.80}
\usepackage{wallpaper}
\usepackage[export]{adjustbox} % for set image baseline to its center
\usepackage{booktabs}


%  it si used for coading type formatting
\lstset{basicstyle=\rmfamily,
  showstringspaces=false,
  commentstyle=\color{red},
  keywordstyle=\color{blue}
}

%  used for math bold
\usepackage{amsmath}
\usepackage{bm}

% This makes all te math to bold in subsection.
 \makeatletter
\g@addto@macro\bfseries{\boldmath}
\makeatother


%  for coloring tables
\usepackage{xcolor,colortbl}
\definecolor{Gray}{gray}{0.85}
\definecolor{LightCyan}{rgb}{0.88,1,1}
\newcolumntype{x}{>{\columncolor{Gray}}l}
\newcolumntype{y}{>{\columncolor{Gray}}c}
\newcolumntype{z}{>{\columncolor{Gray}}r}

\usepackage{enumitem} % used to put a,b,c in enumerate 
\usepackage{fancyhdr}

\renewcommand{\headrulewidth}{0pt}


% --- this is to desplay only name of chapter on top---
% \renewcommand{\chaptermark}[1]{\markboth{#1}{}}

\fancyhf{}
\fancyhead[RO]{\thepage}
\fancyhead[LO]{\nouppercase{\leftmark}}
\usepackage[export]{adjustbox}
\usepackage{tabularx,booktabs,caption,makecell}
\usepackage{mathpazo}

如果还需要其他东西,请告诉我吗?

答案1

当前的问题,即缺少求和符号,可以通过以下方式纠正不是正在加载该newtxmath包。该newtxmath包与随后加载的包存在严重冲突mathpazo

如果您不知道在文本和数学字体方面要做什么,特别是如果您不必使用 Palatino 字体,则可以跳过加载包mathpazo(以及newtxmath包本身!)。这样就将指令留\usepackage{lmodern}在了您的序言中。此指令加载Latin Modern文本和数学字体系列。除非您确实需要使用其他字体系列,否则请使用它。(如果您也省略该\usepackage{lmodern}指令,您将获得默认字体系列,即 Computer Modern。除非文档包含大量重音字符,否则大多数人很难区分 Computer Modern 和 Latin Modern。)

如果您确实需要使用 Palatino 克隆,请不要加载该lmodern软件包。并且,帮自己一个忙,不要加载几乎过时的mathpazo软件包。相反,加载newpxtextnewpxmath软件包。

正如我在之前的评论中提到的,您的文档的序言中还有许多其他几乎同样严重的缺陷。迟早——可能很快就会出现!——这些缺陷将导致进一步的问题。一定要修复这些缺陷,并花时间学习 LaTeX 的基础知识并弄清楚各种软件包实际上的作用。加载一堆杂乱无章的软件包(也许是徒劳地希望“涵盖所有基础”?)并非无害。相反,这是自找麻烦,至少会浪费大量时间,让您找出各种神秘错误消息的原因。

答案2

加载多个字体相关包时要小心,它们可能会相互产生负面影响。在这种情况下,您应该决定是否使用 newtxmath、mathpazo 或 lmodern。

你还应该清理你的序言,hyperref 和 cleveref 应该最后加载,pdftex 不应该作为选项提供

答案3

看起来你好像把其他人的 LaTeX 文档的片段粘贴到了你自己的序言中。我不建议这样做。我的建议是从最基本的东西开始,只添加你需要的包。避免从别人的序言中复制粘贴行,除非没有它们你会得到错误。

这是一个注释模板,已更新以适用于 Unicode 和 OpenType,它保留了您发布的序言中几乎所有有用的内容。它需要 XeLaTeX 或 LuaLaTeX。

\documentclass[letterpaper, 12pt, titlepage, final]{report}

\usepackage{mathtools} % Math environments and commands.
% It includes amsmath, so don’t include that separately.
\usepackage{unicode-math} % Supports OpenType fonts, defines all standard
% symbols present in Unicode, including every symbol from every package
% you previously loaded.  It includes fontspec.
\usepackage{polyglossia} % Necessary for multilingual documents.  If your
% document is in English, all this does is slightly change the hyphenation.
\usepackage[HTML, hyperref, svgnames, table]{xcolor} % Color commands.  These
% options enable all the standard color names for SVG/CSS, as well as HTML
% color codes by default.  It also loads the colortbl package (replacing
% table) and turns on hyperref support.

%% Load other packages here, before hyperref.  Remember, other packages
%% have already loaded amsmath, fontspec and colortbl (table).

\usepackage[ unicode,
             colorlinks,
             allcolors = blue
           ]{hyperref} % Hypertext links.  See:
% http://mirrors.ctan.org/macros/latex/contrib/hyperref/doc/manual.html

%% Choose (at most) one of the following font options:
%%
%% The default, based on Computer Modern, corresponding to lmodern:
%\setmainfont{Latin Modern Roman}
%\defaultfontfeatures{Scale=MatchUppercase}
%\setmathfont{Latin Modern Math}

%% Fonts based on Palatino, corresponding to mathpazo or newpxmath:
%\setmainfont{TeX Gyre Pagella}
%\defaultfontfeatures{Scale=MatchUppercase}
%\setmathfont{Asana Math}

%% Fonts based on Times, corresponding to newtxtext and newtxmath:
%\setmainfont{TeX Gyre Termes}
%\defaultfontfeatures{Scale=MatchUppercase}
%\setmathfont{TeX Gyre Termes Math}

%% If you want to \setsansfont or \setmonofont, do that here.

%% Language set-up, via Polyglossia:
\setdefaultlanguage{english}
%% \setotherlanguage, fonts such as \newfontfamily\cyrillicfont{...}, etc. go
%% here.

%% Optional PDF information, via hyperref.  You can probably delete this:
\hypersetup{
  pdfinfo={
    Title={Underwater Basket-Weaving},
    Author={Smeagol},
    Subject={Jewelry},
    Keywords={Precious}
  }
}

\begin{document}

\chapter{Introduction}\label{chap:intro}

\begin{equation}\label{cepl}
   L = \frac{
     \displaystyle\sum\limits_{x=1}^N {T_{d}^{x} - {T_{i}^{x} }} }
     {N} 
\end{equation}

\section{Recapitulation}\label{sec:recap}

Review \autoref{cepl}.

\end{document}

示例文档

您可以根据具体情况添加包,只要它们与您已经加载的包兼容。

如果您需要在标题中使用单独的粗体数学样式,则此设置会有些棘手,但可以做到。

如果你需要参考书目,natbib是否兼容hyperref。通常情况下,您不需要加载任何其他字体或符号包unicode-math,除非在非常特殊的情况下。如果您想要不同的字体,查看此社区维基列表。如果你只是在寻找可以添加的优秀软件包,也许可以从以下开始microtype

相关内容