Texto embutido com imagem tikz

Texto embutido com imagem tikz
    \documentclass[12pt]{article}
    \usepackage{fixltx2e,graphicx,amsmath,mathptmx,tikz,tkz-euclide,pgfplots} %for math
    \usetkzobj{all}
    \usetikzlibrary{calc}
    \begin{document}
    This is a square
    \begin{tikzpicture}[thick]
    \coordinate (L) at (0,0);
    \coordinate (M) at (2,0);
    \coordinate (N) at (2,2);
    \coordinate (P) at (0,2);
    \draw 
    (L) node[below left] {\footnotesize{$L$}} --
    (M) node[below right] {\footnotesize{$M$}} --
    (N) node[above right] {\footnotesize{$N$}} --
    (P) node[above left] {\footnotesize{$P$}} -- 
    cycle;
    \tkzLabelSegment[below=2pt](L,M){\footnotesize{$4$cm}}
    \end{tikzpicture}
    Find its area.
    \end{document}

Existe alguma maneira de alinhar o texto com o quadrado?

Responder1

Você pode usar a opção de linha de base.

\documentclass[12pt]{article}
\usepackage{fixltx2e,graphicx,amsmath,mathptmx,tikz,tkz-euclide,pgfplots} %for math
\usetkzobj{all}
\usetikzlibrary{calc}
\begin{document}
This is a square
\begin{tikzpicture}[baseline,thick]
\coordinate (L) at (0,0);
\coordinate (M) at (2,0);
\coordinate (N) at (2,2);
\coordinate (P) at (0,2);
\draw
(L) node[below left] {\footnotesize{$L$}} --
(M) node[below right] {\footnotesize{$M$}} --
(N) node[above right] {\footnotesize{$N$}} --
(P) node[above left] {\footnotesize{$P$}} --
cycle;
\tkzLabelSegment[below=2pt](L,M){\footnotesize{$4$cm}}
\end{tikzpicture}
Find its area.
\end{document}

insira a descrição da imagem aqui

Com \begin{tikzpicture}[baseline={(current bounding box.center)},thick], obtemos

insira a descrição da imagem aqui

informação relacionada