Skip to content

Instantly share code, notes, and snippets.

@zr-tex8r
Created March 17, 2012 07:00
Show Gist options
  • Save zr-tex8r/2055915 to your computer and use it in GitHub Desktop.
Save zr-tex8r/2055915 to your computer and use it in GitHub Desktop.
Treatment of space characters in TeX
% 文字コードはUTF-8
% 全角の〈S〉を空白、〈T〉をタブに置換してから
% (pdf)latex で組版してください
\documentclass[a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\begin{document}
\begingroup
% 空白・タブ・改行を通常文字にする
\catcode32=12\relax% 空白
\catcode9=12\relax% タブ
\catcode13=12\relax% 改行
SP=[S];HT=[T];CR=[
]\par% コメントにすると改行は無力化される
STSATSTBSSTT
\par%
SSTATSSBTTSS
\par%
SSSASSS
\par%
TTTATTT
\par%
SSSSS
\par%
TTTTT
\par%
\endgroup\relax
\end{document}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment