![标题中的 flushleft 可以编译,但会出现错误](https://linux22.com/image/413041/%E6%A0%87%E9%A2%98%E4%B8%AD%E7%9A%84%20flushleft%20%E5%8F%AF%E4%BB%A5%E7%BC%96%E8%AF%91%EF%BC%8C%E4%BD%86%E4%BC%9A%E5%87%BA%E7%8E%B0%E9%94%99%E8%AF%AF.png)
所以可能有一种更简单的方法来做到这一点,所以如果我做得太错了,请纠正我的方法,但我已经......
\usepackage[justification=centering, labelfont=bf]{caption}
\begin{document}
\begin{figure}[!ht]
\centering
\framebox{\parbox{0.7\linewidth}{\includegraphics[width= \linewidth]{Picture.jpg}}}
\caption{\textbf{Title if you will but centred and bold}
\begin{flushleft}
Fairly concise but slightly longer description of the figure but all text to be aligned to the left
margin as per the main body of text.
\end{flushleft}}
\label{mylabel}
\end{figure}
\end{document}
我的代码运行良好,但收到两个错误代码:
1) 引线后没有使用合适的胶水。
\hfill l.7 ...e {James2006}. \end {flushleft}\relax }}{5} % 您应该说 `\leaders '。我找到了 ,但没有合适的 ,所以我忽略了这些领导者。
[9
2)LaTeX 错误:出现问题 - 也许缺少 \item。
我有很多数字,在对第一个数字执行此操作后,其余数字就无法正常工作。我将非常感激任何建议 :)
答案1
这里有很多不同的选项。红线表示边距。
\documentclass{article}
\usepackage[demo]{graphicx}
\usepackage[justification=centering, labelfont=bf, font=bf]{caption}
\usepackage{framed}
\usepackage{showframe} % remove in actual document
\renewcommand*\ShowFrameColor{\color{red}} % remove in actual document
\begin{document}
\begin{figure}[!ht]
\centering
\begin{minipage}{0.7\textwidth}
\begin{framed}
\includegraphics[width= \linewidth]{Picture.jpg}
\caption{Title if you will but centred and bold}
\label{mylabel}
\begin{flushleft}
Fairly concise but slightly longer description of the figure but all text to be aligned to the left
margin as per the main body of text.
\end{flushleft}
\end{framed}
\end{minipage}
\end{figure}
\begin{figure}[!ht]
\centering
\begin{minipage}{0.7\textwidth}
\includegraphics[width= \linewidth]{Picture.jpg}
\begin{framed}
\caption{Title if you will but centred and bold}
\label{mylabel2}
\begin{flushleft}
Fairly concise but slightly longer description of the figure but all text to be aligned to the left
margin as per the main body of text.
\end{flushleft}
\end{framed}
\end{minipage}
\end{figure}
\begin{figure}[!ht]
\centering
\begin{minipage}{0.7\textwidth}
\begin{framed}
\includegraphics[width= \linewidth]{Picture.jpg}
\end{framed}
\caption{Title if you will but centred and bold}
\label{mylabel3}
\begin{flushleft}
Fairly concise but slightly longer description of the figure but all text to be aligned to the left
margin as per the main body of text.
\end{flushleft}
\end{minipage}
\end{figure}
\begin{figure}[!ht]
\centering
\framebox{\parbox{0.7\linewidth}{\includegraphics[width= \linewidth]{Picture.jpg}}}
\caption{Title if you will but centred and bold}\label{mylabel4}
\begin{flushleft}
Fairly concise but slightly longer description of the figure but all text to be aligned to the left
margin as per the main body of text.
\end{flushleft}
\end{figure}
\end{document}
答案2
\documentclass{article}
\usepackage[demo]{graphicx}
\usepackage[justification=centering, font=bf]{caption}
\begin{document}
\begin{figure}[!ht]
\centering
\framebox{\parbox{0.7\linewidth}{\includegraphics[width=\linewidth]{Picture.jpg}}}
\parbox{0.7\linewidth}{
\caption{Title if you will but centred and bold}
Fairly concise but slightly longer description of the figure but all text to be aligned to the left margin as per the main body of text.
}
\label{mylabel}
\end{figure}
\end{document}