라텍스로 차트와 같은 그래프 만들기(정수 이론용)

라텍스로 차트와 같은 그래프 만들기(정수 이론용)

나는 라텍스로 정수론 수업 노트를 작성하고 있었고 마지막 부분을 제외하고 모든 작업이 완료되었습니다(지금은 오랫동안 연기해 왔습니다!).

다음 그래프/차트를 라텍스로 전송하는 가장 좋은 방법을 찾으려고 노력하고 있지만 어떤 패키지를 선택해야 할지 잘 모르겠습니다.

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

몇 가지 지침과 제안에 진심으로 감사드립니다.

PS 저는 Overleaf에서 일했거나 일해 왔습니다. 이 질문에 전체 문서를 게시하기에는 문서 전체가 너무 길기 때문에,여기유용할 경우를 대비해 링크입니다. (작동하지 않을 경우 알려주세요.)

PSS 저는 이전에 주로 tikz(그래프 이론 및 게임 이론 관련)와 기능적 그래프를 생성하는 데 주로 사용된 일부 다른 패키지를 사용하여 작업했습니다. 그래서 이 경험을 바탕으로 이 그래프도 tikz로 구성할 수 있겠다는 생각이 들었습니다.

답변1

Tikz에서는 그리드를 그린 다음 채워진 작은 원을 그리는 노드를 정의하는 데 사용할 수 있습니다 grid(아래 코드 참조 plupp). 그 후에는 대부분 텍스트 노드 위치를 지정하는 문제입니다.

\documentclass[border=3mm]{standalone}
\usepackage{tikz}
\usepackage{amsmath}
\begin{document}
\begin{tikzpicture}[plupp/.style={circle,draw,inner sep=1pt,fill=black}]
  \draw (0,0) grid (7,5);
  \node[anchor=north east] at (0,0){$0$};
  \node[anchor=south east] at (0,5){$\alpha$};
  \node[anchor=south west] at (7,5){$N$};
  \node[anchor=north west] at (7,0){$R$};
  \draw (0,0) -- (7,5);
  \node[plupp,label={180:$C$}] at (0,2){};
  \node[plupp,label={-90:$A$}] at (3,0){};
  \node[plupp,label=110:$P$] at (7*2/5,2){};
  \node[plupp,label=90:$\mu$] at (3,5*3/7){};
  \node[plupp,label=-45:$B$] at (3,2){};
  \draw[<->](0,-0.7) -- +(3,0) node[pos=0.5,fill=white]{$\tfrac{p-1}{2}$};
  \draw[<->](0,-1.3) -- +(7,0) node[pos=0.5,fill=white]{$p$};
  \draw[<->](-0.7,0) -- +(0,2) node[pos=0.5,fill=white]{$\tfrac{g-1}{2}$};
  \draw[<->](7.5,0) -- +(0,5) node[pos=0.5,fill=white]{$g$};
\end{tikzpicture}
\end{document}

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

답변2

여기에 이미지 설명을 입력하세요음, 여기 tikz 패키지를 사용하는 스타터가 있습니다.

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{tikz}

\begin{document}

\begin{tikzpicture}
\draw[gray, thick] (0,0) -- (0,6);
\draw[gray, thick] (1,0) -- (1,6);
\draw[gray, thick] (2,0) -- (2,6);
\draw[gray, thick] (3,0) -- (3,6);
\draw[gray, thick] (4,0) -- (4,6);
\draw[gray, thick] (5,0) -- (5,6);
\draw[gray, thick] (6,0) -- (6,6);
\draw[gray, thick] (7,0) -- (7,6);

\draw[gray, thick] (0,0) -- (7,0);
\draw[gray, thick] (0,1) -- (7,1);
\draw[gray, thick] (0,2) -- (7,2);
\draw[gray, thick] (0,3) -- (7,3);
\draw[gray, thick] (0,4) -- (7,4);
\draw[gray, thick] (0,5) -- (7,5);
\draw[gray, thick] (0,6) -- (7,6);
\draw[black, thick] (0,0) -- (7,6);

\filldraw[black] (0,0) circle (2pt) node[anchor=east] {0};
\filldraw[black] (0,2) circle (2pt) node[anchor=east] {C};
\filldraw[black] (7,0) circle (2pt) node[anchor=west] {R};
\filldraw[black] (0,6) circle (2pt) node[anchor=east] {2};
\filldraw[black] (7,6) circle (2pt) node[anchor=west] {N};

\end{tikzpicture}

\end{document}

중간 지점에 대해서는 잘 모르겠습니다. 저였다면 파워포인트 그림으로 만들어서 pdf로 내보냈을 것 같아요. tikz 패키지에 대해 자세히 알아보려면 다음 문서를 참조하세요.

https://www.overleaf.com/learn/latex/TikZ_package

페이지에서 원하는 위치를 알고 있는 한 비슷한 명령을 사용하여 화살표와 방정식 주석을 만들 수 있다고 확신합니다.

답변3

asymptote옵션으로 고려하세요 .

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

// tab-numt.asy
// 
// run 
//    asy tab-numt.asy
//
// to get a standalone pdf picture
//    tab-numt.pdf
//
settings.tex="pdflatex";
size(9cm);
pen linePen=darkblue+0.7bp, grayPen=gray(0.3)+0.7bp;
arrowbar arr=Arrows(HookHead,size=2);
int n=3, m=2, p=2*n+1, q=2*m+1;

guide hLine[], vLine[];
for(int i=0;i<=q;++i)hLine[i]=(0,i)--(p,i);
for(int i=0;i<=p;++i)vLine[i]=(i,0)--(i,q);

pair N=(p,q), O=(0,0), Q=(0,q), R=(p,0), 
  A=((p-1)/2,0), C=(0,(q-1)/2), B=(A.x,C.y),
  M=intersectionpoint(O--N,vLine[(p-1)#2]),
  P=intersectionpoint(O--N,hLine[(q-1)#2]),
  Z=(B+P+M)/3
;
pair[] pos={N,O,Q,R,A,B,C,P,M}; string name="NOQRABCPM";

draw(hLine,linePen); draw(vLine,linePen);
draw(O--N,linePen);

pair dx=(0.62,0), dy=(0,0.5);

draw((O-dy)--(A-dy),grayPen,arr); label("$\frac{p-1}2$",(O+A)/2-dy,UnFill);

draw((O-2dy)--(R-2dy),grayPen,arr); label("$p$",(O+R)/2-2dy,UnFill);

draw((O-dx)--(C-dx),grayPen,arr); label("$\frac{q-1}2$",(O+C)/2-dx,UnFill);

draw((N+dx)--(R+dx),grayPen,arr); label("$q$",(N+R)/2+dx,UnFill);

dot(pos[4:9],UnFill);

for(int i=0;i<7;++i) label("$"+substr(name,i,1)+"$",pos[i],unit(pos[i]-Z));
label("$M$",M,plain.NW); label("$P$",P,plain.S);

답변4

tkz-유클리드 솔루션

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

\documentclass[12pt]{article}

 % \usepackage{amsmath}
\usepackage{tkz-euclide}

\begin{document}    
                \begin{tikzpicture}
                %the grid
                \tkzInit[xmin=0,xmax=7,ymin=0,ymax=5]
                \tkzGrid
                %the axes
%               \tkzDrawX[label={}]
%               \tkzDrawY[label={}]
                
                %draw the points O, R, 2, N, A, C
                \tkzDefPoints{0/0/O,7/0/R,0/5/2,7/5/N,3/0/A,0/2/C}
                \tkzDrawPoints(O,R,2,N,A,C)
                \tkzLabelPoints(O,R,N,A)
                \tkzLabelPoints[left](2)
                \tkzLabelPoints[left,yshift=6pt](C)
                
                %segment ON
                \tkzDrawSegment[](O,N)
                
                %calculate intersections for point P, M, B
                \tkzDefShiftPoint[C](0:7){Xc}
                \tkzDefLine(C,Xc)
%               \tkzDrawLine(C,Xc)%
                \tkzDefShiftPoint[A](90:5){Xa}
                \tkzDefLine(A,Xa)
%               \tkzDrawLine(A,Xa)
                \tkzInterLL(A,Xa)(C,Xc)\tkzGetPoint{B}
                \tkzDrawPoint[red](B)
                \tkzLabelPoints[,font=\tiny](B)
                
                \tkzInterLL(O,N)(C,Xc)\tkzGetPoint{P}
                \tkzDrawPoint[green](P)
                \tkzLabelPoints[above left,font=\tiny](P)
                
                \tkzInterLL(O,N)(A,Xa)\tkzGetPoint{M}
                \tkzDrawPoint[blue](M)
                \tkzLabelPoints[above,font=\tiny, xshift=-4pt](M)
                
                %some labels
                \tkzDrawSegment[dim={$g$,-20pt,above=0pt,font=\tiny}](R,N)
                \tkzDrawSegment[dim={$P$,-30pt,above=-3pt,font=\tiny}](O,R)
                \tkzDrawSegment[dim={$(P-1)/2$,-15pt,above=-3pt,font=\tiny}](O,A)
                \tkzDrawSegment[dim={$(g-1)/2$,15pt,above=0pt,font=\tiny}](O,C)
                \end{tikzpicture}
        
\end{document}

관련 정보