pandoc markdown 的投影仪输出中的内部部分链接失败 [英] Internal section link fails in beamer output of pandoc markdown
问题描述
我已经尝试了这个问题的答案,但我无法在Pandoc 与 Latex Beamer 输出.
I have tried the answer to this question, but I can't get the internal section links in Pandoc to work with the Latex Beamer output.
遵循 Pandoc 文档,我创建了这个最小的工作示例:
Following the Pandoc Documentation, I have created this minimal working example:
# Part One {#part-one}
## Section One {#section-one}
### Frame one {#frame-one}
- Items...
### Frame two {#frame-two}
- Items...
- Link to [Section One](#section-one)
并使用:
pandoc \
--table-of-contents \
-s -t beamer test.md \
-o test.pdf
内置的 LaTex Beamer pdf 看起来不错,但是内部链接 [Section One](#section-one)
就是不工作.它应该将我带到第一部分"框架,但事实并非如此.我如何使这项工作?
The built LaTex Beamer pdf looks fine, but the internal link [Section One](#section-one)
just isn't working. It should bring me to the "Section One" frame but it doesn't. How do I make this work?
这里是 -o test.latex
的 LaTex 输出:
here is the LaTex output for -o test.latex
:
\documentclass[]{beamer}
\setbeamertemplate{caption}[numbered]
\setbeamertemplate{caption label separator}{:}
\setbeamercolor{caption name}{fg=normal text.fg}
\usepackage{amssymb,amsmath}
\usepackage{ifxetex,ifluatex}
\usepackage{fixltx2e} % provides \textsubscript
\usepackage{lmodern}
\ifxetex
\usepackage{fontspec,xltxtra,xunicode}
\defaultfontfeatures{Mapping=tex-text,Scale=MatchLowercase}
\newcommand{\euro}{€}
\else
\ifluatex
\usepackage{fontspec}
\defaultfontfeatures{Mapping=tex-text,Scale=MatchLowercase}
\newcommand{\euro}{€}
\else
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\fi
\fi
% use upquote if available, for straight quotes in verbatim environments
\IfFileExists{upquote.sty}{\usepackage{upquote}}{}
% use microtype if available
\IfFileExists{microtype.sty}{\usepackage{microtype}}{}
% Comment these out if you don't want a slide with just the
% part/section/subsection/subsubsection title:
\AtBeginPart{
\let\insertpartnumber\relax
\let\partname\relax
\frame{\partpage}
}
\AtBeginSection{
\let\insertsectionnumber\relax
\let\sectionname\relax
\frame{\sectionpage}
}
\AtBeginSubsection{
\let\insertsubsectionnumber\relax
\let\subsectionname\relax
\frame{\subsectionpage}
}
\setlength{\parindent}{0pt}
\setlength{\parskip}{6pt plus 2pt minus 1pt}
\setlength{\emergencystretch}{3em} % prevent overfull lines
\setcounter{secnumdepth}{0}
\date{}
\begin{document}
\begin{frame}
\tableofcontents[hideallsubsections]
\end{frame}
\part{Part One}\label{part-one}
\hyperdef{}{section-one}{\section{Section One}\label{section-one}}
\begin{frame}{Frame one}
\begin{itemize}
\itemsep1pt\parskip0pt\parsep0pt
\item
Items\ldots{}
\end{itemize}
\end{frame}
\begin{frame}{Frame two}
\begin{itemize}
\itemsep1pt\parskip0pt\parsep0pt
\item
Items\ldots{}
\item
Link to \hyperref[section-one]{Section One}
\end{itemize}
\end{frame}
\end{document}
推荐答案
我想我已经将它定位到 \documentclass[ignorenonframetext,]{beamer}
中的 ignorenonframetext
>,这是默认 Pandoc 投影仪模板的一部分.
I think I've pinpointed it to the ignorenonframetext
in \documentclass[ignorenonframetext,]{beamer}
, which is part of the default Pandoc beamer template.
由于 \hyperdef{}{part-one}{\section{Part One}\label{part-one}}
不在 frame
内,它显然被 hyperref 忽略了.
Since the \hyperdef{}{part-one}{\section{Part One}\label{part-one}}
is not inside a frame
, it is apparently ignored by hyperref.
您能否尝试创建自己的模板(pandoc -D beamer> mytemplate.tex
) 没有 ignorenonframetext
并看看它是否有效而没有任何不利的副作用?(在手动测试 .tex 时,我总是需要运行两次 LaTeX 才能使更改完全生效.)
Could you try to create your own template (pandoc -D beamer > mytemplate.tex
) without the ignorenonframetext
and see whether that works without any adverse side effects? (When manually testing the .tex I always had to run LaTeX twice for the changes to take full effect.)
这篇关于pandoc markdown 的投影仪输出中的内部部分链接失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!