按照在此找到的答案問題,我嘗試使用下面的程式碼僅向行添加標題,但發生的情況是標題出現在一行中,然後圖片出現在下一行中,依此類推。所以如果有人可以請建議。
這些是使用的包:
\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}