
어떤 이유로 내 문서의 다른 부분을 손상시키지 않고 수정하기에는 너무 많은 작업이 될 수 있습니다. Tikzcd는 설명서에 따르면 "화살표에 대한 대체 구문"이 있는 호환 모드에서만 내 문서에서 작동합니다. 레이블의 따옴표 구문"을 참조하세요.
이는 다음과 같은 코드를 의미합니다.
\arrow[r, Rightarrow, "\phi"]
내 문서에서는 작동하지 않습니다. 다음과 같이 작성해야 합니다.
\arrow[Rightarrow]{r}{\phi}
의도한 결과를 얻으려면.
그렇다면 다음과 같은 표현을 어떻게 작성합니까 [from=A,to=B]
?
\documentclass{article}
\usepackage{tikz-cd}
\begin{document}
\begin{tikzcd}
A \arrow[r, bend left=50, ""{name=U, below, draw=red}]
\arrow[r, bend right=50, ""{name=D, draw=red}]
& B
\arrow[Rightarrow, from=U, to=D]
\end{tikzcd}
\end{document}
보다 구체적으로 다음과 같은 표현이 작동하도록 노력했습니다.
\documentclass{article}
\usepackage{tikz-cd}
\begin{document}
\begin{tikzcd}
\mathcal{C}
\ar[bend left=47, pos=0.5]{r}{F}
\ar[bend right=47, pos=0.5]{r}[swap]{G}
\arrow[phantom,bend left=40, shift right=0.2ex, name=U]{r}
\arrow[phantom,bend right=38.4, shift left=0.2ex, swap, name=D]{r}
& \mathcal{D}
\arrow[Rightarrow]{from=U,to=D}{N}
\end{tikzcd}
\end{document}
그러나 위쪽 화살표 중앙에서 아래쪽 화살표 중앙으로 이동해야 했던 마지막 화살표는 오류를 발생시키고 약간 위쪽으로 기울어진 왼쪽 화살표로 잘못 표시됩니다. 즉, 내가 얻는 결과는 다음과 같습니다.
내가 다음과 같은 것을 원할 때:
물론 다른 이름도 표시됩니다.
답변1
에 따르면tikz-cd
수동, 관련 셀 내부의 옵션을 통해 할당할 수 있는 노드 이름을 사용하는 것 외에도 (아래 두 번째 예 참조) 및 옵션을 사용할 때 화살표의 시작과 끝을 나타내는 alias
구문을 사용할 수도 있습니다 (아래 첫 번째 예 참조). . 그러나 이러한 옵션은 선택적 인수 안에 넣어야 합니다. 또는 를 사용하여 화살표를 추가로 이동할 수 있습니다 .<row number>-<column number>
from
to
xshift
yshift
\documentclass[border=10pt, tikz]{standalone}
\usepackage{tikz-cd}
\begin{document}
\begin{tikzcd}
\mathcal{C}
\arrow[bend left=47, pos=0.5]{r}{F}
\arrow[bend right=47, pos=0.5]{r}[swap]{G}
& \mathcal{D}
\arrow[Rightarrow, from=1-2, to=1-1, yshift=0.5pt]{}{N}
\end{tikzcd}
\end{document}
\documentclass[border=10pt, tikz]{standalone}
\usepackage{tikz-cd}
\begin{document}
\begin{tikzcd}
|[alias=R]| \mathcal{C}
\arrow[bend left=47, pos=0.5]{r}{F}
\arrow[bend right=47, pos=0.5]{r}[swap]{G}
& |[alias=L]| \mathcal{D}
\arrow[Rightarrow, from=L, to=R, yshift=0.5pt]{}{N}
\end{tikzcd}
\end{document}
두 코드 조각 모두 동일한 출력을 생성합니다.
이제 아래쪽 화살표를 추가하는 것이 그리 간단하지는 않습니다. 화살표의 시작과 끝을 나타내는 두 좌표는 위 전략을 통해 선택할 수 있는 셀이 아니기 때문입니다. 그러나 다음 예와 같이 행렬을 약간 확장할 수 있습니다.
\documentclass[border=10pt, tikz]{standalone}
\usepackage{tikz-cd}
\begin{document}
\begin{tikzcd}
& {} & \\
\mathcal{O}(X)^{op}
\arrow[bend left=47, pos=0.5]{rr}{\Lambda A}
\arrow[bend right=47, pos=0.5]{rr}[swap]{\Lambda A'}
& & \textbf{Set} \\
& {} &
\arrow[Rightarrow, from=1-2, to=3-2,
shorten >=5pt, shorten <=5pt, xshift=-3.5pt]
{}{\Lambda f}
\end{tikzcd}
\end{document}
start anchor
또는 및 옵션 을 사용할 수 있지만 end anchor
아래쪽 구부러진 화살표의 레이블이 이렇게 작은 크기로 잘못 배치되었습니다.
\documentclass[border=10pt, tikz]{standalone}
\usepackage{tikz-cd}
\begin{document}
\begin{tikzcd}
|[alias=R]| \mathcal{O}(X)^{op}
\arrow[bend left=47, pos=0.5]{r}{\Lambda A}
\arrow[bend right=47, pos=0.5]{r}[swap]{\Lambda A'}
& |[alias=L]| \textbf{Set}
\arrow[Rightarrow, from=L, to=L,
start anchor={[xshift=-1cm]north}, end anchor={[xshift=-1cm]south}]
{}{\Lambda f}
\end{tikzcd}
\end{document}
레이블의 위치는 \strut
각 셀에 를 추가하여 동일한 크기로 만들 수 있습니다.
\documentclass[border=10pt, tikz]{standalone}
\usepackage{tikz-cd}
\begin{document}
\begin{tikzcd}
|[alias=R]| \mathcal{O}(X)^{op}\strut
\arrow[bend left=47, pos=0.5]{r}{\Lambda A}
\arrow[bend right=47, pos=0.5]{r}[swap]{\Lambda A'}
& |[alias=L]| \textbf{Set}\strut
\arrow[Rightarrow, from=L, to=L,
start anchor={[xshift=-1cm]north}, end anchor={[xshift=-1cm]south}]
{}{\Lambda f}
\end{tikzcd}
\end{document}
답변2
다음과 같은 다른 경로를 제안해 보겠습니다.
tikz-cd
최신 버전을 처리할 수 없는 문서 작업- 최신
tikz-cd
버전을 사용하면서
접근 방식은 요구사항을 공간적으로 분리하는 것입니다. 즉, 이것은 한 곳에서, 저것은 다른 곳에서:
- 기본 문서로 작업하세요.
incompatible documentclass
standalone
클래스 에 따라 각각 하나의 다이어그램을 나타내는 많은 문서로 작업합니다.
여기 있습니다:
arrows.tex, 이는 약간 변형된 게시된 코드입니다. 그냥 컴파일하세요. arrows.pdf
잠시 후에 다시 설명하겠습니다 .
\documentclass[10pt,border=3mm]{standalone}
%\documentclass{article}
\usepackage{tikz-cd}
\begin{document}
\begin{tikzcd}
A \arrow[r, bend left=50, ""{name=U, below, draw=red}]
\arrow[r, bend right=50, ""{name=D, draw=red}]
& B
\arrow[Rightarrow, from=U, to=D]
\end{tikzcd}
\end{document}
main.tex는 특이한 문서 클래스를 사용한다고 가정해 보겠습니다 . screenplay
이는 와 협력할 때 기본 클래스가 갖는 차이점, 단점, 비호환성 등을 모방합니다 tikz-cd
.
각본은 tikz-cd에서도 작동할 수 있지만 확인하지 않았습니다. 하지만 그렇지 않은 척 해보자. 보시다시피, Tikz 방언을 전혀 사용하지 않습니다 ...
관련 코드 줄은 다음과 같습니다.
...
\usepackage{graphicx} % without tikz showing tikz-cd diagram
...
\includegraphics[width=.3\textwidth]{arrows}% i.e. arrows.pdf
...
\documentclass{screenplay}[2012/06/30] % just an alian class
\usepackage{graphicx} % without tikz showing tikz-cd diagram
% ~~~ some shortcuts ~~~~~~~~~~~~
\newcommand\di[2]{\begin{dialogue}{#1}#2\end{dialogue}}
\newcommand\dia[3]{\begin{dialogue}[#2]{#1}#3\end{dialogue}}
\newcommand\newch[1]{\MakeUppercase{#1}}
\newcommand\pr[0]{Proggi}
\newcommand\ld[0]{Lad}
% ~~~ some redefine ~~~~~~~~~~~
\renewcommand\emph{***}
% ~~~~~~~~~~~~~~~~~~~~~~~
\begin{document}
\title{An arrows drama}
\author{MS-SPO}
\maketitle
% ~~~ Characters ~~~~~~~~~~~~~~~~~~~~~~
\newch{Proggi}, a programmer, full of energy.
\newch{Lad}, a nice document creating language, with some bells and whistles.
% ~~~ Let the drama begin ~~~~~~~~~~~
\fadein
\intslug[Night]{A stubborn documentclass}
\pr{} spent already endless hours, while \ld{} keeps being stubborn.
\dia{\pr}{impatient}{Why can't you just do what I'm telling you to do! Why can't you?}
\dia{\ld}{amused}{You did read the manuals, did you?}
\dia{\pr}{about to burst}{Yours, yeah \dots other ones?}
\dia{\ld}{whispering}{Yes: about \emph{standalone} and \emph{graphicx} \dots There you go \dots}
\begin{center}
\includegraphics[width=.3\textwidth]{arrows} % <<<
\end{center}
\fadeout
\end{document}