美文网首页
LATEX使用笔记

LATEX使用笔记

作者: Babyang1991 | 来源:发表于2019-05-30 19:29 被阅读0次

Latex中常用的结构实现


1. 图表并列实现方法

1.1. (表的caption在上,图的caption在下)代码:

\documentclass{article}
\usepackage{floatrow}
\usepackage[demo]{graphicx}

\begin{document}

\begin{figure}[t]
\CenterFloatBoxes
\begin{floatrow}
\ffigbox
  {\includegraphics[width=0.4\textwidth]{example}}
  {\caption{A caption for a figure in a figure and a table side by side}\label{fig:test}}
\killfloatstyle
\ttabbox
  {\begin{tabular}{ll}
    \hline
    column1a & column2a \\
    column1b & column2b \\
    column1c & column2c \\
    \hline
  \end{tabular}
  }
  {\caption{A caption for a table in a figure and a table side by side}\label{tab:test}}
\end{floatrow}
\end{figure}

\end{document}

1.2. 图表并列效果:

图表并列

引用自:https://tex.stackexchange.com/questions/101980/table-and-figure-side-by-side-with-table-caption-above-figure-caption-below

1.3. (图表的caption均在下)代码:

\documentclass{article}
\usepackage[demo]{graphicx}
\usepackage{capt-of}% or \usepackage{caption}
\usepackage{booktabs}
\usepackage{varwidth}
\newsavebox\tmpbox

\begin{document}
\begin{table}[ht]
  \sbox\tmpbox{%
    \begin{tabular}[b]{ l r r r }
      \toprule
      Student & Hours/week & Grade \\
      \midrule
      Ada Lovelace & 2 & A \\
      Linus Thorvalds & 8 & A \\
      Bruce Willis & 12 & F \\
      Richard Stallman & 10 & B \\
      Grace Hopper & 12 & A \\
      Alan Turing & 8 & C \\
      Bill Gates & 6 & D \\
      Steve Jobs & 4 & E \\
      \bottomrule
    \end{tabular}%
  }%
  \renewcommand*{\arraystretch}{0}
  \begin{tabular*}{\linewidth}{@{\extracolsep\fill}p{\wd\tmpbox}p{40mm}@{}}
    \usebox\tmpbox &
    \includegraphics[width=\linewidth]{image} \\
    \caption{Student Database}
    \label{table:student}
    &
    \captionof{figure}{2-D scatterplot of the Student Database}
    \label{fig:image}
  \end{tabular*}
\end{table}
\end{document}

1.4. 图表并列效果:

图标并列

引用自:https://tex.stackexchange.com/questions/265889/table-and-figure-side-by-side-with-minipages

相关文章

网友评论

      本文标题:LATEX使用笔记

      本文链接:https://www.haomeiwen.com/subject/vwhbtctx.html