latex: 在article文档环境(multicols)中, 使用begin{figure}无法显示的问题
来源:互联网 发布:域名注册软件 编辑:程序博客网 时间:2024/05/28 05:15
参考:Image not showing up when using figure environment,multicols宏包插入图片丢失,怎么办?
问题描述:在article环境下,使用begin{figure}无法显示图片,例子如下:
\documentclass[]{article}\usepackage{multicol} % Used for the two-column layout of the document\usepackage{amsmath}\usepackage{graphicx}\graphicspath{ {pics/} }\title{\vspace{-15mm}\fontsize{24pt}{10pt}\selectfont\textbf{Lorem ipsum}} % Article title\begin{document}\maketitle % Insert title\begin{multicols}{2} %%This does not show up\begin{figure}[h] \includegraphics[width=.4\textwidth]{generalPolya}\end{figure}%This shows up.\begin{center} \includegraphics[width=.5\textwidth]{chair}\end{center}\end{multicols}\end{document}
问题分析:通过测试,发现\begin{figure}并不能显示,因为在multicols环境中不能使用figure环境,log中会有warning,故存在问题。
Package multicol Warning: Floats and marginpars not allowed inside `multicols' environment!.
解决方法:
方案一、参见ctex-faQ,59个问题。摘录如下:
如果你使用的是LATEX 标准文档类的twocolumn 模式,那么使用figure 和table 环境可以产生单列的
浮动图形或者表格,而使用figure* 和table* 环境则可以产生通栏的浮动图形或者表格。
如果你使用的是multicol 宏包提供的multicols 环境,那么就有一点小问题了。figure 和table 在这种方式下无法正常工作,会导致图形或者表格丢失。但是, figure* 和table* 仍然可以正常工作,产生通栏的浮动图形或者表格,就像在标准文档类的twocolumn 模式下一样。
要在multicols 环境中使用单栏的图形或者表格,可以使用float 宏包提供的[H] 位置选项。例如
...
\caption{...}
\end{figure}
但是要注意的是,这种方式产生的对象是不能“浮动”的,也就是说位置是固定的。因此,有时候你必须仔细调整它的位置,以免造成分栏的底部参差不齐。
方案二、在双栏环境下,我们可以不使用figure。可以直接插入图片,居中的话可以用center环境。若是想使用caption和label,导言区加入代码:
\makeatletter\def\@captype{figure}\makeatother\caption{???}\label{xxx}
这样会让图和表格的标题都以figure ,若是table也正常的话。每次使用前修改为\makeatletter
\def\@captype{table}
\makeatother
或者重新定义为:
\makeatletter
\newcommand\figurecaption{\def\@captype{figure}\caption}
\newcommand\tablecaption{\def\@captype{table}\caption}
\makeatother
然后用\figurecaption{XXX}和\tablecaption{XXX}来加标题吧!
方案三、定义新的环境来使用。
\makeatletter\newenvironment{tablehere} {\def\@captype{table}} {}\newenvironment{figurehere} {\def\@captype{figure}} {}\makeatother
我们直接使用 figurehere 和 tablehere环境就可以了。
- latex: 在article文档环境(multicols)中, 使用begin{figure}无法显示的问题
- 关于使用Adoeb SVG Viewer在IE中无法正常显示SVG文档的问题
- latex中在\begin{equation}输入空格的方法
- Latex中常用的几个\begin
- 使用MathJax在HTML中显示LaTeX
- HTML:使用绝对路径插入图片后在浏览器中无法显示的问题
- 一个关于WORD文档在网页中显示的问题!
- 一个关于WORD文档在网页中显示的问题!
- 一个关于WORD文档在网页中显示的问题!
- 一个关于WORD文档在网页中显示的问题!
- Latex Tools在OSX EI Captain无法编译的问题
- LaTex文档的输入问题
- 解决java中html转word文档,转成功后的word文档在断网情况下无法显示图片问题
- Latex插入代码中文无法显示问题
- 有关Applet无法在IE中显示问题的解答!
- CMYK图片在IE中无法显示的问题
- Android Fragment无法在headview中显示的问题
- 有关sublime中在文档中正确显示中文,而在cmd中无法正确显示的探究
- angular源码目录结构
- Scala排序简写及效率
- 使用Java和JS访问cookies
- IOS消息推送之APNS
- cruskal算法求最小支撑树 打印支撑树的边集合 带图例
- latex: 在article文档环境(multicols)中, 使用begin{figure}无法显示的问题
- 计算两个中文字符串相似度——编辑距离算法
- gfirefly 学习之ubuntu 15 python 配置python (2)
- android 网络编程(二、IO流)
- LeetCode Kth Smallest Element in a BST DFS
- 名词
- IplImage, Mat, CvMat之间转换
- 之前项目中用到Spring+Quartz实现定时任务的配置方法
- IOS开发----UISearchBar,搜索框的使用