常用宏包汇总
\usepackage{
amsmath}
\usepackage{
booktabs}
\usepackage{
amssymb}
\usepackage{
amsbsy}
\usepackage{
multirow}
%\usepackage{float}
\usepackage{
graphicx}
\usepackage{
subfigure}
\usepackage{
array}
\usepackage{
caption}
\usepackage{
url}
%\usepackage{algorithmic}
%\usepackage{algorithm}
%\usepackage{algorithmic}
%\usepackage{algpseudocode}
%\usepackage{pseudocode}
%\usepackage{algorithm}
\usepackage{
algorithmic}
\usepackage{
array}
\newcolumntype{
L}[1]{
>{
\raggedright\let\newline\\\arraybackslash\hspace{
0pt}}m{
#1}}
\newcolumntype{
C}[1]{
>{
\centering\let\newline\\\arraybackslash\hspace{
0pt}}m{
#1}}
\newcolumntype{
R}[1]{
>{
\raggedleft\let\newline\\\arraybackslash\hspace{
0pt}}m{
#1}}
图片
* 测试图片来源 半次元:巨蜥不是十晰x [手动眨眼]
基本用法
\begin{
figure}[Htbp]
\centering % 居中对齐
\includegraphics[width=0.7\textwidth]{
test.pdf}
\caption{
Add caption here.}
\label{
Fig:test}
\end{
figure}
图片对齐
上例是居中对齐,对应的还有左对齐和右对齐。
\begin{
figure}[htbp]
\raggedright % 左对齐
\includegraphics[width=0.3\textwidth]{
test.jpg}
\caption{
align left.}
\label{
Fig:tag_left}
\end{
figure}
\begin{
figure}[htbp]
\raggedleft % 右对齐
\includegraphics[width=0.3\textwidth]{
test.jpg}
\caption{
align right.}
\label{
Fig:tag_right}
\end{
figure}
关于对齐还有其他的实现方式
Syntax similar to \centering for right and left?
一种方式是利用adjustbox 宏包,但是一般CTEX(老版本,新版本不造)并没有安装这个宏包,学不来的,散了散了
\documentclass{article}
\usepackage[export]{adjustbox}
\begin{document}
\begin{figure}
\includegraphics[width=.6\textwidth,center]{example-image}
\caption{centered image}
\end{figure}
\begin{figure}
\includegraphics[width=.6\textwidth,left]{example-image}
\caption{left aligned image}
\end{figure}
\begin{figure}
\includegraphics[width=.6\textwidth,right]{example-image}
\caption{right aligned image}
\end{figure}
\end{document}
还有几种方式一并列下:
\begin{
figure}[htbp]
\flushleft % 左对齐,对应\flushright右对齐
\includegraphics[width=0.3\textwidth]{
test.jpg}
\caption{
flushright.}
\end{
figure}
\begin{
figure}
\hfill\includegraphics[width=0.3\textwidth]{
test.jpg} %暴力右对齐
\caption{
\texttt{
hfill}}
\end{
figure}
\begin{
figure}
%这里利用了一个minipage环境,其实区别在于caption上
\hfill\begin{
minipage}{
.5\textwidth}\centering
\includegraphics{
n}
\caption{
\texttt{
minipage}}
\end{
minipage}
\end{
figure}
多图片排版
我常用的是subfigure环境,采用宏包graphicx和subfigure
下面是一个两个图的例子,当然更多图也是可以滴
\begin{
figure}[htbp]
\centering
\subfigure[caption for 1]{
\label{
Fig.sub.1}
\includegraphics[width=0.4\textwidth]{
test.jpg}}
\subfigure[caption for 2]{
\label{
Fig.sub.2}
\includegraphics[width=0.4\textwidth]{
test.jpg}}
\caption{
Subfigure with two imgs.}
\label{
Fig:demo_sub}
\end{
figure}
关于其他用法,下面给出一些参考
Insert multiple figures in Latex
Placing figures/tables side-by-side (\subfig)
How to arrage multiple figures?
***Using the multirow environment
采用multirow和multicolumn能解决大部分的排版问题,这里采用multirow方式的源码和结果如下:
\documentclass[a4paper]{
article}
\usepackage[demo]{
graphicx}
\usepackage{
multirow}
\begin{
document}
\begin{
figure}[h]
\centering
\begin{
tabular}{
c@{
}c@{
}}
\multirow{
-6}{
*}{
\includegraphics[height=1cm,angle=90]{
vertical.jpg}}
&
\begin{
tabular}{
l}
\includegraphics[trim = 0mm 0mm 0mm 0mm, clip, width=0.7\linewidth]{
1.jpg} \tabularnewline
\includegraphics[trim = 0mm 0mm 0mm 0mm, clip, width=0.7\linewidth]{
1.jpg} \tabularnewline
\includegraphics[trim = 0mm 0mm 0mm 0mm, clip, width=0.7\linewidth]{
1.jpg} \tabularnewline
\end{
tabular} \tabularnewline
& \multicolumn{
1}{
c}{
\includegraphics[width=0.4\linewidth,height=1cm]{
horizontal.jpg}}
\end{
tabular}
\caption{
Test}
\label{
figTest}
\end{
figure}
\begin{
figure}[h]
\centering
\begin{
tabular}{
c@{
}c@{
}}
\multirow{
-4}{
*}{
\rotatebox