dvisvgm 输出的 svg 链接样式

dvisvgm 输出的 svg 链接样式

dvisvgm 将我的演示文稿转换为带有框架指示的链接。我的测试文件名为Hyper_Test.tex。我使用以下命令序列获得此信息:

  1. latex Hyper_Test.tex
  2. latex Hyper_Test.tex
  3. dvisvgm --font-format=woff --exact --zoom=-1 -p1- Hyper_Test

但我不想要链接周围的框架。为 hyperref 提供选项不起作用。为什么?

我的 MWE 是:

% working, but ugly
\documentclass[dvisvgm,hypertex,aspectratio=169]{beamer}
% not working, because there are no links to click
% \documentclass[dvisvgm,hypertex,hyperref={hidelinks},aspectratio=169]{beamer}
\setcounter{secnumdepth}{4}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% PageDown, PageUp key event handling; navigation symbols
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage[totpages]{zref}
\usepackage{atbegshi}
\usepackage{fontawesome}
\setbeamertemplate{navigation symbols}{}
\AtBeginShipout{%
  \AtBeginShipoutAddToBox{%
    \special{dvisvgm:raw
      <defs>
      <script type="text/javascript">
      <![CDATA[
        document.addEventListener('keydown', function(e){
          if(e.key=='PageDown'){
            \ifnum\thepage<\ztotpages
              document.location.replace('\jobname-\the\numexpr\thepage+1\relax.svg');%
            \fi
          }else if(e.key=='PageUp'){
            \ifnum\thepage>1
              document.location.replace('\jobname-\the\numexpr\thepage-1\relax.svg');%
            \fi%
          }
        });
      ]]>
      </script>
      </defs>
    }%
  }%
  \AtBeginShipoutUpperLeftForeground{%
    \raisebox{-\dimexpr\height+0.5ex\relax}[0pt][0pt]{\makebox[\paperwidth][r]{%
      \normalsize\color{structure!40!}%
      \ifnum\thepage>1%
        \href{\jobname-\the\numexpr\thepage-1\relax.svg}{\faArrowLeft}%
      \else%  
        \textcolor{lightgray}{\faArrowLeft}%  
      \fi\hspace{0.5ex}%
      \ifnum\thepage<\ztotpages%
        \href{\jobname-\the\numexpr\thepage+1\relax.svg}{\faArrowRight}%
      \else%
        \textcolor{lightgray}{\faArrowRight}%  
      \fi%
      \hspace{0.5ex}%
    }}%
  }%  
}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\makeatletter

% this default might be overridden by plain title style
 \newcommand\makebeamertitle{\frame{\maketitle}}%
 % (ERT) argument for the TOC
 \AtBeginDocument{%
   \let\origtableofcontents=\tableofcontents
   \def\tableofcontents{\@ifnextchar[{\origtableofcontents}{\gobbletableofcontents}}
   \def\gobbletableofcontents#1{\origtableofcontents}
 }

\usetheme{Montpellier}
\useinnertheme{rectangles}
\usecolortheme{seahorse}
\usecolortheme{orchid}
\usefonttheme{serif}

\setbeamercovered{transparent}
\setbeamertemplate{footline}[frame number]
\makeatletter
    \patchcmd{\beamer@sectionintoc}{\vskip1.5em}{\vskip0.5em}{}{}
\makeatother

\AtBeginSection[]
{
   \begin{frame}
      \frametitle{Overview}
      \tableofcontents[currentsection, hideallsubsections]
   \end{frame}
}

\AtBeginSubsection[]
{
   \begin{frame}
      \frametitle{Contents}
      \tableofcontents[
          sectionstyle=show/hide,
          subsectionstyle=show/shaded/hide
      ]
   \end{frame}
}

\makeatother

\begin{document}

\title{Title}
\author{Harald Lichtenstein}
\institute{Institute}
\date{\today}
\makebeamertitle

\part{Part 1}

\section{Intro}

\subsection{Subsection 1}

\begin{frame}{Frame Title 1}
    Info
\end{frame}

\subsection{Subsection 2}

\begin{frame}{Frame Title 2}
    more Info
\end{frame}

\begin{frame}{Frame Title 3}
    more Info
\end{frame}

\begin{frame}{Frame Title 4}
    more Info
\end{frame}

\begin{frame}{Frame Title 5}
    more Info
\end{frame}

\begin{frame}{Frame Title 6}
    more Info
\end{frame}

\end{document}

在此处输入图片描述

答案1

感谢上述评论中的所有贡献者,他们确实回答了我的问题。为了结束这个问题,我想总结一下这些评论:

不是解决问题中的选项\documentclass,而是给出的选项dvisvgm

提供所需输出的命令行是:

  1. latex Hyper_Test.tex
  2. latex Hyper_Test.tex
  3. dvisvgm --font-format=woff --bbox=papersize --output=%f-%0p.svg --linkmark=none --zoom=-1 -p1- Hyper_Test

此选项的--linkmark=none作用是链接周围不再有框架,如 Martin 在上面的评论中所述。此外,此选项--output=%f-%0p.svg非常有用,因为超过 10 张幻灯片的编号会导致它们之间的链接出现问题,如 AlexG 在上面的评论中所述。

相关内容