我有以下代码:
\begin{figure}
\centering
\includegraphics[width=1\textwidth]{Fig/cross_section.jpg}
\caption{
Photon's total cross section as a function of energy in Lead. Taken from \cite{phys}. Where:
\newline
$\sigma_{p.e.}$ = Atomic photoelectric effect\\
$\sigma_{Rayleigh}$ = Rayleigh (coherent) scattering\\
$\sigma_{compton}$= Compton (incoherent) scattering\\
$\kappa_{nuc}$ = Pair production, nuclear field\\
$\kappa_{e}$ = Pair production, electron field}
\label{fig:2.1}
\end{figure}
我想让所有文本都与 = 符号对齐。我尝试使用 align,但我的代码拒绝编译。当我尝试使用 \hspace 并手动执行时也发生了同样的情况。有人能帮我或指出我做错了什么吗?
答案1
您可以使用
\captionsetup{singlelinecheck=off}
从caption
包中,然后确保将可选参数传递给\caption
命令,以便\listoffigures
适当地考虑相应的条目。
\documentclass{article}
\usepackage{graphicx}
\usepackage{amsmath}
\usepackage{caption}
\begin{document}
\begin{figure}
\centering
\captionsetup{singlelinecheck=off}
\includegraphics[width=1\textwidth]{example-image-a}
\caption[For the list of figures]{
Photon's total cross section as a function of energy in Lead. Taken from:
\begin{align*}
1 & 2\\
3 & 4
\end{align*}
}
\label{fig:2.1}
\end{figure}
\end{document}
答案2
您可以使用\parbox
。您还应该将下标设置为文本。您的下标显然遵循图中的内容,但不建议使用带有多个字母的下标。最好用于$\sigma_\text{R}$
Rayleigh 等。
\documentclass{article}
\usepackage{calc,graphicx,amsmath}
\begin{document}
\begin{figure}
\centering
\includegraphics[width=\textwidth]{example-image-a}
\caption[bla]{\parbox{\textwidth}{
Photon's total cross section as a function of energy in Lead. Taken from somewhere:
\begin{align*}
\sigma_\text{p.e.} &= \text{Atomic photoelectric effect}\\
\sigma_\text{Rayleigh} &= \text{Rayleigh (coherent) scattering}\\
\sigma_\text{compton}&= \text{Compton (incoherent) scattering}\\
\kappa_\text{nuc} &= \text{Pair production, nuclear field}\\
\kappa_\text{e} &= \text{Pair production, electron field}
\end{align*}
}}
\label{fig:2.1}
\end{figure}
\end{document}