%20(b)%20no%20lado%20esquerdo%20de%20v%C3%A1rias%20figuras%20tikz%3F.png)
Quero ter o seguinte formato de exemplo para duas figuras tikz, onde (a)
e (b)
estão localizados no máximo no lado esquerdo delas.
Referência de exemplo: Cormen/Introdução aos Algoritmos 2022 página: 341
Observe que estou interessado apenas em colocar etiquetas (a)
, (b)
, (c)
, ....
A solução que encontrei é usar Como rotular/marcar diagramas TikZ?. Mas aqui não consegui alterar os números das equações (2)
para (a)
e (3)
para (b)
, também não consegui alterar sua localização para o lado esquerdo.
meu código tex:
\documentclass{article}
\usepackage{tikz-cd}
\usepackage{blindtext}
\usepackage{tikz}
\usetikzlibrary{positioning}
\begin{document}
\setcounter{page}{15}
\noindent
\begin{equation}
\begin{tikzcd}
x = 5 * 5; \\
\end{tikzcd}
\end{equation}
into a commutative diagramm
\begin{equation}
\begin{tikzcd}
B\times_A C \arrow{r}{\pi_2}\arrow{d}[swap]{\pi_1} & C\arrow{d}{g} \\
B \arrow{r}[swap]{f} & A;
\end{tikzcd}
\end{equation}
\begin{equation}
\begin{tikzpicture}[compute/.style={draw,thick,font=\sffamily,
append after command={
(\tikzlastnode.south west) edge[double=gray!50,double distance=3pt,
line cap=rect,
shorten >=-2pt,shorten <=-2pt]
(\tikzlastnode.south east)}}]
\node[compute] (n1) {Node};
\node[compute,right=2cm of n1] (n2) {More text};
\draw[thick,-stealth] (n1) -- (n2);
\end{tikzpicture}
\end{equation}
\end{document}
saída:
saída desejada:
Responder1
Suponho que você gostaria de obter o seguinte:
Usando @Andrew Swannrespondervocê pode escrever:
\documentclass{article}
\usepackage{lipsum}
\usepackage{amsmath}
\makeatletter
\newcommand{\leqnos}{\tagsleft@true\let\veqno\@@leqno}
\newcommand{\reqnos}{\tagsleft@false\let\veqno\@@eqno}
\reqnos
\makeatother
\newcounter{eqtn}
\usepackage{tikz-cd}
\usetikzlibrary{positioning}
\begin{document}
\setcounter{page}{15}
\begin{equation}
a^2 + b^2 = c^2
\end{equation}
\lipsum[3][1-3]
\begingroup\leqnos
\setcounter{eqtn}{\theequation}
\setcounter{equation}{0}
\renewcommand\theequation{\alph{equation}}
\begin{equation}
\begin{tikzcd}
x = 5 * 5; \\
\end{tikzcd}
\end{equation}
into a commutative diagramm
\begin{equation}
\begin{tikzcd}
B\times_A C \arrow{r}{\pi_2}\arrow{d}[swap]{\pi_1} & C\arrow{d}{g} \\
B \arrow{r}[swap]{f} & A;
\end{tikzcd}
\end{equation}
\begin{equation}
\begin{tikzpicture}[compute/.style={draw,thick,font=\sffamily,
append after command={
(\tikzlastnode.south west) edge[double=gray!50,double distance=3pt,
line cap=rect,
shorten >=-2pt,shorten <=-2pt]
(\tikzlastnode.south east)}}]
\node[compute] (n1) {Node};
\node[compute,right=2cm of n1] (n2) {More text};
\draw[thick,-stealth] (n1) -- (n2);
\end{tikzpicture}
\end{equation}
\setcounter{equation}{\theeqtn}
\endgroup
\lipsum[66]
\begin{equation}
a^2 + b^2 = c^2
\end{equation}
\end{document}
Eu me pergunto, por que você não usa o sidcap
pacote e usa por exemplo como
\begin{SCfigure}
\includegraphics{image}
\caption{A figure and its caption framed}
\label{fig:test}
\end{SCfigure}
e para eles altere a numeração das legendas da mesma forma que foi feito acima.
Editar: Código mais simples com marcação manual da equação:
\documentclass{article}
\usepackage{lipsum}
\usepackage{amsmath}
\makeatletter
\newcommand{\leqnos}{\tagsleft@true\let\veqno\@@leqno}
\newcommand{\reqnos}{\tagsleft@false\let\veqno\@@eqno}
\reqnos
\makeatother
\usepackage{tikz-cd}
\usetikzlibrary{positioning}
\begin{document}
\setcounter{page}{15}
\begin{equation}
a^2 + b^2 = c^2
\end{equation}
\lipsum[1][1-3]
\begingroup\leqnos
\begin{equation}
\begin{tikzcd}
x = 5 * 5; \tag{a}\\
\end{tikzcd}
\end{equation}
into a commutative diagramm
\begin{equation}
\begin{tikzcd}
B\times_A C \arrow{r}{\pi_2}\arrow{d}[swap]{\pi_1} & C\arrow{d}{g} \\
B \arrow{r}[swap]{f} & A;
\end{tikzcd} \tag{b}
\end{equation}
\begin{equation}
\begin{tikzpicture}[compute/.style={draw,thick,font=\sffamily,
append after command={
(\tikzlastnode.south west) edge[double=gray!50,double distance=3pt,
line cap=rect,
shorten >=-2pt,shorten <=-2pt]
(\tikzlastnode.south east)}}]
\node[compute] (n1) {Node};
\node[compute,right=2cm of n1] (n2) {More text};
\draw[thick,-stealth] (n1) -- (n2);
\end{tikzpicture} \tag{a}
\end{equation}
\endgroup
\lipsum[66]
\begin{equation}
a^2 + b^2 = c^2
\end{equation}
\end{document}
O resultado da compilação é o mesmo de antes.