
TikZ에서 원으로 둘러싸인 텍스트의 수직 정렬에 문제가 있습니다. 이 기본 코드는 내가 가진 문제를 야기합니다.
\texttt{some text here =}
\tikz[remember picture] \node[draw,ellipse,fill=none,thick] (code) {\texttt{other text}};
문제는 표시된 텍스트 'some text here='가 표시된 텍스트 'other text'와 수직으로 정렬되지 않는다는 것입니다. 나는 문서에서 앵커에 대해 읽었고 그것이 유망해 보였지만 지금까지 나를 위해 일하게 할 수 없었습니다. 아마도 왼쪽을 노드로 만들어서 이 작업을 수행할 수 있지만 그럴 필요는 없다고 생각합니까? 어떤 제안이라도 주시면 감사하겠습니다!
답변1
base
옵션 에 대해 노드의 를 사용하십시오 baseline
.
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shapes}
\begin{document}
\texttt{some text here =}
\tikz[remember picture,baseline=(code.base)] \node[draw,ellipse,fill=none,thick] (code) {\texttt{other text}};
\end{document}
편집자: Claudio Fiandrino
가능한 대안은 다음과 같습니다.
\documentclass[11pt,a4paper]{article}
\usepackage{tikz}
\usetikzlibrary{shapes}
\begin{document}
\texttt{some text here = \tikz[baseline=-0.825ex] \node[draw,ellipse,fill=none,thick] (code) {other text};}
\end{document}
tikz
첫 번째 안에 코드를 삽입하면 texttt
타자기에서 자동으로 렌더링되므로 노드 내부의 명령을 건너뛸 수 있습니다.
답변2
\texttt{some text here =}
\tikz[remember picture,baseline]
\node[draw,ellipse,fill=none,thick,anchor=base] (code) {\texttt{other text}};