Skip to content

Instantly share code, notes, and snippets.

@kasnder
Last active May 6, 2022 22:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kasnder/e03d7f0fb828be371a2d1237ad60f4cd to your computer and use it in GitHub Desktop.
Save kasnder/e03d7f0fb828be371a2d1237ad60f4cd to your computer and use it in GitHub Desktop.
Responsive figures for ACM TAPS submission. UPDATE: While this script theoretically works, the TAPS system is actually not compatible with it (despite it being legitimate Latex code).
%insert before \begin{document}
\usepackage{wrapfig}
\makeatletter%
\newenvironment{responsivefig}[2]{%
\if@twocolumn%
\begin{figure}%
\else%
\wrapfigure{#1}{#2}%
\fi%
}{%
\if@twocolumn%
\end{figure}%
\else%
\endwrapfigure%
\fi%
}%
\makeatother
@kasnder
Copy link
Author

kasnder commented Apr 23, 2022

When submitting academic articles to the Association for Computing Machinery (ACM), one now needs to provide a LaTex document that can be compiled into both single-column HTML and two-column PDF.

This snippet creates a responsive figure that is compatible with both formats. For the HTML, this snippet creates a figure around which the rest of the text flows on the left-hand side, using the wrapfig package. For the PDF, this snippet chooses the standard figure environment.

Integrate with:

\begin{responsivefig}{r}{0.5\textwidth}
  %\centering
  \includegraphics[width=0.95\linewidth]{figures/organisation.pdf}
  \caption{Overview of our analysis methodology.}
    \label{fig:method_flow}
\end{responsivefig}

@kasnder
Copy link
Author

kasnder commented May 6, 2022

UPDATE: While this script theoretically works, the TAPS system is actually not compatible with it (despite it being legitimate Latex code).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment