插图和 mhchem

2020-05-06 23:48发布

[图]将提供的图片命名为 zero.png。在 latex+dvipdfmx 编译下失败。最终我通过调整 mhchem 和 graphicx 的调用顺序解决。但是还是有奇怪的问题。1 当不用我的图片,用 e...

将提供的图片命名为 zero.png。在 latex+dvipdfmx 编译下失败。最终我通过调整 mhchem 和 graphicx 的调用顺序解决。但是还是有奇怪的问题。


1 当不用我的图片,用 example-image-a 时, latex+divpdfmx 、 pdflatex 和 xelatex 均通过编译(后两种编译时去掉 dvipdfmx 选项)

2 当用我的图片,不调用 mhchem 且不用其提供的 \ce 命令时 latex+dvipdfmx 编译通过。

3 当用我的图片,调用 mhchem ,即使不用 \ce 命令时, latex+dvipdfmx 编译失败,但是 pdflatex 和 xelatex 编译成功(去掉 dvipdfmx 选项)


为什么会有这么奇怪的问题?我觉得图片本身有些奇怪,但似乎也不全是它的错。



```tex

\documentclass{article}

\usepackage[version=4]{mhchem}

\usepackage[dvipdfmx]{graphicx}

% \usepackage{graphicx}

\begin{document}

\begin{figure}[h!]

\centering

\includegraphics[width=0.5\textwidth]{zero.png}

% \includegraphics[width=0.5\textwidth]{example-image-a}

\caption{ \ce{ Fe } }

\label{fig:1}

\end{figure}

\end{document}

```





zero.png

1条回答
\documentclass{article}
\usepackage[version=4]{mhchem}
\usepackage[dvipdfmx]{graphicx}
\begin{document}
  \begin{figure}[h!]
    \centering
    \includegraphics[width=0.5\linewidth,natwidth=500,natheight=500]{zero.png}
    \caption{ \ce{ Fe } }
    \label{fig:1}
  \end{figure}
\end{document}

加俩参数就行了

一周热门 更多>