Skip to content

Instantly share code, notes, and snippets.

View wtsnjp's full-sized avatar

Takuto Asakura wtsnjp

View GitHub Profile
##
## A Snowman for everyone!
##
$the_cow = <<EOC;
$thoughts
$thoughts _[_]_
(")
>-( : )-<
(__:__)
EOC
% plain TeX
\catcode`@=11
\def\x@cmd(#1){\edef\x@tmp{#1}\ifx\x@tmp\empty
o\expandafter\x@cmd\else\x@fin #1\fi}\def\x@fin'#1'{#1}
\catcode`g=13\chardef\x@s=`g\defg{\char\x@s\x@cmd}
\catcode`@=12
% tests
\noindent
g('al')\break
\documentclass{article}
\usepackage{expl3}
\ExplSyntaxOn
% \my_ack:nn { <m> } { <n> }
\cs_new:Npn \my_ack:nn #1#2
{
\int_compare:nNnTF { #1 } = { \c_zero_int }
{ % m = 0
\int_eval:n { #2 + 1 }
\documentclass{article}
\newcommand{\inlineTag}{%
\refstepcounter{equation}%
\bgroup\normalfont\normalcolor (\theequation)\egroup}
\begin{document}
This is a sample inline math: $x\;\inlineTag\label{math:x}$.
Look at Equation (\ref{math:x})!
% plain TeX
\catcode`@=11
\def\EvenOrOdd#1{\x@even@or@odd\empty #1\@nil}
\def\x@even@or@odd#1#2{%
\ifx#2\@nil
\x@hop@else\x@@even@or@odd #11\relax
\else
\x@hop@fi\x@even@or@odd{#1-}%
\fi}
\def\x@@even@or@odd#1\relax{\ifnum#1>\z@\expandafter E\else\expandafter O\fi}
%#!lualatex
\documentclass{article}
\usepackage{expl3}
\begin{document}
\ExplSyntaxOn
\cs_generate_variant:Nn \seq_set_split:Nnn { Nnx }
\cs_new:Npn \my_test:n #1 {
\int_eval:n { #1 * 3 } |
}
@wtsnjp
wtsnjp / _texdoc
Last active February 3, 2023 16:38
A zsh completion for Texdoc
#compdef texdoc
#
# This is file '_texdoc' a zsh completion script for texdoc.
#
# Copyright (c) 2018 Takuto ASAKURA (wtsnjp)
# GitHub: https://github.com/wtsnjp
# Twitter: @wtsnjp
#
# This script is distributed under the MIT License.
@wtsnjp
wtsnjp / ltxpkg-install.zsh
Last active June 18, 2018 12:03
Installing LaTeX packages to your local TEXMF tree (TEXMFHOME)
#
# This is file 'ltxpkg-install.zsh'.
#
# Copyright (c) 2018 Takuto ASAKURA (wtsnjp)
# GitHub: https://github.com/wtsnjp
# Twitter: @wtsnjp
#
# This package is distributed under the MIT License.
#
\documentclass{article}
\usepackage{textcomp}
\makeatletter
\let\orgtexttt\texttt
\edef\x@store{\the\catcode`\'}
\catcode`\'=\active
\def\texttt{%
\bgroup
\catcode`\'=\active
%#!lualatex
\documentclass[12pt]{beamer}
\usepackage{arev}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
% hack
\IfFileExists{self.pdf}{%
\directlua{os.rename("self.pdf", "self2.pdf")}