当旋转 90 度面向左侧时,如何添加适合图形下方的标题?此代码应该可以工作,但我不确定为什么不行,可能是因为标题设置?
以下是代码:
\documentclass[12pt]{report}
\usepackage{graphicx}
\usepackage{geometry}
\usepackage{fixltx2e}
\usepackage{grffile}
\usepackage[font=small,labelfont=bf]{caption}
\usepackage{floatrow}
\usepackage{amsmath}
\usepackage{longtable}
\usepackage[notlof,notlot]{tocbibind}
\usepackage{fancyhdr}
\usepackage{titlesec}
\usepackage{epstopdf}
\usepackage{booktabs}
\usepackage{multirow}
\usepackage{tabularx}
\usepackage{tabu}
\usepackage{ragged2e}
%\usepackage[justification=centering]{caption}
\usepackage[titles]{tocloft}
\usepackage{caption}
\usepackage{tocloft}
\usepackage{graphicx}
\usepackage{rotating}
\newcolumntype{L}{>{\RaggedRight\arraybackslash}X}
\titleformat{\section}
{\normalfont\fontsize{14}{12}\bfseries}{\thesection}{1em}{}
\makeatletter
\renewcommand{\paragraph}{%
\@startsection{paragraph}{4}%
{\z@}{1.2ex \@plus 1ex \@minus .2ex}{-1em}%
{\normalfont\normalsize\bfseries}%
}
\renewcommand{\baselinestretch}{1.0}
\makeatother
\setcounter{secnumdepth}{3}
\begin{document}
\sloppy
\captionsetup{width=\textwidth}
\begin{figure}
\centering
\begin{turn}{-90}
\begin{minipage}{8in}
\centering
\includegraphics[scale=0.6]{reggrid_Vs_Alongtrackgrid.eps}
\caption{A comparison between SSH [mm] averaged between 31$^{st}$ December, 1992 to 9$^{th}$ January, 1993 on a regular grid (top) and SSH [mm] along track during the same period (bottom).}
\label{fig:reggrid_Vs_Alongtrackgrid}
\end{minipage}
\end{turn}
\end{figure}
还有其他人在登录网站时遇到问题吗?我尝试登录,但无法登录,所以我创建了一个新帐户,但仍然出现页面错误。这很烦人,因为我必须创建新问题,而不是在原有问题上添加 :-(
谢谢,迈克尔
答案1
这已经问过了这里。但无论如何,这是适合您的情况。
你不应该调用包caption
和graphicx
两次。然后你需要包adjustbox
来自这里。
最小代码如下:
\documentclass[12pt]{report}
\usepackage[font=small,labelfont=bf]{caption}
\usepackage{graphicx}
\usepackage{adjustbox}
\begin{document}
Some text here.
\begin{figure}[h!]
\begin{adjustbox}{addcode={\begin{minipage}{4in}}{%
\includegraphics[scale=0.6]{noimage}
\caption{A comparison between SSH [mm] averaged between 31$^\mathrm{st}$ December, 1992 to 9$^\mathrm{th}$ January, 1993 on a regular grid (top) and SSH [mm] along track during the same period (bottom).}%
\label{fig:reggrid_Vs_Alongtrackgrid}
\end{minipage}},rotate=90,center}
\end{adjustbox}
\end{figure}
Follow by some text here.
\end{document}
结果是:
答案2
问题不是由 引起的\captionsetup
,如果你通过反复试验删除所有不影响问题的软件包,你就会剩下
\documentclass{report}
\usepackage{floatrow}
\usepackage{graphicx}
\usepackage{rotating}
\begin{document}
\begin{figure}
\centering
\begin{turn}{-90}
\begin{minipage}{8in}
\centering
\includegraphics[width=7cm]{example-image}
\caption{Text}
\label{fig:reggrid_Vs_Alongtrackgrid}
\end{minipage}
\end{turn}
\end{figure}
\end{document}
此代码显示了问题,但如果你删除
\usepackage{floatrow}
它工作正常。我不知道为什么会发生这种情况,也许是floatrow
重新定义\caption
或类似的原因。
如果您仅使用floatrow
来在图形旁边放置标题,则可以将其删除并使用一对s,如下面的代码所示。请注意,我在环境中minipage
更改了 的宽度。minipage
turn
\documentclass{report}
\usepackage{graphicx}
\usepackage{rotating}
\begin{document}
\begin{figure}[h]
\centering
\begin{turn}{-90}
\begin{minipage}{5cm}
\centering
\includegraphics[width=5cm]{example-image}
\caption{Text}
\label{fig:reggrid_Vs_Alongtrackgrid}
\end{minipage}
\end{turn}
\end{figure}
\begin{figure}[h]
\begin{minipage}{.45\linewidth}
\includegraphics[width=5cm]{example-image}
\end{minipage}%
\begin{minipage}{.45\linewidth}
\caption{Annual and semi-annual harmonics calculated from along-track weighted altimetry data.}
\end{minipage}
\end{figure}
\end{document}
正如 Václav Pavlík 所说,没有必要多次加载包。您tocloft
也有两个。