Graphics, Figures & TablesThickness of the text of nodes for crossing Bézier curves with bridge

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
user49915
Posts: 81
Joined: Wed Apr 17, 2019 12:51 pm

Thickness of the text of nodes for crossing Bézier curves with bridge

Post by user49915 »

Continuing http://tex.stackexchange.com/a/581548, consider the following code:

Code: Select all

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{intersections,angles,calc}
\newlength{\bridgeTunnelRadius}\setlength{\bridgeTunnelRadius}{.45ex}%%% when drawing two lines over each other that should not cross, we draw a small bridge or tunnel in form of a half-circle. This length provides the radius of the half-circle.
%%% Bridging Bézier curves, cf. http://tex.stackexchange.com/a/581548 :
\makeatletter
\tikzset{bridge/.code args={#1 over #2}{%
    \path[name path=tmp@bridge@path@B] #1;
    \tikzset{name intersections={of=#2 and tmp@bridge@path@B, by=tmp@i@0,total=\tmp@i@total}}
    \ifnum\tmp@i@total=0
    \typeout{These paths do not intersect. No bridge, sorry.}%
    \else
    \path[name path=tmp@bridge@path@C] (tmp@i@0) 
    circle[radius=\pgfkeysvalueof{/tikz/bridge radius}]; 
    \tikzset{name intersections={of=tmp@bridge@path@B and tmp@bridge@path@C, by={tmp@i@1,tmp@i@2},total=\tmp@i@total}}
    \ifnum\tmp@i@total=2
    \begin{scope}
      \clip (tmp@i@0) circle[radius=\pgfkeysvalueof{/tikz/bridge radius}]
      (current bounding box.south west) |-
      (current bounding box.north east) |- cycle;
      \draw[bridge-style] #1; 
    \end{scope}  
    \path let \p1=($(tmp@i@1)-(tmp@i@2)$),\n1={scalar(int(sign(\x1)))} in
    \ifnum\n1=-1
    pic [draw,line cap=round, angle radius=\pgfkeysvalueof{/tikz/bridge radius}, bridge-arc] {angle=tmp@i@2--tmp@i@0--tmp@i@1}
    \else 
    pic [draw,line cap=round, angle radius=\pgfkeysvalueof{/tikz/bridge radius}, bridge-arc] {angle=tmp@i@1--tmp@i@0--tmp@i@2}
    \fi; 
    \else
    \typeout{Given the bridge radius \pgfkeysvalueof{/tikz/bridge radius}, 
      the path is not suited to construct a nice bridge. No bridge, sorry.}%
    \fi
    \fi
  },bridge radius/.initial=\bridgeTunnelRadius,
  bridge style/.code={\tikzset{bridge-style/.style={#1}}},
  bridge arc/.code={\tikzset{bridge-arc/.style={#1}}},
  bridge style={},bridge arc={}}
\makeatother
\begin{document}
\begin{tikzpicture}
  \begin{scope}
    \draw[name path=A] (1,0) -- (1,1);
    \tikzset{bridge={(3,.5) to node[above,pos=.33333333333333333333333]{\(\mathit{c3}\colon b\)} (0,.5)} over A}
    \node at (2,.25) {\(\mathit{c3}\colon b\)};
  \end{scope}
\end{tikzpicture}
\end{document}
Feeding it to pdflatex and opening the result in qpdfview with 100% magnification gives us an image in which the text typeset with the bridge instructions is thicker/bolder than the same text typeset as usual:
screenshot.png
screenshot.png (2.65 KiB) Viewed 2987 times
In evince at 100%, the difference is similar. At very high resolutions, such as around 1000%, I failed to observe the difference in the thickness with either evince or qpdfview. (There might be a tiny, hardly recognizable difference in the sharpness of the edges.) Why is the difference in font weight so visible at low resolutions and how to make the weight of the text typeset with the bridge commands the same as usual?

Crosspost: http://tex.stackexchange.com/questions/587968

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

Post Reply