我刚开始使用化学工程并且标题有问题。mchem 的下标与上标重叠。我能想到两种可能的解决方案(并且不用 mchem 来添加标题):
- 调整标题的行距
- 在标题中更改 mchem 下标的位置
我不知道该怎么做以及哪一个最好?
以下是该问题的演示:
以下是生成示例的代码:
\documentclass[english,letterpaper]{IEEEtran}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[cmex10]{amsmath}
\usepackage[version=3]{mhchem}
\usepackage{microtype}
\interdisplaylinepenalty=2500
\begin{document}
\title{Caption Line Spacing}
\maketitle
\begin{abstract}
I am having a problem with line spacing and subscript locations
inside of captions when using mhchem. This is a demonstration of this
effect.
\end{abstract}
\section{Caption Problem}
\label{sec:caption-problem}
Fig.~\ref{fig:demo} shows the problem with line spacing and mhchem
inside of captions. Occasionally text may overlap. Two possible
solutions are to (a) increase the line spacing (b) adjust subscript
position within mhchem.
\begin{figure}[h!]
\centering
\caption{Display of In\_\{0.53\}Ga\_\{0.47\}As using hbox and math
mode: $\hbox{In}_{0.53}\hbox{Ga}_{0.47}\hbox{As}${}; mhchem in text
environment: \ce{In_{0.53}Ga_{0.47}As}; mhchem in math environment:
$\ce{In_{0.53}Ga_{0.47}As}${}. Super-scripted items:
$1^{123}${} $1^{123}${} $1^{123}${} $1^{123}${} $1^{123}${}
$1^{123}${} $1^{123}${} $1^{123}${} $1^{123}${} $1^{123}${}
$1^{123}${} $1^{123}${} $1^{123}${} $1^{123}${}
$1^{123}${}. Subscripts and superscripts for hbox and math:
$\hbox{NMe}_4^+\hbox{Cl}^-${}; mhchem \ce{NMe4+Cl-}}
\label{fig:demo}
\end{figure}
\end{document}
(我正在使用 pdfLaTeX 和 TeXLive2012)
答案1
我可能遗漏了一些东西,但这里有一种方法可以做到。
输出
解释
您可以加载
caption
和setspace
在您的序言中编写软件包。然后在您的figure
环境中编写代码\captionsetup{font={small,stretch=1}}
以产生本地效果\captionsetup
。(但是,这将使该特定图形的标题在行距方面不同于您的其他标题,但必须做出一些让步才能实现您想要的效果。)我建议将keysmall
的值改为font
key,但当然,这是您的决定。您也可以使用值来stretch
实现您想要的效果。您会在文档中使用其他字体吗?如果没有,那么
\ce
在 MWE 中将包装放在数学环境中是没有意义的,除非我在您的实际用例中遗漏了某些内容。
代码
这是之前产生输出的完整 MWE。
\documentclass[english,letterpaper]{IEEEtran}
\usepackage[utf8]{inputenc}
\usepackage{microtype}
\usepackage[T1]{fontenc}
\usepackage[cmex10]{amsmath}
\usepackage[version=3]{mhchem}
\usepackage{caption}
\usepackage{setspace}
\interdisplaylinepenalty=2500
\begin{document}
\title{Caption Line Spacing}
\maketitle
\begin{abstract}
I am having a problem with line spacing and subscript locations
inside of captions when using mhchem. This is a demonstration of this
effect.
\end{abstract}
\section{Caption Problem}
\label{sec:caption-problem}
Fig.~\ref{fig:demo} shows the problem with line spacing and mhchem
inside of captions. Occasionally text may overlap. Two possible
solutions are to (a) increase the line spacing (b) adjust subscript
position within mhchem.
\begin{figure}[h!]
\captionsetup{font={small,stretch=1.1}}
\centering
\caption{Display of In\_\{0.53\}Ga\_\{0.47\}As using hbox and math
mode: $\hbox{In}_{0.53}\hbox{Ga}_{0.47}\hbox{As}${}; mhchem in text
environment: \ce{In_{0.53}Ga_{0.47}As}; mhchem in math environment:
\ce{In_{0.53}Ga_{0.47}As}. Super-scripted items:
$1^{123}${} $1^{123}${} $1^{123}${} $1^{123}${} $1^{123}${}
$1^{123}${} $1^{123}${} $1^{123}${} $1^{123}${} $1^{123}${}
$1^{123}${} $1^{123}${} $1^{123}${} $1^{123}${}
$1^{123}${}. Subscripts and superscripts for hbox and math:
$\hbox{NMe}_4^+\hbox{Cl}^-${}; mhchem \ce{NMe4+Cl-}}
\label{fig:demo}
\end{figure}
\end{document}