The following question has essentially already been asked on this website (not by me), however none of the answers are satisfactory for my purposes, so I'll ask it again in a way that will hopefully elicit helpful answers.
Consider the following LaTeX document containing two sentences.
\documentclass{article}
\usepackage{lipsum}
\title{}
\author{}
\date{}
\begin{document}
\lipsum[1][1]\lipsum[1][2]
\end{document}
When this code is compiled with pdflatex
, the following output is produced.
I would like to position a 1cm wide TikZ square 1cm below and 1cm to the right of the bottom left corner of the capital U letter, as illustrated below. (I've indicated the reference point with a red dot, but this red dot is not supposed to appear in the actual output.)
How can I achieve this?
As a first attempt, I tried the following code.
\documentclass{article}
\usepackage{tikz}
\usepackage{lipsum}
\newcommand{\mytikzrec}{%
\begin{tikzpicture}[baseline=2cm]%
\draw (0,0) rectangle (1,1);%
\end{tikzpicture}%
}
\title{}
\author{}
\date{}
\begin{document}
\lipsum[1][1]\mytikzrec\lipsum[1][2]
\end{document}
This produced the following output.
This has two problems. Firstly, I managed to move the square down, but I didn't know how to move the square to the right. Secondly, the normal text flow was disrupted, which is not what I desire. The text should flow as though the picture didn't exist, just like in the case of the first code sample above.
Best Answer
You can use the
tikzmark
TikZ library for this: