LaTeX论文写作的一些用法记录

常用宏包汇总

\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环境,采用宏包graphicxsubfigure
下面是一个两个图的例子,当然更多图也是可以滴

\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}

subfigure

关于其他用法,下面给出一些参考
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}{
   *}{
   \rotatebo
  • 1
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值