Ctex插入matlab代码编译出现! LaTeX Error: Command \textquotesingle unavailable in encoding OT1

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/lqzdreamer/article/details/79862346

最近在写一个东西的时候,需要在LaTeX文件中插入matlab的代码,但是在按照Latex 中插入 Matlab 代码下载了mcode(matlab)用于LaTeX插入代码的宏包后,美赛如何在Latex中插入Matlab代码的方法对mcode进行了宏包配置后,进行编译,出现如下报错

! LaTeX Error: Command \textquotesingle unavailable in encoding OT1.
See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.

后来经查阅资料,是因为m代码中遇到了单引号,查看mcode.sty文件发现:

% Check if textcomp has been loaded (this package is needed for
% upright quotes '' (instead of typographic ones `´)...
\ifx\textquotesingle\undefined% 
  \RequirePackage{textcomp}%
\fi

需要添加textcomp包,因此在usepackage部分加入:

\usepackage{textcomp}

即可。

猜你喜欢

转载自blog.csdn.net/lqzdreamer/article/details/79862346