방정식 내부에 tikzFigure를 가장 오른쪽에 정렬하려면 어떻게 해야 합니까?

방정식 내부에 tikzFigure를 가장 오른쪽에 정렬하려면 어떻게 해야 합니까?

나의 주요 목표는 tikzFigures의 가장 왼쪽에 태그를 두는 것입니다. 방정식 내부 를 정의하면 tikzfigure태그와 충돌하는 위치가 중앙에 배치됩니다. 오른쪽에 공간이 있으므로 태그와의 충돌을 방지하기 위해 tikzFigure를 오른쪽으로 어떻게 이동할 수 있습니까? 나는 이중 열로 작업하고 있습니다.

tex 코드(원본 코드는 다음에서 가져옴)https://tex.stackexchange.com/a/661116/127048)

\documentclass[10pt,journal,compsoc]{IEEEtran}
\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}
\begingroup\leqnos
\lipsum[1][1-3]
\begin{equation}
  \begin{tikzcd}
      B\times_A
  \end{tikzcd}~\tag{a}
\end{equation}

\begin{equation}
  \begin{tikzpicture}[baseline=(current bounding box.center),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, yshift=11mm] (n2) {More text};
      \node[compute,right=2.2cm of n2] (n3) {More};
      \node[compute,below=2cm of n2] (n4) {text};
      \draw[thick,-stealth] (n1) -- (n2) -- (n3) -- (n4);
  \end{tikzpicture}~\tag{b}
\end{equation}
  \endgroup
\end{document}

산출:

여기에 이미지 설명을 입력하세요

여기서 tikz 그림이 오른쪽으로 이동하면 태그와의 충돌이 방지됩니다.

관련된:여러 tikz 그림의 가장 왼쪽에 (a) (b) 기호를 어떻게 표시할 수 있나요?

답변1

이미지가 너무 넓어서 한 열 너비에 들어갈 수 있습니다. 이미지를 한 열에 배치해야 하는 경우에는 옆에

  • 글꼴 크기를 \small또는 심지어로 줄입니다 \footnotesie.
  • 여러 줄의 텍스트를 허용하여 노드 너비를 줄입니다.
  • 모드 간 수평 거리를 줄이고,

할 수 있는 일이 많지 않습니다. 앞서 언급한 구현 방법의 예는 다음과 같습니다.

\documentclass[10pt,journal,compsoc]{IEEEtran}
\usepackage{lipsum}
%---------------- show page layout. don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%
\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{arrows.meta,
                positioning}

\begin{document}
\lipsum[1][1-3]

\begingroup\leqnos
\begin{equation}
   \begin{tikzcd}
       B\times_A
   \end{tikzcd}~\tag{a}
\end{equation}

\begin{equation}
    \begin{tikzpicture}[baseline=(current bounding box.center),
 node distance = 13mm,
compute/.style = {draw, thick, font=\small\sffamily, align=center,
                  append after command={\pgfextra{\let\LN\tikzlastnode}
                    (\LN.south west) edge[double=gray!50,double distance=3pt,
                                          line cap=rect,
                                          shorten >=-2pt,shorten <=-2pt]
                    (\LN.south east)}},
                        ]
    \node[compute] (n1) {Node};
    \node[compute,right=of n1] (n2) {More text};
    \node[compute,right=of n2] (n3) {More text text\\ text text text};
    \node[compute,below=of n2] (n4) {text};
    \draw[thick,draw, -Stealth, shorten > = 3pt, shorten < = 3pt]
        (n1) edge (n2)
        (n2) edge (n3)
        (n3) to (n4);
   \end{tikzpicture}~\tag{b}
\end{equation}
   \endgroup
\lipsum
\end{document}

여기에 이미지 설명을 입력하세요

부록: 댓글에서 다음과 같습니다.

  • 당신이 원하는 것을 얻기 위해 접근하는 것은 불가능합니다
  • 한 가지 방법은 왼쪽에 (참조할 수 없음) 태그가 있고 오른쪽, 가운데 또는 왼쪽에 있는 이미지 또는 기타 텍스트가 있는 새 환경을 정의하는 것입니다.
  • sucn 명령의 예는 다음과 같습니다.
\usepackage{tabularray}

\newcommand\LST[3]{
    \begin{center}
    \begin{tblr}{colspec={@{} Q[c, font=\bfseries] X[#1] @{}} }
    #2  &   #3  
    \end{tblr}
    \end{center}}
  • compute위의 정의를 사용하여 노드 스타일을 재정의하려면 약간의 작업이 필요합니다 .
compute/.style = {draw, thick, font=\small\sffamily, align=center,
                  append after command={\pgfextra{\let\LN\tikzlastnode}
                    ([xshift=-2pt] \LN.south west) 
                        edge[double=gray!50,double distance=3pt,
                                          line cap=rect]
                    ([xshift=+2pt] \LN.south east)}},
                        ]
  • 앞서 언급한 사용 방법의 예는 다음과 같습니다.
\documentclass[journal,compsoc]{IEEEtran}
\usepackage{tabularray}
\newcommand\LST[3]{
    \begin{center}
    \begin{tblr}{colspec={@{} Q[c, font=\bfseries] X[#1] @{}} }
    #2  &   #3  
    \end{tblr}
    \end{center}}
\usepackage{caption}
\usepackage[export]{adjustbox}
\usepackage[label font=bf, labelformat=simple]{subfig}
\usepackage{lipsum}
\usepackage{tikz-cd}
\usetikzlibrary{arrows.meta,
                positioning}

\begin{document}
\lipsum[1][1-3]
\LST{c}{(a)}{$B\times_A$}
\LST{r}{(b)}{%
\begin{tikzpicture}[baseline=(current bounding box.center),
 node distance = 12mm,
compute/.style = {draw, thick, font=\small\sffamily, align=center,
                  append after command={\pgfextra{\let\LN\tikzlastnode}
                    ([xshift=-2pt] \LN.south west) 
                        edge[double=gray!50,double distance=3pt,
                                          line cap=rect]
                    ([xshift=+2pt] \LN.south east)}},
                        ]
    \node[compute] (n1) {Node};
    \node[compute,right=of n1] (n2) {More text};
    \node[compute,right=of n2] (n3) {More text text\\ text text text};
    \node[compute,below=of n2] (n4) {text};
    \draw[thick,draw, -Stealth, shorten > = 3pt, shorten < = 3pt]
        (n1) edge (n2)
        (n2) edge (n3)
        (n3) to (n4);
   \end{tikzpicture}%
        } 
\lipsum
\end{document}

죄송합니다. (github) 서버 오류로 인해 위의 MWE로 생성된 이미지를 업로드할 수 없습니다.

답변2

'태그 (b)'와 순서도 사이에 더 많은 공간이 필요하다고 생각합니다. 하지만 귀하의 MWE에는 아무런 문제가 없습니다. 아마도 페이지 여백 설정 때문일까요? 아래 첨부 파일을 참조하세요. 여기에 이미지 설명을 입력하세요

제가 추측한 것이 틀렸다면 원하는 내용에 대해 더 자세한 내용을 댓글로 남겨주세요.

관련 정보