2

My goal is to create a standalone TeX file containing tabulated figures. No matter what value I set for image width, the resulting table is always too wide for the page. Here is a MWE:

\documentclass[varwidth]{standalone}
\usepackage[pdftex]{graphicx}
\usepackage{geometry}
\usepackage{lscape}
\usepackage{multirow}
\usepackage{subfig}
\def\ig{\includegraphics[width=1in, keepaspectratio]}


\begin{document}
\begin{figure}[!htbp]
\begin{tabular}{p{0.2cm}ccc}
 R1& \subfloat{\ig{example-image-a}} 
   & \subfloat{\ig{example-image-b}} 
   & \subfloat{\ig{example-image-c}}\\[0.4cm]  
   &C1&C2&C3 \\
\end{tabular}
\end{figure}
\end{document}
1
  • Drop the geometry package (or use its pass option). Also, a float environment like figure seems misplaced in a standalone document. Why do you use it? Sep 25 '13 at 17:12
5

The call to geometry is wrong, and also lscape doesn't make sense.

Also figure and \subfloat are not necessary: \includegraphics can go anywhere, it's treated just like a big letter.

\documentclass[border=1,varwidth]{standalone}
\usepackage{graphicx}
\newcommand\ig[1][]{\includegraphics[width=1in, keepaspectratio,#1]}


\begin{document}
\begin{tabular}{p{1cm}ccc}
 R1& \ig{example-image-a}
   & \ig{example-image-b}
   & \ig{example-image-c} \\[0.4cm]
   &C1&C2&C3
\end{tabular}
\end{document}

The definition of \ig allows for additional options.

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.