\section{Settings}
\label{sec:configuracion}

|\pgfgoset{...}| sets options for everything that follows: the look of the board, of the stones, of the moves, etc. It is equivalent to |\keys_set:nn{pgfgo}{...}|. It is also a door to direct formatting.\footnote{Use with discretion\dots\ not like footnotes.}

\begin{command}{\pgfgoset\marg{options}}
\end{command}

\begin{key}{/pgfgo/goban = \meta{goban options}}
	Options of the board (p.~\pageref{sec:tablero}): the size, the grid, the background, the coordinates, etc.
\end{key}

\begin{key}{/pgfgo/stone = \meta{stone options}}
	Options of the stones of the three players (p.~\pageref{sec:piedras}), the same as |players = {all = {stone = {...}}}|.
\end{key}

\begin{key}{/pgfgo/move = \meta{move options}}
	Options of the moves, such as the format of their numbers. Except for |numbers| (p.~\pageref{subsec:movimientos}), which holds for every move, it is the same as |players = {all = {move = {...}}}|.
\end{key}

\begin{key}{/pgfgo/mark = \meta{mark options}}
	Options of the marks: the default shape of |\marks| (|\pgfgoset{mark = {triangle}}|) and the style of the marks of the three players (|line|, |fill|, |label|, |sequence| and |scale|): |mark = {scale = 2}| is the same as |players = {all = {mark = {scale = 2}}}|.
\end{key}

\begin{key}{/pgfgo/sgf animation = \meta{sgf animation options}}
	Options of every |\sgfanimation| of the document (p.~\pageref{subsec:sgfanimacion}).
\end{key}

\begin{key}{/pgfgo/sgf diagrams = \meta{sgf diagrams options}}
	Options of every |\sgfdiagrams| of the document (p.~\pageref{subsec:sgfdiagramas}).
\end{key}

\begin{key}{/pgfgo/sgf problem = \meta{sgf problem options}}
	Options of every |\sgfproblem| of the document (p.~\pageref{subsec:sgfproblemas}).
\end{key}

\begin{key}{/pgfgo/sgf comment = \meta{sgf comment options}}
	Options of every |\sgfcomment| of the document (p.~\pageref{subsec:sgfdatos}).
\end{key}

\begin{key}{/pgfgo/sgf info = \meta{sgf info options}}
	Options of every |\sgfinfo| of the document (p.~\pageref{subsec:sgfdatos}).
\end{key}

\begin{key}{/pgfgo/sgf annotations = \meta{texts}}
	The texts of the annotations of SGF files (p.~\pageref{subsec:sgfdatos}).
\end{key}

\begin{key}{/pgfgo/arrow = \meta{arrow options}}
	Options of every arrow of the document (p.~\pageref{subsec:flechas}).
\end{key}

\begin{key}{/pgfgo/line = \meta{line options}}
	Options of every line of the document (p.~\pageref{subsec:flechas}).
\end{key}

\begin{key}{/pgfgo/territory = \meta{territory options}}
	Options of every |\territory| of the document, such as |draw = fill| (p.~\pageref{subsec:territorio}).
\end{key}

\begin{key}{/pgfgo/score = \meta{score options}}
	Options of every |\pgfgoscore| of the document, such as |komi = 6.5| (p.~\pageref{subsec:territorio}).
\end{key}

\begin{key}{/pgfgo/players = \meta{players options}}
	Options of each player: black, white and neutral (p.~\pageref{sec:jugadores}).
\end{key}

\begin{codeexample}[]
	\pgfgoset{
		goban = {
			background = {
				fill = {color = pgfgo},
				line = false},
			grid = {line = {color = white}}},
		players = {
			black = {
				stone = {
					line = {color = magenta},
					fill = {color = blue!50!black}}},
			white = {
				stone = {line = {color = blue}},
				mark = {line = {color = orange}}
			}
		}
	}

	\begin{goban}[3]
		\stone[black] {A1}
		\stone[white, mark = {triangle}] {A2}
	\end{goban}

	\begin{goban}[4]
		\stone[black] {A2}
		\stones[white, mark = {circle}] {B2,A3}
	\end{goban}
\end{codeexample}

The |goban| environments that follow inherit these options, and each one can change them. The options of a |goban| accept, besides those of the board, those of |\pgfgoset|, which hold only for that board: |\begin{goban}[9, stone = {radius = 4pt}, mark = {line = {color = red}}]|.

\label{subsec:prender}Many \emph{keys} turn something on or off: the grid, the background, the coordinates, the border and the fill of the stones, their shadows and their shines, etc. They all follow the same rule:
\begin{itemize}
	\item the \emph{key} alone, or with |true|, turns it on: |shine|, |shine = true|;
	\item with |false| it turns it off: |shine = false|;
	\item giving options does not turn it on: |shine = {angle = 45}| changes the angle, but the shine stays as it was. To turn it on and change it at once, |shine = {true, angle = 45}|.
\end{itemize}
The exceptions are the \emph{keys} whose value is the content itself, such as |partial| (the part of the board) and |sequence| (where the numbering starts).
\subsection{The compute kernel}
\label{subsec:kernel}

\pgfgoname\ separates the computations from the drawing. The computations (reading the coordinates, knowing which part of the board is visible, numbering the moves and keeping the turn, remembering the boards, etc.) are done by a \emph{kernel}. The drawing, the \emph{keys} and the profiles are always the same. There are two kernels:
\begin{itemize}
	\item |lua|: written in Lua. It needs Lua\LaTeX, and it is the default with Lua\LaTeX.
	\item |expl3|: written in L3. It works with any engine, and it is the default with the others.
\end{itemize}

Both produce exactly the same diagrams\footnote{Or so the tests say.}. The Lua kernel also knows three things the other does not: captures (p.~\pageref{subsec:capturas}), finding the territory with |\territory{auto}| (p.~\pageref{subsec:territorio}) and reading games in SGF (p.~\pageref{subsec:sgf}). This manual is compiled with the Lua kernel.

\begin{key}{/pgfgo/package/kernel = \meta{expl3 or lua} (initially lua with Lua\LaTeX, expl3 with the other engines)}
	Package option that chooses the kernel. It is only needed to use |expl3| with Lua\LaTeX. It can only be given when \pgfgoname\ is loaded; it cannot be changed with |\pgfgoset|. If |kernel = lua| is asked for with pdf\LaTeX, the package warns and uses |expl3|. With |expl3|, |captures|, |\territory{auto}| and |\sgf| give an error.

	\begin{codeexample}[code only]
		\usepackage[kernel = expl3]{pgf-go}
	\end{codeexample}
\end{key}

\subsection{Languages}
\label{subsec:idiomas}

Some texts are written by the package itself: the captions of |\sgfdiagrams| and |\sgfproblem|, the result of the game, the annotations of the comments (|/pgfgo/sgf annotations|) and the word of the ``N at M'' notes. They are translated into English (|en|), Spanish (|es|), French (|fr|), German (|de|), Portuguese (|pt|), Italian (|it|), Esperanto (|eo|), Japanese (|ja|), Chinese (|zh|) and Korean (|ko|). Japanese, Chinese and Korean need a font with those characters.

By default, the texts are in the language set by babel or polyglossia, and they follow it if it changes inside the document (|\selectlanguage|, |otherlanguage|). Without babel or polyglossia, or in a language without a translation, they are in English. Each text can be changed with its \emph{key} (for example, |/pgfgo/sgf diagrams/title|); what is set that way holds in any language.

\begin{key}{/pgfgo/lang = \meta{language} (initially auto)}
	Language of the texts: |auto| (that of babel or polyglossia), the code of a language (|fr|) or the name babel or polyglossia give it (|french|). If the language is not known, the package warns and uses English.

	\begin{codeexample}[code only]
		\pgfgoset{lang = fr}
	\end{codeexample}
\end{key}

\begin{key}{/pgfgo/package/lang = \meta{language} (initially auto)}
	The same, as a package option: |\usepackage[lang = fr]{pgf-go}|.
\end{key}

\begin{command}{\pgfgotext\marg{text}}
	Writes one of the texts in the current language. The texts, with their value in English and in Spanish, are:

	\begin{center}
		\small
		\begin{tabular}{lll}
			|tesuji| & Tesuji & Tesuji \\
			|very good tesuji| & Very good tesuji & Muy buen tesuji \\
			|bad move| & Bad move & Mala jugada \\
			|very bad move| & Very bad move & Muy mala jugada \\
			|doubtful| & Doubtful move & Jugada dudosa \\
			|interesting| & Interesting move & Jugada interesante \\
			|good for black| & Good for Black & Bueno para Negras \\
			|very good for black| & Very good for Black & Muy bueno para Negras \\
			|good for white| & Good for White & Bueno para Blancas \\
			|very good for white| & Very good for White & Muy bueno para Blancas \\
			|even| & Even position & Posición pareja \\
			|unclear| & Unclear position & Posición incierta \\
			|diagram| & Diagram & Diagrama \\
			|variation| & Variation & Variante \\
			|black to play| & Black to play & Juegan Negras \\
			|white to play| & White to play & Juegan Blancas \\
			|at| & at & en \\
			|result| & Result & Resultado \\
			|black| & Black & Negras \\
			|white| & White & Blancas \\
			|win| & \meta{winner} wins & Ganan \meta{winner} \\
			|win by points| & \meta{winner} wins by \meta{points} points & Ganan \meta{winner} por \meta{points} puntos \\
			|win by resignation| & \meta{winner} wins by resignation & Ganan \meta{winner} por abandono \\
			|win on time| & \meta{winner} wins on time & Ganan \meta{winner} por tiempo \\
			|win by forfeit| & \meta{winner} wins by forfeit & Ganan \meta{winner} por incomparecencia \\
			|draw| & Draw (jigo) & Empate (jigo) \\
			|void| & No result & Sin resultado \\
			|unknown result| & Unknown result & Resultado desconocido \\
		\end{tabular}
	\end{center}

	\begin{codeexample}[]
		\pgfgotext{black to play}. \pgfgotext{tesuji}.

		\pgfgoset{lang = fr}
		\pgfgotext{black to play}.
	\end{codeexample}
\end{command}

\begin{command}{\pgfgodefinelanguage\marg{language}\marg{texts}}
	Adds a language, or changes texts of one that already exists. The missing texts are taken from English. In the texts of the result, |\pgfgowinner| is the name of the winner and |\pgfgopoints| the difference (p.~\pageref{subsec:sgfdiagramas}).

	\begin{codeexample}[code only]
		\pgfgodefinelanguage{es}{black = Negro, white = Blanco,
			win by points = Gana \pgfgowinner{} por \pgfgopoints{} puntos}
	\end{codeexample}
\end{command}

\begin{command}{\pgfgolanguagealias\marg{name}\marg{language}}
	Another name for a language, for example the one babel or polyglossia give it, if \pgfgoname\ does not know it.

	\begin{codeexample}[code only]
		\pgfgolanguagealias{castellano}{es}
	\end{codeexample}
\end{command}
