8

I'm designing some letterhead using LuaLaTeX (interchangeable with XeLaTeX at this point) where I want my signature and name to be drawn like this:

enter image description here

The signature is a TikZ drawing, the text is normal type raised by negative \vspace{}. However, if you look closely, the text is (naturally) on top of the signature, and I would like to reverse that.

I understand why it is on top, but not what I can do to reverse it because the text is positioned relative to the sizing of the signature.

Because the above MWE example is 3,878 lines, I made a smaller MWE:

\documentclass{article}
\usepackage{tikz}

\begin{document}
    \begin{minipage}{2in}
        \resizebox{2in}{!}{
            \begin{tikzpicture}
                \draw[color=blue](0,0) circle (2);
            \end{tikzpicture}}\par
        \vspace*{-.15in}
        \resizebox{2in}{!}{Minimum Working Example}
    \end{minipage}
\end{document}

enter image description here

The structure is the same, just a simpler drawing and text. Is there any way to force the blue TikZ drawing to display on top of the text below it?

7
\documentclass{article}
\usepackage{tikz,stackengine}
\begin{document}
\stackon[-5pt]{\resizebox{2in}{!}{Minimum Working Example}}
{\begin{tikzpicture}\draw[color=cyan](0,0) circle (2);\end{tikzpicture}}
\end{document}

enter image description here

  • This is the third time I've liked one of your stackengine answers, you win, I just downloaded your manual! – Ryan Mar 2 '15 at 3:55
  • @Ryan Thank you for your vote of confidence. – Steven B. Segletes Mar 2 '15 at 11:26
  • It's s really impressive package, and implements a syntax that's much more legible than other solutions to similar problems! – Ryan Mar 2 '15 at 13:51
5

One option is to use overlay for the tikzpicture; to achieve exact positioning, you could also use the tikzmark library to place some marks and then, using remember picture, to use those marks to place the tikzpicture at the desired location; a little example:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{tikzmark,calc}

\begin{document}
    \begin{minipage}{2in}
        \tikzmark{start}\resizebox{2in}{!}{Minimum Working Example}\tikzmark{end}
            \begin{tikzpicture}[remember picture,overlay]
                \draw[color=blue,line width=3pt] 
                  ( $ (pic cs:start)!0.5!(pic cs:end) + (0cm,2cm) $ ) circle [radius=2cm];
            \end{tikzpicture}
    \end{minipage}
\end{document}

enter image description here

Update

Since overlay is being used, you cannot directly scale the tikzpicture; in this case, first box the scaled tikzpicture and then place it at the desired location:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{tikzmark,calc}

\newsavebox\mybox
\savebox\mybox{%
\resizebox{2in}{!}{%
  \begin{tikzpicture}
    \draw[color=blue,line width=3pt] 
      ( $ (pic cs:start)!0.5!(pic cs:end) + (0cm,2cm) $ ) circle [radius=2cm];
  \end{tikzpicture}}%
}

\begin{document}

\vspace*{4cm}% just for the example

    \begin{minipage}{2in}
        \tikzmark{start}\resizebox{2in}{!}{Minimum Working Example}\tikzmark{end}
            \begin{tikzpicture}[remember picture,overlay]
                \node[inner sep=0pt,anchor=south] at
                  ( $ (pic cs:start)!0.5!(pic cs:end) $ ) {\usebox\mybox};
            \end{tikzpicture}
    \end{minipage}
\end{document}

enter image description here

The code needs two or three runs to stabilize.

  • Thanks, I tried using overlay but couldn't make the alignment and scaling work. – Ryan Mar 2 '15 at 4:31

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.