Hyperref 在 baposter 中不起作用

Hyperref 在 baposter 中不起作用

有人可以帮助解释以下示例代码吗?其中,href使用 构建时并不会在生成的 pdf 中产生超链接pdflatex

\documentclass[landscape,a0paper,fontscale=0.285]{baposter}

\title{Summary}

\usepackage[brazilian]{babel}
\usepackage[utf8]{inputenc}


\usepackage{xcolor}
\usepackage{tabu}

\usepackage{hyperref}

\usepackage{palatino} % Use the Palatino font
\usepackage[font=small,labelfont=bf]{caption} % Required for specifying captions to tables and figures

\begin{document}
\begin{poster}
{
 bgColorOne=white, 
 bgColorTwo=white,
}

{\bf\textsc{Bhagvad Geeta Summary}\vspace{0.5em}} % Poster title


\headerbox{Bhagvad Geeta Summary}{name=saar, column=1,span=2, row=0}{

Your world is a \href{http://www.google.com}{perception} based by your 
prejudices, shaped by your fears, fueled by your ignorance.
}

\end{poster}
\end{document}

答案1

baposter通过类选项进行的字体缩放fontscale会导致链接错位。在某些页面大小和fontscale组合下,可以显示链接确实生成,并且处于活动状态,但它们与链接项无关。将纸张大小设置为a0paperfontscale=0.9演示了此结果 - 即,链接生成,但位置错误。

此处的解决方案是设置类选项fontscale=1.0。这需要在环境中手动设置所有字体大小posterbox。这是因为设置fontscale=1.0,加上较大的纸张尺寸,会导致文本对于大型海报来说太小。

MWE 包含几个测试,演示如何使用这些posterboxtextfont来设置文本的大小posterboxheaderfont设置posterbox标题内容的大小。这些键可以全局用于所有posterboxes,也可以用于单个posterboxes

也可以使用\fontsize{fontsize}{baselineskip}\selectfont里面的语法posterbox来放大文本。

MWE 测试使用\href\url和创建的链接\autocite。输出显示链接与链接文本正确关联。

MWE 中有进一步的评论来解释它的作用。

我确实遇到了一件我不明白的事情(好吧,还有很多我不明白的事情LaTeX),但是当我使用语法时,除非我将文本放在里面,否则\fontsize{fontsize}{baselineskip}\selectfontbaselineskip 在 中似乎不正确。posterboxparbox

这是 MWE:

\documentclass[landscape,a0paper,fontscale=1.0]{baposter}
\usepackage{biblatex}
\usepackage{helvet}    %scaleable, sans serif font
\usepackage{microtype}
\usepackage{hyperref}
\hypersetup{%
    citebordercolor=red,
    urlbordercolor=orange,
    pdfborder=0 0 5}
\addbibresource{\jobname.bib}
\renewcommand{\rmdefault}{\sfdefault} % Default font is sans serif

% https://tex.stackexchange.com/a/240950. Thanks Mico.
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
    @article{something,
       author = "FirstName MiddleName LastName",
       title  = "A very long and tedious title that says absolutely nothing",
       journal= "Circularity Today",
       year= 5678,
       volume = 1,
       number = 2,
       pages  = "3-4",
    }
\end{filecontents}

\begin{document}

\begin{poster}
{
columns=2,
background=none,
headerborder=closed,
borderColor=green,
textborder=rectangle,
headershade=plain,
headerColorOne=green!40!white,
boxColorOne=green!10!white,
textfont=\huge, % font definition for body of posterbox
headerfont=\Huge\scshape, % font definition for header of posterbox
}
{} % Logo left
{\fontsize{150}{150}\selectfont\bfseries\textsc{Summary}} % Poster title
{} % Authors
{} % Logo right
\begin{posterbox}[name=box1,column=0,span=1,row=0]{Box 1}
Lorem ipsum dolor sit amet, \href{http://www.google.com}{consectetur} adipiscing elit.
Pellentesque hendrerit felis vitae dolor tempus posuere. Morbi et justo dapibus, dictum.
\end{posterbox}

% Use the textfont or headerfont keys to adjust the font size
\begin{posterbox}[name=box2,column=0,span=1,below=box1,headerfont=\large,textfont=\normalfont]{Box 2}
Lorem ipsum dolor sit amet, \href{http://www.google.com}{consectetur} adipiscing elit.
Pellentesque hendrerit felis vitae dolor tempus posuere. Morbi et justo dapibus, dictum.
\end{posterbox}

% Or use \fontsize{fontsize}{baseline}\selectfont
\begin{posterbox}[name=box3,column=0,span=1,below=box2]{Box 3}
\fontsize{20}{25}\selectfont
Lorem ipsum dolor sit amet, \href{http://www.google.com}{consectetur} adipiscing elit.
Pellentesque hendrerit felis vitae dolor tempus posuere. Morbi et justo dapibus, dictum.
\end{posterbox}

% Larger font
\begin{posterbox}[name=box4,column=0,span=1,below=box3]{Box 4}
\fontsize{50}{60}\selectfont
Lorem ipsum dolor sit amet, \href{http://www.google.com}{consectetur} adipiscing elit.
Pellentesque hendrerit felis vitae dolor tempus posuere. Morbi et justo dapibus, dictum.
\end{posterbox}

% Baseline skip doesn't look correct. Add a parbox.
\begin{posterbox}[name=box5,column=0,span=1,below=box4]{Box 5}
\parbox{\boxwidth-1cm}{%
\fontsize{50}{60}\selectfont
Lorem ipsum dolor sit amet, \href{http://www.google.com}{consectetur} adipiscing elit. 
Pellentesque hendrerit felis vitae dolor tempus posuere. Morbi et justo dapibus, dictum.
}
\end{posterbox}

% Even larger
\begin{posterbox}[name=box6,column=0,span=1,below=box5]{Box 6}
\parbox{\boxwidth-1cm}{%
\fontsize{80}{100}\selectfont
Lorem ipsum dolor sit amet, \href{http://www.google.com}{consectetur} adipiscing elit.
Pellentesque hendrerit felis vitae dolor tempus posuere. Morbi et justo dapibus, dictum.
}
\end{posterbox}

% Look at the baseline again without parbox. Don't know what's happening here.
\begin{posterbox}[name=box7,column=0,span=1,below=box6]{Box 7}
\fontsize{80}{120}\selectfont
Lorem ipsum dolor sit amet, \href{http://www.google.com}{consectetur} adipiscing elit.
Pellentesque hendrerit felis vitae dolor tempus posuere. Morbi et justo dapibus, dictum.
\end{posterbox}

% A box with a citation
\begin{posterbox}[name=box8,column=1,span=1,row=0]{Box 8}
\parbox{\boxwidth-1cm}{%
\fontsize{80}{120}\selectfont
This is a citation: \autocite{something}

This is a url: \url{https://tex.stackexchange.com}
}
\end{posterbox}

% A box with a bibliography that links to the citation
\begin{posterbox}[name=box9,column=1,span=1,aligned=box6,bottomaligned=box7]{References} % Note: aligned key is undocumented
\parbox{\boxwidth-1cm}{%
\renewcommand{\bibfont}{\fontsize{40}{50}\selectfont} % or any other  appropriate font command
\printbibliography[heading=none]
}
\end{posterbox}

\end{poster}
\end{document}

这是输出: 在此处输入图片描述

相关内容