Debian Codegraph @

texmf-dist/doc/latex/eigo/eigo.tex

raw
1 % eigo.tex - Documentation for the eigo package
2 \documentclass[a4paper,11pt]{article}
3 \usepackage[T1]{fontenc}
4 \usepackage{lmodern}
5 \usepackage{xcolor}
6 \usepackage{array}
7 \usepackage{longtable}
8 \usepackage{booktabs}
9 \usepackage{geometry}
10 \geometry{margin=2.5cm}
11 \usepackage{doc}
12
13 % Load the eigo package
14 \usepackage[color,frame,coords]{eigo}
15
16 % Metadata
17 \title{The \textsf{eigo} Package\\
18 {\large Enhanced Go Diagrams for \LaTeX}}
19 \author{Marc Levivier\\
20 {\small (developed with AI assistance)}}
21 \date{Version 1.0 -- \today}
22
23 % Custom commands for documentation - check if they exist first
24 \providecommand{\cs}[1]{\texttt{\textbackslash#1}}
25 \providecommand{\pkg}[1]{\textsf{#1}}
26 \providecommand{\opt}[1]{\texttt{#1}}
27 \providecommand{\meta}[1]{\textit{#1}}
28
29 \begin{document}
30
31 \maketitle
32
33 \begin{abstract}
34 The \pkg{eigo} package provides comprehensive tools for creating professional Go (Weiqi/Baduk) game diagrams in \LaTeX\ documents. It offers enhanced features including multiple customizable stone colors, automatic numbering systems, geometric transformations, flexible board display options with enhanced borders, and full LuaLaTeX compatibility.
35 \end{abstract}
36
37 \tableofcontents
38
39 \section{Introduction}
40
41 Go is an ancient board game played on a grid of lines. Creating clear, professional diagrams for Go positions is essential for books, articles, and educational materials. The \pkg{eigo} package (Enhanced Igo) provides a modern, feature-rich solution for typesetting Go diagrams in \LaTeX.
42
43 \subsection{Features}
44
45 \begin{itemize}
46 \item Full and partial board displays with automatic zone detection and enhanced borders
47 \item Multiple stone colors (black, white, red, blue, green) with full customization
48 \item Two additional custom colors (customone, customtwo) with dedicated commands
49 \item Stone numbering with flexible automatic sequences
50 \item Symbol placement (geometric shapes and custom text)
51 \item Geometric transformations (rotations, mirrors, color swapping)
52 \item Flexible sizing from tiny to massive boards with validation
53 \item Coordinate display with customizable formatting
54 \item Multiple board support for variations
55 \item LuaLaTeX compatibility with proper UTF-8 handling
56 \item Enhanced border display for complete board diagrams
57 \end{itemize}
58
59 \subsection{Requirements}
60
61 \begin{itemize}
62 \item Modern \LaTeX\ distribution (TeX Live 2020+ recommended)
63 \item TikZ package (for graphics)
64 \item xcolor package (for colors)
65 \item Optional: LuaLaTeX for best UTF-8 support
66 \end{itemize}
67
68 \section{Package Options}
69
70 The \pkg{eigo} package accepts several options to customize its behavior:
71
72 \begin{longtable}{ll}
73 \toprule
74 \textbf{Option} & \textbf{Description} \\
75 \midrule
76 \opt{color} & Enable colored stones and backgrounds (default) \\
77 \opt{bw} & Black and white mode only \\
78 \opt{frame} & Show board frame and background with enhanced borders \\
79 \opt{noframe} & Hide board frame and background (default) \\
80 \opt{coords} & Show coordinate labels \\
81 \opt{nocoords} & Hide coordinate labels (default) \\
82 \opt{debug} & Enable debug output \\
83 \bottomrule
84 \end{longtable}
85
86 Example usage:
87 \begin{verbatim}
88 \usepackage[frame,coords]{eigo}
89 \end{verbatim}
90
91 \section{Basic Usage}
92
93 \subsection{Board Setup}
94
95 The default board size is 19×19, but you can change it:
96
97 \begin{verbatim}
98 \gobansize{19} % Standard board
99 \gobansize{13} % Smaller board
100 \gobansize{9} % Beginner board
101 \end{verbatim}
102
103 \subsection{Placing Stones}
104
105 Basic stone placement uses coordinate notation (letter + number):
106
107 \begin{verbatim}
108 \blackstones{d4,k10,q16}
109 \whitestones{d16,k4,q4}
110 \end{verbatim}
111
112 \cleargoban
113 \blackstones{d4,k10,q16}
114 \whitestones{d16,k4,q4}
115
116 \begin{center}
117 \showgoban[a1,s10]
118 \end{center}
119
120 \subsection{Displaying Boards}
121
122 Show the complete board with enhanced borders:
123 \begin{verbatim}
124 \showfullgoban
125 \end{verbatim}
126
127 Show a specific zone:
128 \begin{verbatim}
129 \showgoban[c3,m11] % Rectangle from c3 to m11
130 \showgoban[k10] % 5x5 area around k10
131 \end{verbatim}
132
133 \section{Stone Colors and Customization}
134
135 \subsection{Available Colors}
136
137 The package supports seven stone colors:
138 \begin{itemize}
139 \item \cs{blackstones}\{positions\}
140 \item \cs{whitestones}\{positions\}
141 \item \cs{redstones}\{positions\}
142 \item \cs{bluestones}\{positions\}
143 \item \cs{greenstones}\{positions\}
144 \item \cs{customonestones}\{positions\} -- Custom color 1 (default: purple)
145 \item \cs{customtwostones}\{positions\} -- Custom color 2 (default: orange)
146 \end{itemize}
147
148 \subsection{Color Customization}
149
150 You can customize all stone colors using RGB values:
151
152 \begin{verbatim}
153 \eigoblackcolor{0,0,0} % Standard black
154 \eigowhitecolor{255,255,255} % Standard white
155 \eigoredcolor{200,0,0} % Dark red
156 \eigobluecolor{0,0,200} % Dark blue
157 \eigogreencolor{0,150,0} % Dark green
158 \eigocustomonecolor{128,0,128} % Purple (default)
159 \eigocustomtwocolor{255,165,0} % Orange (default)
160 \end{verbatim}
161
162 Example with custom colors:
163 \begin{verbatim}
164 \eigocustomonecolor{255,0,255} % Bright magenta
165 \eigocustomtwocolor{0,255,255} % Cyan
166 \customonestones{d4,d5}
167 \customtwostones{e4,e5}
168 \end{verbatim}
169
170 \cleargoban
171 \eigocustomonecolor{255,0,255}
172 \eigocustomtwocolor{0,255,255}
173 \customonestones{d4,d5}
174 \customtwostones{e4,e5}
175
176 \begin{center}
177 \showgoban[c3,f6]
178 \end{center}
179
180 \subsection{Manual Numbering}
181
182 Add numbers to stones using optional parameter:
183
184 \begin{verbatim}
185 \blackstones[1]{d4}
186 \whitestones[2]{d5}
187 \blackstones[3]{e4}
188 \end{verbatim}
189
190 \cleargoban
191 \blackstones[1]{d4}
192 \whitestones[2]{d5}
193 \blackstones[3]{e4}
194
195 \begin{center}
196 \showgoban[d4]
197 \end{center}
198
199 \subsection{Automatic Numbering}
200
201 \subsubsection{Alternating Colors}
202
203 \cs{autoblackfirst}[n]\{positions\} starts with black stone numbered n, then alternates:
204
205 \begin{verbatim}
206 \autoblackfirst[1]{d4,d5,e4,e5,f4}
207 \end{verbatim}
208
209 \cleargoban
210 \autoblackfirst[1]{d4,d5,e4,e5,f4}
211
212 \begin{center}
213 \showgoban[d4]
214 \end{center}
215
216 The automatic numbering system supports skipping positions by using dashes:
217 \begin{verbatim}
218 \autoblackfirst[1]{d4,-,e4,e5} % Skip d5, continues numbering
219 \end{verbatim}
220
221 \cleargoban
222 \autoblackfirst[1]{d4,-,e4,e5}
223
224 \begin{center}
225 \showgoban[d4]
226 \end{center}
227
228 \subsubsection{Monochrome Sequences}
229
230 For same-color sequences with increment of 2:
231
232 \begin{verbatim}
233 \blackn[1]{d4,e4,f4} % Numbers: 1,3,5
234 \whiten[2]{d5,e5,f5} % Numbers: 2,4,6
235 \end{verbatim}
236
237 \cleargoban
238 \blackn[1]{d4,e4,f4}
239 \whiten[2]{d5,e5,f5}
240
241 \begin{center}
242 \showgoban[d4]
243 \end{center}
244
245 \section{Symbols and Markup}
246
247 \subsection{Geometric Symbols}
248
249 Place symbols on empty intersections:
250
251 \begin{verbatim}
252 \gobansymbol{d4,k10}{\eigotriangle}
253 \gobansymbol{d16,k4}{\eigosquare}
254 \gobansymbol{q4,q16}{\eigocircle}
255 \gobansymbol{k16}{\eigocross}
256 \end{verbatim}
257
258 Available symbols:
259 \begin{itemize}
260 \item \cs{eigotriangle} -- Triangle
261 \item \cs{eigosquare} -- Square
262 \item \cs{eigocircle} -- Circle
263 \item \cs{eigocross} -- Cross
264 \end{itemize}
265
266 \cleargoban
267 \gobansymbol{d4,k10}{\eigotriangle}
268 \gobansymbol{d16,k4}{\eigosquare}
269 \gobansymbol{q4,q16}{\eigocircle}
270 \gobansymbol{k16}{\eigocross}
271
272 \begin{center}
273 \showgoban[a1,s19]
274 \end{center}
275
276 \subsection{Text Labels}
277
278 Use custom text as symbols:
279 \begin{verbatim}
280 \gobansymbol{d4,e5}{A}
281 \gobansymbol{k10}{X}
282 \end{verbatim}
283
284 \section{Board Transformations}
285
286 \subsection{Rotations}
287
288 Rotate the current board position:
289
290 \begin{verbatim}
291 \eigorotate{90} % 90 degrees clockwise
292 \eigorotate{180} % 180 degrees
293 \eigorotate{270} % 270 degrees clockwise
294 \end{verbatim}
295
296 \subsection{Mirrors}
297
298 Mirror the board along different axes:
299
300 \begin{verbatim}
301 \eigomirrorh % Horizontal mirror
302 \eigomirrorv % Vertical mirror
303 \eigomirrordiag % Diagonal mirror
304 \end{verbatim}
305
306 \subsection{Color Operations}
307
308 \begin{verbatim}
309 \eigoswapcolors % Swap black and white stones
310 \end{verbatim}
311
312 \subsection{Example: Transformation Chain}
313
314 \cleargoban
315 \blackstones{d4,k10}
316 \whitestones{k4,d10}
317
318 Original position:
319 \begin{center}
320 \showgoban[a1,n11]
321 \end{center}
322
323 \eigorotate{90}
324
325 After 90° rotation:
326 \begin{center}
327 \showgoban[a1,n11]
328 \end{center}
329
330 \section{Board Sizing}
331
332 \subsection{Predefined Sizes}
333
334 \textbf{ENHANCED:} Extended range of predefined sizes with validation:
335
336 \begin{verbatim}
337 \tinygoban % 4mm per intersection
338 \smallgoban % 6mm per intersection
339 \normalgoban % 8mm per intersection (default)
340 \largegoban % 12mm per intersection
341 \hugegoban % 16mm per intersection
342 \massivegoban % 20mm per intersection
343 \end{verbatim}
344
345 \subsection{Custom Sizing with Validation}
346
347 Set exact unit size with automatic validation:
348 \begin{verbatim}
349 \eigounitsize{10mm}
350 \end{verbatim}
351
352 The package will issue warnings for very small (<2mm) or very large (>20mm) unit sizes.
353
354 Get current size information:
355 \begin{verbatim}
356 Current unit size: \theeigountisize
357 Size information: \eigosizeinfo
358 \end{verbatim}
359
360 Current unit size: \theeigountisize
361
362 \eigosizeinfo
363
364 \section{Multiple Boards}
365
366 Work with multiple board positions simultaneously:
367
368 \begin{verbatim}
369 \usegoban{1}
370 \blackstones{d4,k10}
371
372 \usegoban{2}
373 \blackstones{d4,k10,q16}
374 \whitestones{d16}
375
376 \usegoban{1} % Switch back to board 1
377 \showgoban[d4]
378
379 \usegoban{2} % Switch to board 2
380 \showgoban[d4]
381 \end{verbatim}
382
383 Current board number: \theeigobnum
384
385 \section{Complete Feature Overview}
386
387 \subsection{All Stone Colors with Numbering}
388
389 \begin{verbatim}
390 \cleargoban
391 \blackstones[1]{d4}
392 \whitestones[2]{e4}
393 \redstones[3]{f4}
394 \bluestones[4]{g4}
395 \greenstones[5]{h4}
396 \customonestones[6]{j4}
397 \customtwostones[7]{k4}
398 \gobansymbol{d5,e5,f5,g5}{\eigotriangle}
399 \gobansymbol{h5,j5,k5}{\eigosquare}
400 \end{verbatim}
401
402 \cleargoban
403 \blackstones[1]{d4}
404 \whitestones[2]{e4}
405 \redstones[3]{f4}
406 \bluestones[4]{g4}
407 \greenstones[5]{h4}
408 \customonestones[6]{j4}
409 \customtwostones[7]{k4}
410 \gobansymbol{d5,e5,f5,g5}{\eigotriangle}
411 \gobansymbol{h5,j5,k5}{\eigosquare}
412
413 \begin{center}
414 \showgoban[c3,l7]
415 \end{center}
416
417 This example demonstrates all seven stone colors with numbering and symbols.
418
419 \subsection{Size and Frame Combinations}
420
421 \subsubsection{Small + Frame}
422
423 \cleargoban
424 \smallgoban
425 \eigoframe
426 \blackstones{d4,k10}
427 \whitestones{k4,d10}
428
429 \begin{center}
430 \showfullgoban
431 \end{center}
432
433 \subsubsection{Large + No Frame}
434
435 \cleargoban
436 \largegoban
437 \eigonoframe
438 \blackstones{d4,k10}
439 \whitestones{k4,d10}
440
441 \begin{center}
442 \showgoban[c3,l11]
443 \end{center}
444
445 \normalgoban % Reset to normal
446 \eigonoframe % Reset frame
447
448 \section{Coordinate System}
449
450 \subsection{Position Format}
451
452 Positions use standard Go notation:
453 \begin{itemize}
454 \item Columns: a--t (skipping 'i')
455 \item Rows: 1--19 (or board size)
456 \item Examples: \texttt{d4}, \texttt{k10}, \texttt{q16}
457 \end{itemize}
458
459 \subsection{Coordinate Display}
460
461 Enable coordinates with package option or commands:
462 \begin{verbatim}
463 \eigocoords % Enable coordinate display
464 \eigonocoords % Disable coordinate display
465 \end{verbatim}
466
467 Customize coordinate appearance:
468 \begin{verbatim}
469 \eigocoordscale{0.8} % Scale factor
470 \eigocoorddistance{0.7} % Distance from board
471 \end{verbatim}
472
473 \section{Enhanced Board Display}
474
475 \subsection{Border Enhancement}
476
477 Complete board diagrams feature enhanced borders for better visual definition:
478
479 \begin{verbatim}
480 \eigoframe % Enable enhanced frame display
481 \eigonoframe % Disable frame display
482 \end{verbatim}
483
484 When frame display is enabled, complete boards show:
485 \begin{itemize}
486 \item Thick border (2pt width) around the entire board
487 \item Colored background in color mode
488 \item Professional appearance suitable for publication
489 \end{itemize}
490
491 \subsection{Frame vs No-Frame Comparison}
492
493 \cleargoban
494 \blackstones{d4,q16}
495 \whitestones{d16,q4}
496
497 No frame (partial view):
498 \begin{center}
499 \eigonoframe
500 \showgoban[a1,s10]
501 \end{center}
502
503 With enhanced frame (same area):
504 \begin{center}
505 \eigoframe
506 \showgoban[a1,s19]
507 \end{center}
508
509 \section{Board Management}
510
511 \subsection{Clearing Positions}
512
513 Clear entire board:
514 \begin{verbatim}
515 \cleargoban
516 \end{verbatim}
517
518 Clear specific zone:
519 \begin{verbatim}
520 \cleargoban[d4,k10] % Clear rectangle
521 \cleargoban[k10] % Clear 5x5 around k10
522 \end{verbatim}
523
524 Clear specific positions:
525 \begin{verbatim}
526 \eigoclear{d4,e5,k10}
527 \end{verbatim}
528
529 \subsection{Information Commands}
530
531 Get board information:
532 \begin{verbatim}
533 Board size: \theeigobsize
534 Current board: \theeigobnum
535 Unit size: \theeigountisize
536 \end{verbatim}
537
538 Board size: \theeigobsize, Current board: \theeigobnum
539
540 \section{Advanced Examples}
541
542 \subsection{Game Sequence with Custom Colors}
543
544 \begin{verbatim}
545 \cleargoban
546 \gobansize{19}
547 \normalgoban
548
549 % Customize colors for this example
550 \eigoblackcolor{50,50,50} % Dark gray instead of black
551 \eigoredcolor{180,0,0} % Deep red
552
553 % Opening moves
554 \blackstones{d4,q16}
555 \whitestones{d16,q4}
556
557 % Approach and response with custom color
558 \redstones[1]{k4}
559 \autoblackfirst[2]{k3,k5}
560
561 \showgoban[h1,n7]
562 \end{verbatim}
563
564 \cleargoban
565 \eigoblackcolor{50,50,50}
566 \eigoredcolor{180,0,0}
567 \blackstones{d4,q16}
568 \whitestones{d16,q4}
569 \redstones[1]{k4}
570 \autoblackfirst[2]{k3,k5}
571
572 \begin{center}
573 \showgoban[h1,n7]
574 \end{center}
575
576 \subsection{Problem Diagram with Enhanced Display}
577
578 \begin{verbatim}
579 \cleargoban
580 \eigoframe % Enable enhanced borders
581 \blackstones{f3,g3,h3,g4,h4,g5}
582 \whitestones{f4,f5,g6,h5,h6}
583 \gobansymbol{f6}{A}
584 \gobansymbol{h7}{B}
585
586 \showgoban[e2,j8]
587 \end{verbatim}
588
589 \cleargoban
590 \eigoframe
591 \blackstones{f3,g3,h3,g4,h4,g5}
592 \whitestones{f4,f5,g6,h5,h6}
593 \gobansymbol{f6}{A}
594 \gobansymbol{h7}{B}
595
596 \begin{center}
597 \showgoban[e2,j8]
598 \end{center}
599
600 \subsection{Variation Analysis with Custom Stone Colors}
601
602 Using multiple boards and custom colors for clear differentiation:
603
604 \begin{verbatim}
605 % Main line
606 \usegoban{1}
607 \eigocustomonecolor{0,100,0} % Dark green
608 \blackstones{d4,k10}
609 \whitestones{d10,k4}
610 \customonestones[1]{k16} % Main line move
611
612 % Variation
613 \usegoban{2}
614 \eigocustomtwocolor{100,0,100} % Dark purple
615 \blackstones{d4,k10}
616 \whitestones{d10,k4}
617 \customtwostones[1]{q4} % Variation move
618 \end{verbatim}
619
620 \section{Package Implementation}
621
622 \subsection{Internal Storage}
623
624 The package uses a sophisticated storage system to handle:
625 \begin{itemize}
626 \item Stone colors and positions with full customization support
627 \item Stone numbers
628 \item Symbols and markup
629 \item Multiple board states with independent color settings
630 \end{itemize}
631
632 \subsection{Enhanced Border System}
633
634 The enhanced border system provides:
635 \begin{itemize}
636 \item Configurable border width (\cs{eigo@border@width}, default 2pt)
637 \item Automatic detection of full vs partial board display
638 \item Smart background color management based on frame and color options
639 \item Professional appearance for publication-quality diagrams
640 \end{itemize}
641
642 \subsection{Color Management}
643
644 The color system includes:
645 \begin{itemize}
646 \item Seven distinct stone colors with full RGB customization
647 \item Dynamic color redefinition during document processing
648 \item Color mode switching (color/bw) with proper fallbacks
649 \item Default color palettes optimized for readability
650 \end{itemize}
651
652 \subsection{LuaLaTeX Compatibility}
653
654 The package includes enhanced LuaLaTeX support:
655 \begin{itemize}
656 \item UTF-8 character definitions with \cs{newunicodechar}
657 \item Proper font encoding detection and handling
658 \item Compatibility with luatex85 for older LuaTeX versions
659 \item Robust handling of special characters in all engines
660 \end{itemize}
661
662 \section{Troubleshooting}
663
664 \subsection{Common Issues}
665
666 \textbf{Stones not appearing:} Check position notation (no 'i' in columns).
667
668 \textbf{Colors not changing:} Ensure color commands are called before stone placement.
669
670 \textbf{Board too large/small:} Use size commands or \cs{eigounitsize} with validation.
671
672 \textbf{Borders not showing:} Enable frame mode with \cs{eigoframe} and use full board display.
673
674 \textbf{Custom colors reverting:} Color changes affect subsequent stone placements only.
675
676 \textbf{UTF-8 errors:} Use LuaLaTeX for best compatibility or ensure proper input encoding.
677
678 \subsection{Debug Mode}
679
680 Enable debug output for troubleshooting:
681 \begin{verbatim}
682 \usepackage[debug]{eigo}
683 \end{verbatim}
684
685 This provides detailed console output about:
686 \begin{itemize}
687 \item Position parsing and validation
688 \item Board operations and transformations
689 \item Color definitions and changes
690 \item Size validation warnings
691 \item Zone detection and rendering
692 \end{itemize}
693
694 \section{Comparison with Other Packages}
695
696 \begin{longtable}{p{2cm}p{5cm}p{7cm}}
697 \toprule
698 \textbf{Package} & \textbf{Features} & \textbf{Advantages of eigo} \\
699 \midrule
700 igo & Black \& White Go diagrams & Multiple customizable colors, enhanced borders \\
701 \bottomrule
702 \end{longtable}
703
704 \section{License and Acknowledgments}
705
706 The \pkg{eigo} package is released under the \LaTeX\ Project Public License v1.3c or later.
707
708 Inspired by the \pkg{igo} package and enhanced with modern \LaTeX\ techniques and comprehensive Go diagram requirements for professional publication.
709
710 \textbf{Development note:} This package was developed by Marc Levivier with AI assistance for code generation, documentation, and testing. The design decisions, feature requirements, and final implementation remain under human authorship.
711
712 \section{Version History}
713
714 \begin{description}
715 \item[v1.0 (2025-09-06)] Complete feature set with enhanced borders, full color customization, extended size options, improved LuaLaTeX support, and comprehensive validation
716 \end{description}
717
718 \end{document}