图像信息处理模板

xelatex编译加粗楷体为什么会失败?

引自https://www.zhihu.com/question/58456658

第一种方法:pdflatex编译
第二种方法:

%全局打开伪体 
\documentclass[UTF8, AutoFakeBold]{ctexbook} 
\begin{document} 
\kaishu{楷书}
\bfseries\kaishu{使用伪粗体的楷书} 
\end{document} 

第三种方法:

\documentclass [UTF8]{ctexart}
 \let\kaishu\relax%清除定义
\newCJKfontfamily\kaishu(KaiTi}[AutoFakeBold]%重定义 kaishu
\begin{document}
\kaishu{楷书}
 \bfseries\kaishu{使用伪粗体的楷书} 
 \end{document}

正文

下面是正文

dip.cls:

\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{diprep}[done by Wang Erhe]
\LoadClass[UTF8,AutoFakeBold]{ctexart}%支持粗体
\RequirePackage{geometry}%页边距调整
\RequirePackage{setspace}%行距调整
\RequirePackage{graphicx}%图片支持
\RequirePackage{float}%图片强制放置
\RequirePackage{amsmath}%公式换行
\RequirePackage{xcolor} %代码着色
\RequirePackage{listings}%代码支持
\RequirePackage{ctex}%需要中文
\RequirePackage{fontspec}%代码字体修改
\RequirePackage{titlesec}%段标题格式修改

\geometry{
	a4paper,
	left=2.54cm,
	right=1.5cm,
	top=1cm,
	bottom=2.54cm
}%页边距调整
\linespread{2}%行距调整

%代码调整
\definecolor{mygreen}{rgb}{0,0.6,0}
\definecolor{mygray}{rgb}{0.5,0.5,0.5}
\definecolor{mymauve}{rgb}{0.58,0,0.82}
\linespread{1.5}%行距调整
\setmonofont{Consolas}
\lstset{
	backgroundcolor=\color{white},   % choose the background color
	basicstyle=\ttfamily\footnotesize, % size of fonts used for the code或改成\small\monaco稍大
	numbers=left,                        % 设置行号
	numberstyle=\footnotesize,            % 设置行号字体大小
	columns=fullflexible,
	breaklines=true,                 % automatic line breaking only at whitespace
	captionpos=b,                    % sets the caption-position to bottom
	tabsize=4,                       % 把tab扩展为4个空格,默认是8个太长
	commentstyle=\color{mygreen},    % 设置注释颜色
	keywordstyle=\color{blue},       % 设置keyword颜色
	stringstyle=\color{mymauve},     % string literal style
	frame=single,                        % 设置有边框
	rulesepcolor=\color{red!20!green!20!blue!20},
	identifierstyle=\color{black},
	language = c,
}


\renewcommand{\thesection}{\chinese{section}}
\titleformat{\section}{\Large}{\thesection\,、}{1ex}{}

\let\kaishu\relax%定义
\newCJKfontfamily\kaishu{KaiTi}[AutoFakeBold]%重定义 kaishu

\newcommand{\cover}[9]{
	\begin{figure}[t]
		\centering
		\includegraphics[height=1.1cm,width=4.3cm]{#1}
		{\huge\kaishu\bfseries 实验报告}%在tex中可以实现效果的,但是在cls中就不行,迷。
		\qquad\qquad
		\parbox[b]{4.5cm}{
			专业:#2\\
			
			\vspace{-1.5ex}
			姓名:#3\\
			
			\vspace{-1.5ex}
			学号:#4\\
			
			\vspace{-1.5ex}
			日期:#5年#6月#7日\\
		}
	\end{figure}
	\vspace{6ex}
	\parbox{0.8\linewidth}{
		课程名称:\underline{\hbox to 0.25\linewidth{\hfill 图像信息处理 \hfill}}
		指导老师:\underline{\hbox to 0.2\linewidth{\hfill #8\hfill}}
		成绩\underline{\hbox to 0.15\linewidth{\hfill \hfill}}\\
		实验名称:\underline{\hbox to 0.5\linewidth{\hfill #9\hfill}}
	}

	\vspace*{6ex}
}


dip-demo.tex

\documentclass{diprep}
%想实现实验报告四个字的粗体,使用pdfLatex编译,但是无法实现代码字体变换,建议还是xelatex编译

\begin{document}
	\cover{logol}{计算机科学与技术}{张三}{3190000000}{2021}{2}{10}{宋明黎}{双边滤波}
	\section{插入图片}
	\begin{figure}[H]
		\centering
		\includegraphics[width=0.7\linewidth]{logol}
		\caption{浙江大学的校名}
		\label{fig:logol}
	\end{figure}
	
	\section{插入代码}
	\lstinputlisting{mode.cpp}
\end{document}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值