启用断链后,软件包 pst-bar 显示多行引用不正确

启用断链后,软件包 pst-bar 显示多行引用不正确

我有一份很长的文档,在整理时,我注意到在用 Latex -> dvips-> ps2pdf 编译后,我的文档中出现了一个奇怪的错误

我的文档中使用了以下软件包

  • pst-酒吧:用于整个文档中的条形图和类似图表,以及
  • 断开链接+超链接:在我的参考书目和其他一些列表中。
  • 托克洛夫特: 为一个新列表(见下文)

现在,我创建了一个新列表但如果条目的标题太长,一行都写不下,那么引用将被放置在标题行之间的某个位置,因此无法真正点击。这似乎是由于pst-酒吧但删除此包或断开链接对我来说意味着大量的重写。这里有人知道不删除任何软件包的修复方法吗?附上了一个最小的工作示例:

\documentclass[11pt,a4paper]{book}          

  \usepackage[utf8]{inputenc}   
  \usepackage[T1]{fontenc}      
  \usepackage[ngerman,english]{babel}

  \usepackage{mathtools}    
  \usepackage{pst-bar}  
  \usepackage{tocloft}  

  \usepackage[pdftoolbar=true,
            pdfmenubar=true,
            pdfpagemode=UseOutlines,
            bookmarksnumbered=true,
            colorlinks=false,
            breaklinks=true,
            urlcolor=blue]{hyperref}
  \usepackage[hyphenbreaks]{breakurl}

  %***** Create List of Algorithms ************************
  \newcommand{\newtempdima}{9em}    % width of tag column in list of algorithms
  \newcommand{\dummytitletext}{List of Dummys}

  \makeatletter
    \newcommand{\newnumberline}[1]{%
        \hb@xt@\newtempdima{\@cftbsnum #1\@cftasnum\hfil}\@cftasnumb}
    \newcommand{\listdummy}{\dummytitletext}
    \newlistof{dummys}{dum}{\listdummy}
    \renewcommand{\cftdummysnumwidth}{\newtempdima}
  \makeatother

  \newcommand{\dummy}[2]{\phantomsection\addcontentsline{dum}{dummys}{\protect\newnumberline{#1}#2}}
   %***** End: Create List of Algorithms ************************
\begin{document}

    \listofdummys

    \bigskip

    \section*{Text}

    Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum.


    \begin{align} \label{alg:CSLP-ast} \dummy{$(CSLP^\ast)$}{Short Description} 
            (CKSLP^\ast) ~ 
            \min \
                    & \sum_{i \in N} {\frac{1}{n_i} \ f_{i} \ y_{i}}    
                    & y_{S^{Depot}}= 1  \\
                    &   e_{ic} \leq E
                    & \forall  (i,c) \in N^1    \\
                    & e_{S^{Start},c+1} = e_{S_{Term},c}
    \end{align}

    Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam non.

    \begin{align} \label{alg:CSLP-T} \dummy{$(CSLP-T)$}{Overlong Description: Lorem ipsum dolor sit amet, consetetur sadipscing e}
        (CKSLP-T) ~
        \min \
            & \sum_{i \in N} \sum_{t \in T} \sum_{b \in B}^{f^{bat}_b z_b} x \cdot \beta    \\
            & \sum_{t \in T} y_{S^{Depot},t} = 1    \\
            &   e_{ic} \leq \sum_{b \in B}{E_b \cdot z_b}
    \end{align}
\end{document}

此外,我还试图找到一种自动定义标签列宽度的方法,例如定义的所有标签的最大宽度。当然,它的工作原理是将宽度定义为某个足够大的固定值,虽然我对此感到满意(因为我的文档中不会发生任何大的变化),但知道解决这个问题的正确方法会很好。例如,我尝试删除\新数行但这会导致第二行的缩进不好。

非常感谢您的意见!

答案1

hypdvips尝试在 之后加载包hyperref。根据其手册,hypdvips提供“支持断开链接”并修复使用 时出现hyperref的问题dvips

另外,您也可以使用hyperref的选项linktocpage=true。启用此选项后,列表和目录中可点击的超链接是页码,而不是章节标题或图片标题。

hypdvips编辑:与 结合使用natbib:要hypdvips与 一起使用natbib,您可以在序言中写入以下几行(加载后hyperref):

        \usepackage{hypdvips}
        \makeatletter
        \renewcommand{\Hy@backout}[1]{}
        \makeatother

在我用来测试的 MWE 中,这消除了错误并正确打印了引文。但是,我不确定这是否适用于所有设置,因此“最安全”的解决方案可能是我上面建议的替代方案,或者按照 Herbert 的建议切换到不同的编译器。

答案2

使用xelatex代替序列 withlatex有效。序言中只有几处变化:

\documentclass[11pt,a4paper]{book}          
\usepackage{fontspec}      
\usepackage[ngerman,english]{babel}

\usepackage{pst-bar}  
\usepackage{mathtools}    
\usepackage{tocloft}  
\usepackage{setspace}  

%***** Create List of Algorithms ************************
\newcommand{\newtempdima}{9em}    % width of tag column in list of algorithms
\newcommand{\dummytitletext}{List of Dummys}

\makeatletter
\newcommand{\newnumberline}[1]{%
    \hb@xt@\newtempdima{\@cftbsnum #1\@cftasnum\hfil}\@cftasnumb}
\newcommand{\listdummy}{\dummytitletext}
\newlistof{dummys}{dum}{\listdummy}
\renewcommand{\cftdummysnumwidth}{\newtempdima}
\makeatother

\usepackage[pdftoolbar=true,
pdfmenubar=true,
pdfpagemode=UseOutlines,
bookmarksnumbered=true,
colorlinks=false,
breaklinks=true,
urlcolor=blue]{hyperref}


\newcommand{\dummy}[2]{\phantomsection\addcontentsline{dum}{dummys}{\protect\newnumberline{#1}#2}}
%***** End: Create List of Algorithms ************************
\begin{document}

{\setstretch{1.2}
\listofdummys}

    \bigskip

    \section*{Text}
[...]

在此处输入图片描述

相关内容