1

Following the answer found in this question , I've tried to use the below code to add titles to only the rows, but what happens is that the title appears in a line then the picture in the line under and so on. So if anyone could please advise.

These are the packages used:

\usepackage{float} 
\usepackage[centertags]{amsmath} 
\usepackage{amsfonts} 
\usepackage{amssymb} 
\usepackage{amsthm} 
\usepackage{tabularx} 
\usepackage{comment} 
\usepackage{newlfont} 
\usepackage{xtocinc} 
\usepackage{graphicx} 
\usepackage{changebar} 
\usepackage{subfig} 
\usepackage{algorithmic} 
\usepackage{subfloat} 
\usepackage{multirow} 
\usepackage{booktabs} 
\usepackage{cite} 
\usepackage{amsmath} 
\usepackage[T1]{fontenc} 
\usepackage{tabularx,booktabs,ragged2e}
\newlength{\tempdima}
\newcommand{\rowname}[1]% #1 = text
{\rotatebox{90}{\makebox[\tempdima][c]{\textbf{#1}}}}

\newcounter{subfigure}[figure]
\renewcommand{\thesubfigure}{\alph{subfigure}}
\newcommand{\mycaption}[1]% #1 = caption
{\refstepcounter{subfigure}\textbf{(\thesubfigure) }{\ignorespaces #1}}

This is my figure:

\begin{figure}
\setlength{\tempwidth}{\linewidth}
\settoheight{\tempheight}{\includegraphics[width=\tempwidth]{pic1.png}}%
\centering
\hspace{\baselineskip}
\rowname{Exp 1}
\subfloat{\includegraphics[width=\tempwidth]{pic2.png}}\label{pic1}\\
\rowname{Exp 2}
\subfloat{\includegraphics[width=\tempwidth]{pic3.png}}\label{pic2}\\
\rowname{Exp 3}
\subfloat{\includegraphics[width=\tempwidth]{pic4.png}}\label{pic3}\\
\rowname{Exp 4}
\subfloat{\includegraphics[width=\tempwidth]{pic5.png}}\label{pic4}\\
\rowname{Exp 5}
\subfloat{\includegraphics[width=\tempwidth]{pic6.png}}\label{pic5}
\caption{This is the caption}
\label{fig1}
\end{figure}
  • A full MWE (Minimal Working Example) can be copied and used by anyone. Please add in the \documentclass, \usepackages, custom macro definitions and use images files from the mwe package. Use my previous answers as a guide. – John Kormylo Apr 23 '15 at 2:17
  • Okay. I will now. – Tak Apr 23 '15 at 2:25
2

Basically, the image is just too big. For this problem, the limiting dimension is the height, not the width. (Come to think of it, this was also true in the original question.

\documentclass{report}
\usepackage{subfig}
\usepackage{mwe}

\newlength{\tempheight}
\newlength{\tempwidth}

\newcommand{\rowname}[1]% #1 = text
{\rotatebox{90}{\makebox[\tempheight][c]{\textbf{#1}}}}

\newcommand{\columnname}[1]% #1 = text
{\makebox[\tempwidth][c]{\textbf{#1}}}

\begin{document}
\begin{figure}
\setlength{\tempheight}{0.18\textheight}
\settowidth{\tempwidth}{\includegraphics[height=\tempheight]{example-image}}% not needed without \columnname
\centering
\rowname{Exp 1}
\subfloat{\includegraphics[height=\tempheight]{example-image}}\label{pic1}\\
\rowname{Exp 2}
\subfloat{\includegraphics[height=\tempheight]{example-image-a}}\label{pic2}\\
\rowname{Exp 3}
\subfloat{\includegraphics[height=\tempheight]{example-image-b}}\label{pic3}\\
\rowname{Exp 4}
\subfloat{\includegraphics[height=\tempheight]{example-image-C}}\label{pic4}\\
\rowname{Exp 5}
\subfloat{\includegraphics[height=\tempheight]{example-image}}\label{pic5}
\caption{This is the caption}
\label{fig1}
\end{figure}
\end{document}

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.