Gkd
build confidence with LaTeX. appreciations to @iExploder as we together figure out a valid and much better way to call python in LaTex.
Install / Use
/learn @thautwarm/GkdREADME
gkd(搞快点)
alpha version, do not use.
A set of tools to help programming in LaTeX.
pip install wisepy2 gkd, and append contents of gkd.tex to your TeX sources.
1. GKDBNF: The best LaTeX BNF package you've ever seen?
This relies on paperbnf.
Usage
\begin{GKDBNF}{some_unique_id}
!Expressions! <e> ::= <e> ( <e> )
| let <n> = <e> in <e>
| !$\lambda$! <n> . <e>
| <\mathtt{atom}>
\end{GKDBNF}
Remember to place a blank line in the end of GKDBNF block.
How to write this BNF?
Follow the syntax and lexer rules:
Valid BNF Syntax:
<atom> ::= NONTERMINAL
| TERMINAL
| TERMINAL2
| '|'
<prod> ::= NONTERMINAL '::=' <atom>+ NEWLINE
| TERMINAL NONTERMINAL '::=' <atom>+ NEWLINE
| TERMINAL2 NONTERMINAL '::=' <atom>+ NEWLINE
| '|' <atom>+ <NEWLINE>
Lexer rule by regex:
NEWLINE = [\r\n]+
NONTERMINAL = <.*?>
TERMINAL2 = !.*?!
TERMINAL = \S+
Whitespace tokens are ignored.
2. Utilities
\GKDSet{a}{1}
\GKDGet{a} % get you "1"
\GKDPush{xs}{1}
\GKDPush{xs}{2}
\GKDPop{xs}
\GKDPop{xs} % get you "1"
\newcommand{\addone}[1]{
\GKDPyCall{"lambda x: eval(x) + 1"}{#1}
}
\addone{2} % 3
\addone{2.0} % 3.0
Related Skills
node-connect
352.0kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
111.1kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
352.0kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
352.0kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
