如何在 LaTex 中使用漫画字体(TexStudio 与 MikTex)

如何在 LaTex 中使用漫画字体(TexStudio 与 MikTex)

我有一个模板需要漫画字体,但现在已经无法使用了(我需要根据这个模板写一篇文章,所以不能使用其他字体或更改模板)。我在旧电脑上编译了相同的模板,它运行良好,但当切换到新的 Windows 10 电脑时,它就不再起作用了。有人能帮我正确安装字体吗?在我收到的 LaTex 模板中,以下是实际文本之前的所有内容。注释掉的包和命令是我试过的,但没有用。

\documentclass[twocolumn]{article}
%%% remove comment delimiter ('%') and select language if required
% *** CITATION PACKAGES ***
\usepackage[english]{babel}
\usepackage[utf8]{inputenc} % input encoding
\usepackage[T1]{fontenc} % font encoding
\usepackage{amssymb} % extended symbol collection
\usepackage{amsmath} % mathematical formulas
\usepackage{caption} % figure and table caption
\usepackage[pdftex]{graphicx} % figures
\usepackage{siunitx} % unit \SI{}{}
\usepackage{url} % web site
\usepackage{mathptmx} % change text and formular to times
\usepackage{natbib} % bibliography
\usepackage{apalike} % bibliography style
\usepackage{hyperref} % hightlight reference
%\usepackage[none]{hyphenat} % prevent hyphenation 
\usepackage{ulem} % strike the words
\usepackage{indentfirst} % indent the first paragragh
\usepackage{sectsty} % change section font size
\usepackage{secdot} % add a dot after the number of section
\usepackage{authblk}
\usepackage{parskip}
\usepackage[hang,flushmargin]{footmisc} % remove the indenation in footnote
\usepackage{color} % font color
\usepackage{fancyhdr} % for header
\usepackage[tight,footnotesize]{subfigure}
%\usepackage{lmodern}
%\usepackage[utf8ttf]{inputenc}
%\usepackage{ttfucs}
\usepackage{geometry}
 \geometry{
 a4paper,
 top=22mm,
 bottom=34mm,
 left=20mm,
 right=20mm 
 }

%% FORMAT PAGES AND FONT
\setlength{\columnsep}{8mm} % space between two column
\setlength{\columnwidth}{81mm}
\headheight = 12.5mm
\headsep = 32pt % change the space between the header line and the text block
\setlength{\parskip}{12pt plus4pt minus4pt} % set distance between two paragraphs
\AtBeginDocument{\fontsize{12pt}{14pt}\selectfont} % set font size of 12pt and line spacing of 14pt
\setlength{\parindent}{6mm} % set paragraph indenting as 6mm

\sectionfont{\fontsize{12pt}{14pt plus2pt minus2pt}\selectfont}
\subsectionfont{\fontsize{12pt}{14pt plus2pt minus2pt}\selectfont}
\subsubsectionfont{\fontsize{12pt}{14pt plus2pt minus2pt}\selectfont}

%\DeclareTruetypeFont{comic}{comic}

\newcommand*{\cmcsans}{\fontfamily{comic}\selectfont}
\DeclareTextFontCommand{\textcmcsans}{\cmcsans}

%%%%%%%%%%%%%%%%%%%%% BELOW FOR EDITOR %%%%%%%%%%%%%%%%%
\pagenumbering{arabic}
\setcounter{page}{1} % page can be specified by hand
%%%%%%%%%%%%%%%%%%%%% ABOVE FOR EDITOR %%%%%%%%%%%%%%%%%

%% ADD HEADER ON THE TITLE PAGE
\fancypagestyle{firststyle}
{
   \fancyhf{}
\chead{{\hspace{4cm}
\textcmcsans{Proceeding of the 13\textsuperscript{th} International Conference on bla bla bla 
\\
\hspace{4cm} bla bla bla bla.}}}
\lhead{\fontsize{22}{26}\selectfont \textcolor{blue}{\textbf{\textit{SAMPLE MAT}}}}
\rhead{\thepage \hspace{15pt}}
}
%% ADD HEADER ON EVERY PAGE AFTER THE TITLE PAGE
\pagestyle{fancy}
\fancyhf{}
\chead{{\hspace{4cm} 
\textcmcsans{Proceeding of the 13\textsuperscript{th} International Conference on bla bla bla 
\\ 
\hspace{4cm} bla bla bla bla.}}}
\lhead{\fontsize{22}{26}\selectfont \textcolor{blue}{\textbf{\textit{SAMPLE MAT}}}}
\rhead{\thepage \hspace{15pt}}

%%%%%%%%%%%% TITLE AND AUTHOR %%%%%%%%%%%%%%%%%%%%%%%%%

\title{\fontsize{20}{24}\vspace{-20pt}
\textbf{Guidelines for Preparation of Manuscripts}
}

\author{
Author 01, first name, surname, \textit{Affiliation 01} \textcolor{blue}{\underline{e-mail}}
\vspace{10pt}

Author 02, first name, surname, \textit{Affiliation 02} \textcolor{blue}{\underline{e-mail}}
} 
\date{}

\begin{document}
%% ADD ABSTRACT
\twocolumn[
\begin{@twocolumnfalse}
\maketitle
\pagestyle{fancy}
\thispagestyle{firststyle}
\fontsize{9}{24}\textbf{ABSTRACT}

\vspace{14pt}
\hspace{6mm}
Authors of papers have to type these in a form suitable for direct photographic reproduction by the publisher. In order to ensure uniform style throughout the volume, all the papers have to be prepared strictly according to the instructions set below, which essentially follow the ITTC format. 

\vspace{14pt} 
\hspace{6mm}
The abstract should be a brief description of the scope of the paper, not exceeding 100 words in length.

\vspace{14pt}
\fontsize{9}{14}\textbf{Keywords:} 
\textit{at least 3 suitable keywords for indexing purposes}
\vspace{14pt}
\end{@twocolumnfalse}
]

\section{INTRODUCTION}
 \bla bla bla 
\end{document}

此 \cmcsans 命令用于在页眉上添加文本。正如我所说,这在我的旧电脑上运行良好,但在 Windows 10 机器上,当我使用 pdflatex 进行编译时,我收到以下警告(并且 pdf 只包含文本所在的方块):

...
...
pdflatex.exe (file C:/Users/erva/AppData/Local/MiKTeX/2.9/fonts/truetype/comic.ttf): glyph `t' not found
pdflatex.exe (file C:/Users/erva/AppData/Local/MiKTeX/2.9/fonts/truetype/comic.ttf): glyph `y' not found><C:/Program Files/MiKTeX 2.9/fonts/type1/public/amsfonts/cm/cmex10.pfb><C:/Program Files/MiKTeX 2.9/fonts/type1/public/amsfonts/cm/cmmi10.pfb><C:/Program Files/MiKTeX 2.9/fonts/type1/public/amsfonts/cm/cmr10.pfb><C:/Program Files/MiKTeX 2.9/fonts/type1/public/amsfonts/cm/cmsy10.pfb><C:/Program Files/MiKTeX 2.9/fon

我尝试按照这里建议的方式去做:http://william.famille-blum.org/software/latexttf/index.html但它不起作用。字体相关文件似乎已被正确复制,但我的文件仍然无法正确编译。

有谁知道这里出了什么问题,以及未找到字形‘y’警告是什么意思?如何修复?

我还发现,如果我在上面 \cmcsans 的定义中更改“comic”,我将获得文本,但使用“标准”字体。例如,将“test”放在那里,我会收到以下警告:字体形状“T1/test/m/n' undefined(Font) using T1/cmr/m/n' Instead”。但是,对于“comic”,我得到的只是方框。这让我怀疑字体确实存在并且被 LaTex 找到,但它有问题。对于新的 Windows 10 机器,无论我做什么,似乎都无法修复它,但在旧电脑上我不需要做任何特别的事情。难道 Windows 在升级到 10 时对这些字体做了任何更改吗?

非常感谢您的帮助,我真的正在努力解决这个问题。

答案1

原因是 Windows 10 中更新了 Comic Sans MS 字体(可能更早)。如果您从旧系统(Windows 7 版本可以)获取字体文件(comic.ttf)并将其与您的 TeX 文件放在同一个文件夹中(或 TeX 可以找到它的地方),那么一切都应该可以正常工作。

相关内容