colorlinks=true
我在使用该软件包的命令时遇到了问题\hyperref
。当我将它和命令一起包含时,\figure
我收到与颜色相关的错误。排除它可使文档编译。
错误说
Too many }'s
\color@endbox ->\ color@endgroup \ group
这是我的代码的简化版本,它会产生相同的错误
\begin{document}
\href{www.google.com}{google}
\begin{figure}{h!}
\caption{what}
\includegraphics{pug.jpg}
\end{figure}
\end{document}
以下是我正在使用的软件包
\documentclass[12pt]{article}
\usepackage{amsfonts, amsmath, amssymb, bm}
\usepackage{dcolumn, multirow}
\usepackage{graphicx, subfigure, float}
% \graphicspath{ \input{501.TA} }
\usepackage{textcomp}
\usepackage[margin=1in]{geometry}
\usepackage{setspace}
\usepackage{verbatim}
\usepackage{natbib}
\usepackage{url}
\usepackage{hyperref} % allows you to use hyperlinks
%\usepackage[colorlinks=true]{hyperref} % excluding this and the one below resolves the problem. Including either leads to the error message.
%\hypersetup{colorlinks=true}
\usepackage{chngcntr}
\counterwithin*{section}{part}
%\usepackage{url}% allows including urls with \url{} field.
\singlespace
答案1
说实话你犯了几个错误:
- !h 位于方括号之间;
- 我遇到了 hyperref 配置冲突,因为您在序言中声明了三次使用 hyperref;一次就足够了,在方括号内添加选项,在本例中为 colorlink=true;
- 您声明使用包 url 两次。
像这样更改代码。
\documentclass[12pt]{article}
\usepackage{amsfonts, amsmath, ams symb, bm}
\usepackage{dcolumn, multirow}
\usepackage{graphicx, subfigure, float}
% \graphicspath{ \input{501.TA} }
\usepackage{textcomp}
\usepackage[margin=1in]{geometry}
\usepackage{setspace}
\usepackage{verbatim}
\usepackage{natbib}
\usepackage{url}
%\usepackage{hyperref} % allows you to use hyperlinks
\usepackage[colorlinks=true]{hyperref} % excluding this and the one below resolves the problem. Including either leads to the error message.
%\hypersetup{colorlinks=true}
\usepackage{chngcntr}
\counterwithin*{section}{part}
%\usepackage{url}% allows including urls with \url{} field.
\singlespace
\begin{document}
\href{www.google.com}{google}
\begin{figure}[ht!]
\caption{what}
\includegraphics{picture.jpg}
\end{figure}
\end{document}