提问于:
浏览数:
1452
## 编译环境
操作系统
* [X ] Windows 7/8/10
* [ ] macOS
* [ ] Linux
`若需勾选,请把[ ]改成[x]`
Tex发行版
* [X ] TexLive `年份`
* [ ] MikTeX `版本号`
* [ ] CTeX
`若需勾选,请把[ ]改成[x]`
## 我的问题
围棋坐标转换时,把提取出来的坐标,保存到"变量"中.
```latex
%!TeX encoding = UTF-8
%!TeX program = xelatex
\documentclass[a4paper]{article}
\usepackage{xstring}
\makeatletter
\newcommand\mycmd[2][]{%
\if\relax\detokenize{#1}\relax\else\p@rse@csl@opt#1,\@nil\fi
\p@rse@csl@mnd#2,\@nil
}
\def\p@rse@csl@opt#1,#2{%
\domycmdopt{#1}%
\ifx#2\@nil\else\expandafter\p@rse@csl@opt#2\fi
}
\def\p@rse@csl@mnd#1,#2{%
\domycmdmnd{#1}%
\ifx#2\@nil\else\expandafter\p@rse@csl@mnd#2\fi
}
\def\domycmdopt#1{color:#1\par}
%\def\domycmdmnd#1{mnd-arg:#1\par}
\newcounter{tgoy}
\setcounter{tgoy}{0}
\newcounter{tgox}
\setcounter{tgox}{0}
\def\domycmdmnd#1{%
\StrSplit{#1}{1}{\csA}{\tgox}
\tgoy=\IfStrEqCase{\csA}{{a}{1}{b}{2}{c}{3}{d}{4}{e}{5}{f}{6}{g}{7}[h]{8}{i}{9}{j}{10}{k}{11}{l}{12}{m}{13}{n}{14}{o}{15}{p}{16}{q}{17}{r}{18}{s}{19}}
%输出坐标,就是把x,y坐标转换为数字,存到"变量"中,然后会输入到tizk中进行绘画.
\tgoy:\tgox \\
}
\makeatletter
\begin{document}
%\mycmd[white]{b4,c2,a1,a2,a3,a4,a5}
\mycmd[black]{b4,c2,a1,a2,a3,a4,a5}
%坐标a=1,b=2,c=3,围棋棋盘的坐标a1就是1,1的意思,c3就是3,3的意思.
\end{document}
```