1

I'm talking about problems with following MWE:

\documentclass{article} 
\usepackage{tikz}
\usetikzlibrary{knots}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\begin{document}
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
In aliquet pretium purus, eget aliquet tortor lobortis ut.
Phasellus tincidunt elementum blandit.
Phasellus quis dui pretium, accumsan ipsum eu, aliquet
\begin{tikzpicture}[baseline=-0.65ex, scale=0.04]
\begin{knot}[clip width=10, end tolerance=1pt] 
\strand[semithick] (-5, -5) [in=left, out=right] to (5,5);
\strand[semithick] ( 5, -5) [in=right, out=left] to (-5,5);
\end{knot}
\end{tikzpicture}
magna. Duis sit amet aliquam tellus, ac tempor justo. 

Lorem ipsum dolor sit amet, consectetur adipiscing elit.
In aliquet pretium purus, eget aliquet tortor lobortis ut.
Phasellus tincidunt elementum blandit.
Phasellus quis dui pretium, accumsan ipsum eu, aliquet
\begin{tikzpicture}[baseline=-0.65ex, scale=0.04]
\begin{knot}[clip width=10] 
\strand[semithick] (-5, -5) [in=left, out=right] to (5,5);
\strand[semithick] ( 5, -5) [in=right, out=left] to (-5,5);
\end{knot}
\end{tikzpicture}
magna. Duis sit amet aliquam tellus, ac tempor justo. 
\end{document}

which compiled looks like this: enter image description here

There are two goals that I would like to achieve: first, the crossing should be visible (as in first paragraph), but without unnecessary white space around the knot (as in second paragraph). Is it possible? In my opinion, the question Crossings not appearing for small knots drawn using TikZ may be relevant.

3

The knots package works by drawing thick lines in the background colour. Although these aren't seen, they do take up space. In the second version, the cut-out line which creates the gap also adds to the bounding box. Thus a simple solution is to predefine the bounding box using the \useasboundingbox TikZ command.

\documentclass{article}
%\url{http://tex.stackexchange.com/q/357540/86}
\usepackage{tikz}
\usetikzlibrary{knots}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\begin{document}
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
In aliquet pretium purus, eget aliquet tortor lobortis ut.
Phasellus tincidunt elementum blandit.
Phasellus quis dui pretium, accumsan ipsum eu, aliquet
\begin{tikzpicture}[baseline=-0.65ex, scale=0.04]
\begin{knot}[clip width=10, end tolerance=1pt] 
\strand[semithick] (-5, -5) [in=left, out=right] to (5,5);
\strand[semithick] ( 5, -5) [in=right, out=left] to (-5,5);
\end{knot}
\end{tikzpicture}
magna. Duis sit amet aliquam tellus, ac tempor justo. 

Lorem ipsum dolor sit amet, consectetur adipiscing elit.
In aliquet pretium purus, eget aliquet tortor lobortis ut.
Phasellus tincidunt elementum blandit.
Phasellus quis dui pretium, accumsan ipsum eu, aliquet
\begin{tikzpicture}[baseline=-0.65ex, scale=0.04]
\useasboundingbox (-5,-5) rectangle (5,5);
\begin{knot}[clip width=10, end tolerance=1pt] 
\strand[semithick] (-5, -5) [in=left, out=right] to (5,5);
\strand[semithick] ( 5, -5) [in=right, out=left] to (-5,5);
\end{knot}
\end{tikzpicture}
magna. Duis sit amet aliquam tellus, ac tempor justo. 
\end{document}

spacing around knot

This has actually taken out more spacing than the first one had, so you might want to increase the bounding box a little to match it. I leave that to your own experimentation.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.