按照这个答案问题,我尝试使用以下代码仅向行添加标题,但结果却是标题出现在一行中,而图片出现在下一行中,依此类推。所以如果有人能提供建议的话。
这些是使用的包:
\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}}
这是我的身材:
\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}
答案1
基本上,图像太大了。对于这个问题,限制尺寸是高度,而不是宽度。(仔细想想,原始问题也是如此。)
\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}