![hyperref 和 cleveref 的问题](https://linux22.com/image/459888/hyperref%20%E5%92%8C%20cleveref%20%E7%9A%84%E9%97%AE%E9%A2%98.png)
我正在尝试放置一个链接到 YouTube 视频的图像。问题是,当我加载 hyperref 包时,它无法编译并出现巨大错误。我按要求在 cleveref 之前加载了 hyperref。
我的 latex 仅包含一个 fig 文件夹、一个 main.tex 和一个 config.tex。这是 config.tex:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%% PACKAGES %%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage[spanish]{babel}
\usepackage[utf8x]{inputenc}
\usepackage{geometry}
\usepackage{color}
\usepackage{xcolor}
\usepackage{amsmath}
\usepackage[hyphens]{url}
\usepackage{verbatim}
\usepackage{graphicx}
\usepackage{subfigure}
\usepackage{parskip}
\usepackage{amssymb}
\usepackage{nicefrac}
\usepackage{enumerate}
\usepackage{algorithm2e}
\usepackage{hyperref}
\usepackage[capitalise]{cleveref}
\usepackage{fancyhdr}
\usepackage[T1]{fontenc}
\usepackage{inconsolata}
\usepackage{listings} % For displaying code
\usepackage[font=footnotesize,labelfont=bf]{caption}
\usepackage{booktabs}
\usepackage{cite} % for references
\usepackage{scrextend}
\usepackage{gensymb}
\usepackage{setspace} % spacing
\usepackage{multicol}
\usepackage{float}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%% SETTINGS %%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%margins
\geometry{letterpaper,
headheight=2cm,
left=2cm,
right=2cm,
top=3cm,
bottom=2cm}
% header and footer
\pagestyle{fancy}
\rhead{\small University Course Name}
\lhead{\includegraphics[height=1cm]{fig/fcfm_die_tight.png}}
\cfoot{\thepage }
% Floats settings
\AtBeginDocument{%
\renewcommand\tablename{Tabla}
}
\setcounter{secnumdepth}{3}
\Crefname{table}{Tabla}{Tablas}
\Crefname{lstlisting}{Listado}{Listados}
\Crefname{equation}{}{}
\newcommand{\projectName}{Algo Interesante}
\newcommand{\students}{Persona1 y Persona2}
\newcommand{\tutor}{Persona}
\newcommand{\teachingAssistant}{Charles}
\newcommand{\professor}{Robert}
\newcommand{\myTitle}{%
\begin{center}
{\Large \bfseries
\projectName
}\\\vspace{0.5cm}
{\normalsize
Estudiante(s): \students\\
Tutor: \tutor\\
Profesor Auxiliar: \teachingAssistant\\
Profesor de Cátedra: \professor
}
\end{center}}
我将在这里复制 main.tex 的第一个重要部分:
\documentclass[letterpaper, 10pt]{article}
% Si tuvieses que agregar un paquete extra a tu documento, por favor hazlo dentro del archivo config.tex
\input{config.tex}
\DeclareMathOperator*{\argmax}{argmax}
\DeclareMathOperator*{\maximize}{max}
\DeclareMathOperator*{\expectation}{\mathbb{E}}
\begin{document}
\renewcommand{\tablename}{Tabla}
\renewcommand{\lstlistingname}{Listado}
\captionsetup{justification=centering,width=0.8\textwidth}
% Ingresa tus datos personales aquí
\renewcommand{\projectName}{\textit{Cool Title}}
\renewcommand{\students}{Max, Dylan and Francis}
\renewcommand{\tutor}{Charles}
% Esto genera el título con la información anterior
\myTitle
\section{Introducción}
Las formas de vida inteligentes son capaces de aprender...
A lot of irrelevent text...
\end{document}
没有 hyperref 一切都运行正常。但我需要插入一张图片作为 YouTube 视频的链接。使用 hyperref 时出现此错误:
No PDF
This compile didn’t produce a PDF. This can happen if:
There is an unrecoverable LaTeX error. If there are LaTeX errors shown below or in the raw logs, please try to fix them and compile again.
The document environment contains no content. If it’s empty, please add some content and compile again.
This project contains a file called output.pdf. If that file exists, please rename it and compile again.
Argument of � has an extra }. ./main.tex, 23
<inserted text>
\par
l.23 \section{Introducción}
I've run across a `}' that doesn't seem to match anything.
For example, `\def\a#1{...}' and `\a}' would produce
this error. If you simply proceed now, the `\par' that
I've just inserted will cause me to report a runaway
argument that might be the root of the problem. But if
your `}' was spurious, just type `2' and it will go away.