Latex插圖位置控制

轉自:http://blog.sina.com.cn/s/blog_5e16f1770102dvai.html

排版:https://latexref.xyz/Floats.html#Floats

QQ羣:91940767/145316219/141877998/80300084/194770436
淘寶店:http://latexstudio.taobao.com
技巧續篇:http://latexstudio.net/
常見數學公式問題集下載

平時投稿或者寫文章,尤其是雙欄模式下總是想要把圖片放在我們想要她在的位置,非常考驗我們的代碼水平,特別是下面這種情況:雙欄模式下插入單欄圖,一般情況下,期刊給出的是使用\begin{figure*}[t] .... \end{figure*} 進而,圖片會放到下一頁置頂位置,很多用戶想把圖片放到當前頁底部該怎麼辦呢?

【解決方案】
演示代碼如下:
   \documentclass[a4paper,10pt,twocolumn]{article}
   \usepackage{graphicx,dblfloatfix,caption,afterpage}
   \usepackage[english]{babel}
   \usepackage{blindtext}
   \begin{document}
   \tableofcontents
   \section{Zero}
   \blindtext[1]

   \blindtext[1]

   %\afterpage{\newpage} % bottom on third page
   %\afterpage{\clearpage} % cuts a column, bottom on third page

   \blindtext[1]

   \blindtext[1]

   \begin{figure}[!h]
     \centering
     \includegraphics{test.jpg}
     \caption{test picture 1}
   \label{fig:1}
   \end{figure}

   \blindtext[1]

   \begin{figure}[!h]
     \centering
     \includegraphics{test.jpg}
     \caption{test picture 2}
   \label{fig:2}
   \end{figure}

   %\afterpage{\newpage} % bottom on third page
   %\afterpage{\clearpage} % bottom on third page

    % save counter
   \newcounter{savefig}
   \setcounter{savefig}{\value{figure}}
    % step preemptively
   \stepcounter{figure}

    % figure* MUST be declared before first \newpage!
    % so in this case, it is declared (still) within pg1.
   \begin{figure*}[!b]
     \centering
     \includegraphics{test.jpg}
     \caption{test picture dbl}
   \label{fig:dbl}
   \end{figure*}

    % reset counter
   \setcounter{figure}{\value{savefig}}

   \afterpage{\newpage} % first newpage: goes from pg1:col2 to pg2:col1

   \blindtext[1]

   %\afterpage{\clearpage % alone
    %}

   %\newpage~\newpage % clears everything prematurely, but manages to put minipage and bottom on same page
   %\afterpage{\clearpage} %

   \section{One}
    A bit of bla bla bla here...

    A bit of bla bla bla...

   \begin{figure}[h]
     \centering
     \includegraphics{test.jpg}
     \caption{test picture 3}
   \label{fig:3}
   \end{figure}

   %\noindent\begin{minipage}{\columnwidth}
   %\captionsetup{type=figure}
    \centering
    \includegraphics{test.jpg}
    \caption{test picture 3}
   %\label{fig:3}
   %\end{minipage}


   \blindtext[1]

   \afterpage{\newpage}  % second newpage: goes from pg2:col1 to pg2:col2

   \blindtext[1]

   \section{Two}
   \blindtext[1]

   \afterpage{\newpage} % third newpage: goes from pg2:col2 to pg3:col1; AND
    % seemingly this 'flushes' the bottom float, which will now appear on pg2!

    % step post-emptively
    % (as here the bottom, Fig4 should be inserted - so we're ready for Fig5 next)
   \stepcounter{figure}

   \blindtext[1]

   \blindtext[1]

   \begin{figure}[h]
     \centering
     \includegraphics{test.jpg}
     \caption{test picture 5}
   \label{fig:5}
   \end{figure}

   \blindtext[1]

   \end{document}

效果哦:
LaTeX技巧567:latex <wbr>如何在頁面下方插入圖形

 

2、更新20200105

關於cas-dc模板標題不居中問題的解決。

%\begin{figure*}
 {figure*}
% \begin{figure*}[pos=b,width=\textwidth]% 需要這一句解決問題
\begin{figure*}[pos=htb]
    \centering
    \includegraphics[scale=0.62]{figs/OverviewFig.pdf}
    \caption{Simulation results on a T1-weighted simulated brain MR image (9\% noise, 40\% IIH). Left to right: Original image, Bias field (IIH), CSF, GM, and WM regions, IIH-corrected
image and final segmented image.}
    \label{Fig:OverviewFig}
\end{figure*}

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章