TransWikia.com

Hyperref problem with ntheorem theoremstyle{break}

TeX - LaTeX Asked by apio on March 5, 2021

I’d like to use the package hyperref together with ntheorem and its option theoremstyle{break}, because I want to separate the title of a theorem from the theorem’s content. My problem is that the hyperlinks inside the first line of a theorem are drawn in a too-big frame that is vertically higher than the line-height, like in this example: enter image description here

My code is this:

documentclass{article}
usepackage{ntheorem,hyperref}
theoremstyle{break}
theoremindent20pt 
theoremheaderfont{normalfontbfserieshspace{-theoremindent}}
newtheorem{cri}{Criterion}
begin{document}
section{First Section}
label{sec:test}
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. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. 
section{Second Section}
According to Section ref{sec:test}, 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. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
begin{cri}[Example]
According to Section ref{sec:test}, 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. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
end{cri}

end{document}

I have experimented with vspace, but this didn’t work either. I’m a LaTeX newbe. Could you pls. advise how to fix this behavior?

One Answer

In the ntheorem implementation the title of the theorem is actually a part of the first line, and so this line has a large height which is used by the link to calculate the link rectangle; you would get the same e.g. with a large strut. The only thing you can do is to put the ref in a box:

documentclass{article}
usepackage{ntheorem,hyperref}
theoremstyle{break}
theoremindent20pt
theoremheaderfont{normalfontbfserieshspace{-theoremindent}}
newtheorem{cri}{Criterion}
begin{document}
section{First Section}
label{sec:test}
begin{cri}[Example]
According to Section ref{sec:test}, %large height
end{cri}

rule{0pt}{24pt}ref{sec:test} %large height

begin{cri}[Example]
According to Section mbox{ref{sec:test}}, %smaller height
end{cri}
end{document}

enter image description here

Answered by Ulrike Fischer on March 5, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP