编写 LaTeX 文档时排除表格、图形和参考文献

编写 LaTeX 文档时排除表格、图形和参考文献

在一篇较长的文档中,我想在编译时排除表格、图表和参考文献。需要使用命令排除这些环境,而不是删除它们。以下是一份测试文档。任何帮助完成任务的帮助都将不胜感激。谢谢

\documentclass[a4paper,12pt]{article}

\usepackage[english]{babel}
\usepackage{graphicx}

\begin{document}

\begin{figure}
  \caption{A picture of a gull.}
  \centering
    \includegraphics[width=0.5\textwidth]{gull}
\end{figure}

\begin{figure}
  \centering
    \reflectbox{%
      \includegraphics[width=0.5\textwidth]{gull}}
  \caption{A picture of the same gull
           looking the other way!}
\end{figure}

\begin{table}
  \centering
    \begin{tabular}{| l c r |}
    \hline
    1 & 2 & 3 \\
    4 & 5 & 6 \\
    7 & 8 & 9 \\
    \hline
    \end{tabular}
  \caption{A simple table}
\end{table}

Notice how the tables and figures
have independent counters.

\end{document}

在此处输入图片描述

答案1

除了 Christian Hupfer 提到的出色选项之外draft,还有一个真正去除浮动的解决方案。它使用包environ

\documentclass[a4paper,12pt]{article}

\usepackage[english]{babel}
\usepackage{graphicx}
\usepackage{environ}

\RenewEnviron{figure}{}
\RenewEnviron{table}{}

\begin{document}

\begin{figure}
  \caption{A picture of a gull.}
  \centering
    \includegraphics[width=0.5\textwidth]{example-image-a}
\end{figure}

\begin{figure}
  \centering
    \reflectbox{%
      \includegraphics[width=0.5\textwidth]{example-image-a}}
  \caption{A picture of the same gull
           looking the other way!}
\end{figure}

\begin{table}
  \centering
    \begin{tabular}{| l c r |}
    \hline
    1 & 2 & 3 \\
    4 & 5 & 6 \\
    7 & 8 & 9 \\
    \hline
    \end{tabular}
  \caption{A simple table}
\end{table}

Notice how the tables and figures
have independent counters.

\end{document}

相关内容