【问题标题】:Error when \% is included in a sectioning command分段命令中包含 \% 时出错
【发布时间】:2013-10-01 16:58:52
【问题描述】:

当我尝试在\subsection 的标题和Compile pdf 中输入\% 时,出现以下错误:

File ended while scanning use of \@@BOOKMARK.

我该怎么做?

编辑

这是一个可重现的示例。该文件以 UTF-8 格式编码。

\documentclass[a4paper]{article}


\usepackage{fontspec}
\usepackage{hyperref}
\usepackage{longtable}
\usepackage{rotating}
\usepackage{tabularx}
\usepackage{lscape}
\usepackage[normalem]{ulem}


\setmainfont[Scale=1.0]{Times New Roman} 
\setsansfont{Times New Roman}


\begin{document}

\section{Μέσες τιμές και 95\% Διαστήματα Εμπιστοσύνης}

\subsection{a \% b cd}

<<>>=
1+1
@

\end{document}

【问题讨论】:

  • @RicardoSaporta 为什么是\\%? LaTeX 不是 R :)

标签: r knitr rstudio sweave xelatex


【解决方案1】:

可能是hyperref的配置问题。我没有Times New Roman,但我在 RStudio (v0.98.312) 和knitr 中成功使用了xelatex (TeXLive 2012, Ubuntu 13.04),使用以下配置:

\documentclass{article}
\usepackage{fontspec}
\setmainfont{DejaVu Serif}
\usepackage[unicode=true,bookmarks=true,bookmarksopen=true]{hyperref}
\usepackage{xunicode}
\begin{document}


\section{Μέσες τιμές και 95\% Διαστήματα Εμπιστοσύνης}

\subsection{a \% b cd}

<<>>=
1+1
@

\end{document}

输出:

文档采用 UTF8 编码。您可能需要告诉hyperref unicode 选项。

【讨论】:

  • 谢谢。即使没有 xunicode,它也可以工作。你认为我应该保留它吗?
  • @GeorgeDontas 我不是真正的 XeTeX 专家,所以我认为如果 xunicode 仍然有效,你可以不用 xunicode
猜你喜欢
  • 1970-01-01
  • 2021-04-22
  • 2020-09-03
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2022-08-14
相关资源
最近更新 更多