다음은 예상대로 작동합니다.
\documentclass{minimal}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\makeatletter
\node (01) at (0, 0) {};
\draw (0, 0) -- (0, 01);
\makeatother
\end{tikzpicture}
\end{document}
01
그러나 s 중 하나를 \@ifnextchar1001
내 이해에 따라 동일해야 하는 으로 바꾸면 깨집니다.
\documentclass{minimal}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\makeatletter
\node (\@ifnextchar1001) at (0, 0) {};
\makeatother
\end{tikzpicture}
\end{document}
준다
! Argument of \XC@definec@lor has an extra }. <inserted text> \par l.6 \node (\@ifnextchar1001) at (0, 0) {};
그리고
\documentclass{minimal}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\makeatletter
\draw (0, 0) -- (0, \@ifnextchar1001);
\makeatother
\end{tikzpicture}
\end{document}
수확량
! Argument of \XC@definec@lor has an extra }. <inserted text> \par l.6 \draw (0, 0) -- (0, \@ifnextchar1001) ;
이 경우 01
와 의 관련 차이점은 무엇입니까 ? \@ifnextchar1001
이 또는 유사한 구성이 의도한 대로 작동하도록 하려면 어떻게 해야 합니까?
답변1
\@ifnextchar
내부적으로 사용되기 때문에 확장이 불가능합니다 \futurelet
. 노드 이름은 확장 가능해야 하며 내부적으로 \csname
... 내부에서 사용됩니다 \endcsname
.
단순한 숫자만 비교하려는 경우 일반 매크로 인수 구문 분석을 사용하는 테스트로 충분합니다.
\documentclass{minimal}
\usepackage{tikz}
% \IfNextChar
% #1: the char for testing
% #2: code for true
% #3: code for false
% #4: next char
\makeatletter
\newcommand{\IfNextChar}[4]{%
\ifx#1#4\@empty\@empty
\expandafter\@firstoftwo
\else
\expandafter\@secondoftwo
\fi
{#2}{#3}%
}
\makeatother
\begin{document}
\begin{tikzpicture}
\node (\IfNextChar1001) at (0, 0) {};
\end{tikzpicture}
\end{document}
\@ifnextchar
좌표로 사용하는 경우에도 동일하게 적용됩니다 .
답변2
PGF 수학을 사용하여 숫자를 기본 10에서 기본 10으로 변환할 수 있습니다. 과잉일 수도 있고 아닐 수도 있습니다.
\documentclass{article}
\usepackage{tikz}
\begin{document}
\pgfmathbasetodec{\myconvresult}{001}{10}
\pgfmathsetmacro\myresult{\myconvresult+1}\myresult
\pgfmathbasetodec{\myconvresult}{0214}{10}
\pgfmathsetmacro\myresult{\myconvresult+1}\myresult
\pgfmathbasetodec{\myconvresult}{000035}{10}
\pgfmathsetmacro\myresult{\myconvresult+1}\myresult
\pgfmathbasetodec{\myconvresult}{301}{10}
\pgfmathsetmacro\myresult{\myconvresult+1}\myresult
\end{document}
어딘가에 이것에 대한 설정이 없다면 놀랐습니다 ....