当前位置:网站首页>【latex异常和错误】Missing $ inserted.<inserted text>You can‘t use \spacefactor in math mode.输出文本要注意特殊字符的转义
【latex异常和错误】Missing $ inserted.<inserted text>You can‘t use \spacefactor in math mode.输出文本要注意特殊字符的转义
2022-08-11 06:12:00 【键盘即钢琴】
一、背景
问题代码如下
\documentclass{article}
\usepackage{verbatim}
\usepackage{amsmath}
\begin{document}
Roman number_XII\@. Yes.
\end{document}
使用xelatex引擎进行渲染后,出现下面的错误——【Missing $ inserted.<inserted text>】和【You can't use `\spacefactor' in math mode.\@->\spacefactor 】
二、解决方法
参考:Getting the error "Missing $ inserted" in LaTeX - Stack Overflow
由于下划线符号_属于数学公式中的下标符号,所以正文出现它的时候,应该予以转义;不然就会让引擎误以为这是公式的代码,从而警告用户为啥不加公式环境符$$。
知道原因后,我们在正文部分将_用\转义,结果就正常输出了。
或者,用逐字输出命令\verb将所有符号原封不动地输出出来,而不需要考虑对特殊符号(比如下划线符号_,再比如分组符号{},再比如公式环境符号$,当然还有其他)的转义。
\documentclass{article}
\usepackage{verbatim}
\usepackage{amsmath}
\begin{document}
Roman number\_XII\@. Yes.\\
\verb!Roman number_XII\@. Yes.!
\end{document}
渲染结果
边栏推荐
- Depth (relay supervision)
- 技术分享 | 实战演练接口自动化如何处理 Form 请求?
- 那些事情是用Unity开发项目应该一开始规划好的?如何避免后期酿成巨坑?
- Do not add the is prefix to the variables of the boolean type in the POJO class of the Alibaba specification
- 亚马逊API接口大全
- Daily sql-employee bonus filtering and answer rate ranking first
- redis + lua实现分布式接口限流实现方案
- 《Show and Tell: A Neural Image Caption Generator》论文解读
- prometheus学习5altermanager
- 获取拼多多商品信息操作详情
猜你喜欢
随机推荐
Coordinate system in navigation and positioning
concept noun
Douyin API interface
maxwell 概念
恒源云-Pycharm远程训练避坑指南
HCIA knowledge review
Strongly recommend an easy-to-use API interface
Douyin get douyin share password url API return value description
A used in the study of EEG ultra scanning analysis process
抖音API接口
接入网、承载网、核心网是什么,交换机路由器是什么、这个和网络的协议有什么关系呢?
Taobao API interface reference
Daily sql-statistics of the number of professionals (including the number of professionals is 0)
What are the things that should be planned from the beginning when developing a project with Unity?How to avoid a huge pit in the later stage?
空间金字塔池化 -Spatial Pyramid Pooling(含源码)
Find the shops that have sold more than 1,000 yuan per day for more than 30 consecutive days in the past six months
Daily SQL - find each of the students school gpa minimum (window)
STM32CUBEIDE(11)----输出PWM及修改PWM频率与占空比
淘宝sku API 接口(PHP示例)
pytorch,numpy两种方法实现nms类间+类内