Created
April 29, 2012 11:26
-
-
Save zr-tex8r/2549595 to your computer and use it in GitHub Desktop.
日付を「昭和」にするパッケージ
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% pxshowa.sty | |
\NeedsTeXFormat{LaTeX2e} | |
\ProvidesPackage{pxshowa} | |
\def\昭和{\Showa} | |
\def\Showa{% | |
\pxsw@check@wareki | |
\ifx\pxsw@wareki\relax \pxsw@error@nonavail | |
\else \pxsw@showa@a | |
\fi} | |
\def\pxsw@showa@a{% | |
\begingroup | |
\pxsw@wareki | |
\protected@xdef\pxsw@gtempb{\today}% | |
\@tempcnta\year \advance\@tempcnta-1988 | |
\@tempcntb\year \advance\@tempcntb-1925 | |
\xdef\pxsw@gtempa{{\the\@tempcnta}{\the\@tempcntb}}% | |
\endgroup | |
\pxsw@unbrace\pxsw@today\pxsw@gtempb | |
\expandafter\pxsw@showa@b\pxsw@gtempa} | |
\def\pxsw@unbrace#1#2{% | |
\expandafter\pxsw@unbrace@a#2\pxsw@nil#1} | |
\def\pxsw@unbrace@a#1\pxsw@nil#2{\def#2{#1}} | |
\def\pxsw@showa@b#1#2{% | |
\def\pxsw@showa@c ##1平成##2#1##3\pxsw@nil{% | |
\pxsw@showa@d{##1}{##2}{##3}{#2}}% | |
\expandafter\pxsw@showa@c \pxsw@today\pxsw@mark 平成#1\pxsw@nil} | |
\def\pxsw@showa@d#1#2#3#4{% | |
\ifx\pxsw@empty#1\pxsw@empty | |
\pxsw@showa@e 昭和#2#4#3\pxsw@nil | |
\else \pxsw@nonavail | |
\fi} | |
\def\pxsw@showa@e#1\pxsw@mark#2\pxsw@nil{% | |
\def\today{{#1}}} | |
\def\pxsw@check@wareki{% | |
\begingroup | |
\global\let\pxsw@wareki\relax | |
\pxsw@check@wareki@a{Wareki}% | |
\pxsw@check@wareki@a{和暦}% | |
\pxsw@check@wareki@a{西暦false}% | |
\endgroup} | |
\def\pxsw@check@wareki@a#1{% | |
\expandafter\ifx\csname#1\endcsname\relax\else | |
\global\expandafter\let\expandafter\pxsw@wareki | |
\csname#1\endcsname | |
\fi} | |
\def\Heisei{% | |
\let\today\pxsw@org@today} | |
\def\平成{\Heisei} | |
\def\pxsw@empty{\pxsw@empty@} | |
\let\pxsw@org@today\today | |
\def\pxsw@error@nonavail{% | |
\PackageError{pxshowa}% | |
{Not available in this document class}\@ehc} | |
%% EOF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\documentclass{jsarticle} | |
\usepackage{pxshowa} | |
\昭和 | |
\begin{document} | |
\title{Knuthの原版の{\TeX}を使う件について} | |
\author{匿 名} | |
\maketitle | |
\begin{abstract}Web2Cじゃないやつ。\end{abstract} | |
本文を書く気が全くないという不可避な事情のため | |
後は省略することを了承されたい。 | |
\end{document} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment