LaTex中的浮动和图片问题 [英] Problem with float and pictures in LaTex

查看:1427
本文介绍了LaTex中的浮动和图片问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

图片位于标题的位置: http://dl.getdropbox.com/u/175564/%20latex1.png

The picture is at the position of the header: http://dl.getdropbox.com/u/175564/%20latex1.png

代码:

\begin{figure}
   \subfloat[A gull]{\label{fig:gull}\includegraphics[width=0.15\textwidth]{p1.png}}
   \subfloat[A tiger]{\label{fig:tiger}\includegraphics[width=0.15\textwidth]{p2.png}}
   \caption{Pictures of animals}      
   \label{fig:animals}      
\end{figure}

\ begin {document}之前的代码:

Code before \begin{document}:

\documentclass[12pt,a4paper, notitlepage]{article}
\usepackage[english]{babel}           
\usepackage[latin1]{inputenc}   

\usepackage{amsmath}            
\usepackage{amsfonts}           
\usepackage{amssymb}

\usepackage{graphicx}
\usepackage{amsthm}
\usepackage{fancyhdr}

\usepackage{verbatim}           % by \begin{comment}---\end{comment}
\usepackage{subfig}                
\usepackage{lastpage}

\usepackage{fancyhdr}
\usepackage{float}
\usepackage{subfig}

\floatstyle{ruled}
\newfloat{program}{thp}{lop}   

\floatname{program}{Program}
\cfoot{\ }  
\renewcommand{\headrulewidth}{0pt} 

\renewcommand{\footrulewidth}{0pt}
\title{Applying a} 

什么可能是问题的原因?

What could be the cause of the problem?

推荐答案

数字浮动.

也就是说,TeX移动它们以适应其排版需求.您可以选择指定TeX要尝试使用的位置类型:

That is, TeX moves them around to accommodate its typesetting needs. You have the option of specifying what types of places you want TeX to try to put them using:

\begin{figure}[htpb]
   ...
\end{figure}

其中的选项含义:

h -- here
t -- top
b -- bottom
p -- page (on a page-o-floats)
H -- Absolutely right here (but requires the `float` package)

在选项中使用!将告诉TeX尝试 hard 将其放在源文件中与之相邻的地方.默认位置是tbp,因此,除非您要求,否则"here"都不是一个选项.另外请注意,选项的顺序无关紧要,因此[p!bh]的结果与[!hbp]相同.

Using ! in the options will tell TeX to try hard to put it near the things it is adjacent to in the source file. The default positioning is tbp, so "here" is not even an option unless you ask for it. Also note that the ordering of the options is irrelevant, so [p!bh] will give the same result as [!hbp].

因此,尝试 \begin{figure}[h!] (如果已经完成\usepackage{float},则尝试 \begin{figure}[H] )

So try \begin{figure}[h!] (or \begin{figure}[H] if you have already done \usepackage{float})

相同的选项可用于表和您定义的任何其他浮点数.

The same options are available for tables and any other floats you define.

这篇关于LaTex中的浮动和图片问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆