iwase/itoniki1 の変更点 - PukiWiki

#calendar2(off)

&br;
gloss-japanese.ldf (version 0.1) for polyglossia - a babel replacement for XeLaTeX
gloss-japanese.ldf (version 0.1) for [[polyglossia - a babel replacement for XeLaTeX>http://www.ctan.org/tex-archive/macros/xetex/latex/polyglossia/polyglossia.pdf]]
&br;

There is a new version [[here>../itoniki]]

 % Original version was written by Toru Inagaki for babel.sty
 % Modified for polyglossia by Norio Iwase with some additional features
 % Version 0.1
 \ProvidesFile{gloss-japanese.ldf}[polyglossia: module for japanese]
 \makeatletter
 \def\japanese@font{%
   \@ifundefined{japanesefont}{%
     \font\zf@basefont="\csname zf@family@fontdef\f@family\endcsname" at \f@size pt}{\japanesefont}}
 
 \def\selectnormalfontjapanese{%
    \let\normalfont=\japanese@font%
    \let\rmfamily=\japanese@font%
    \let\sffamily=\japanese@font%
    \let\ttfamily=\japanese@font%
    \def\reset@font{\normalfont}}
 
 \ifx\l@japanese\@undefined
    \xpg@nopatterns{Japanese}
    \adddialect\l@japanese0
 \fi
 
 \def\japanese@capsformat{%
    \def\@seccntformat##1{\csname pre##1\endcsname%
       \csname the##1\endcsname%
       \csname post##1\endcsname}%
    \def\postsection{\textjapanese{}\space}% 節
    \def\postsubsection{\textjapanese{}\space}% 節
    \def\postsubsubsection{\textjapanese{}\space}% 節
    \def\presection{}% 第
    \def\presubsection{}% 第
    \def\presubsubsection{}}% 第
 
 \@ifclassloaded{book}{%
   \if@twoside
     \def\ps@headings{%
         \let\@oddfoot\@empty\let\@evenfoot\@empty
         \def\@evenhead{\thepage\hfil\slshape\leftmark}%
         \def\@oddhead{{\slshape\rightmark}\hfil\thepage}%
         \let\@mkboth\markboth
       \def\chaptermark##1{%
         \markboth {\MakeUppercase{%
           \ifnum \c@secnumdepth >\m@ne
             \if@mainmatter
               \@chapapp\ \thechapter\postchaptername. \ %
             \fi
           \fi
           ##1}}{}}%
       \def\sectionmark##1{%
         \markright {\MakeUppercase{%
           \ifnum \c@secnumdepth >\z@
             \thesection. \ %
           \fi
           ##1}}}}
   \else
     \def\ps@headings{%
       \let\@oddfoot\@empty
       \def\@oddhead{{\slshape\rightmark}\hfil\thepage}%
       \let\@mkboth\markboth
       \def\chaptermark##1{%
         \markright {\MakeUppercase{%
           \ifnum \c@secnumdepth >\m@ne
             \if@mainmatter
               \@chapapp\ \thechapter\postchaptername. \ %
             \fi
           \fi
           ##1}}}}
   \fi
 }{}
 \def\@chapter[#1]#2{%
   \ifnum \c@secnumdepth >\m@ne%
     \if@mainmatter%
       \refstepcounter{chapter}%
       \typeout{\@chapapp\space\thechapter\postchaptername}%
       \addcontentsline{toc}{chapter}%
         {\protect\numberline{\thechapter}#1}%
     \else%
       \addcontentsline{toc}{chapter}{#1}%
     \fi%
   \else%
     \addcontentsline{toc}{chapter}{#1}%
   \fi%
   \chaptermark{#1}%
   \addtocontents{lof}{\protect\addvspace{10\p@}}%
   \addtocontents{lot}{\protect\addvspace{10\p@}}%
   \if@twocolumn
     \@topnewpage[\@makechapterhead{#2}]%
   \else
     \@makechapterhead{#2}%
     \@afterheading
   \fi}
 \def\@makechapterhead#1{%
   \vspace*{50\p@}%
   {\parindent \z@ \raggedright \normalfont
     \ifnum \c@secnumdepth >\m@ne
       \if@mainmatter
         \huge\bfseries \@chapapp\space\thechapter\postchaptername
         %\hspace{2em}\Huge \bfseries #1
         \par\nobreak
         \vskip 20\p@
       \fi
     \fi
     \interlinepenalty\@M
     \Huge \bfseries #1\par\nobreak
     \vskip 40\p@
   }}
 \def\@part[#1]#2{%
   \ifnum \c@secnumdepth >-2\relax
     \refstepcounter{part}%
     \addcontentsline{toc}{part}{\thepart\postpartname\hspace{1em}#1}%
   \else
     \addcontentsline{toc}{part}{#1}%
   \fi
   \markboth{}{}%
   {\centering
    \interlinepenalty \@M
    \normalfont
    \ifnum \c@secnumdepth >-2\relax
      \huge\bfseries \partname\nobreakspace\thepart\postpartname
      \par
      \vskip 20\p@
    \fi
    \Huge \bfseries #2\par}%
   \@endpart}
 
 \def\captionsjapanese{%
    \def\refname{\textjapanese{出典}}%
    \def\abstractname{\textjapanese{要旨}}%
    \def\bibname{\textjapanese{参考文献}}%
    \def\prefacename{\textjapanese{序文}}%
    \def\postchaptername{\textjapanese{章}}%
    \def\chaptername{\textjapanese{第}}%
    \def\appendixname{\textjapanese{付録}}%
    \def\contentsname{\textjapanese{目次}}%
    \def\listfigurename{\textjapanese{図目次}}%
    \def\listtablename{\textjapanese{表目次}}%
    \def\indexname{\textjapanese{索引}}%
    \def\figurename{\textjapanese{図}}%
    \def\tablename{\textjapanese{表}}%
    %\def\thepart{\textjapanese{}}%
    \def\postpartname{\textjapanese{部}}%
    \def\partname{\textjapanese{第}}%
    \def\pagename{\textjapanese{頁}}%
    \def\seename{\textjapanese{参照}}%
    \def\alsoname{\textjapanese{参照}}%
    \def\enclname{\textjapanese{添付}}%
    \def\ccname{\textjapanese{同報}}%
    \def\headtoname{\textjapanese{宛先}}%
    \def\proofname{\textjapanese{証明}}%
    \def\glossaryname{\textjapanese{用語集}}%
    }
 
    \newif\if@seireki \@seirekitrue%
    \newif\if@wameituki \@wameitukifalse%
    \newif\if@izumo \@izumofalse%
    \XeTeXlinebreaklocale "ja"%
    \XeTeXlinebreakskip = 0pt plus 5pt%
    \XeTeXlinebreakpenalty = 10
 
 \def\datejapanese{%
    {\advance\year-1988\relax \xdef\the@heisei{\the\year}}
    \def\西暦{\@seirekitrue \@wameitukifalse}%
    \def\和暦{\@seirekifalse \@wameitukifalse}%
    \def\和名月{\@wameitukitrue}%
    \def\数字月{\@wameitukifalse}%
    \def\出雲{\@izumotrue}%
    \def\大和{\@izumofalse}%
    \def\today{\textjapanese{%
 \if@seireki \number\year \else 平成\,\the@heisei\fi\,{年}\,\if@wameituki\ifcase\month\or 
   睦月\or 如月\or 弥生\or 卯月\or 皐月\or 水無月\or 文月\or 葉月\or 長月\or \if@izumo 
   神在月\else 神無月\fi \or 霜月\or 師走
   \fi \else \number\month\,{月}\fi\,\number\day\,{日}}}%
    }
 
 \def\japanese@language{\protect\language=\l@japanese}
 
 \setlocalhyphenmins{japanese}{2}{2}%

サンプルを作らねばと思い、やはり稲垣さんの sample.tex を少し改変してしまった:

 %!TEX TS-program = XeLaTeX
 \documentclass{book}
 \usepackage{xunicode}%
 \usepackage[no-math]{fontspec}
 \usepackage{polyglossia}%
 %
 \setdefaultlanguage{japanese}
 \setotherlanguage{english}
 \setotherlanguage{french}
 \setotherlanguage{german}
 %
 \defaultfontfeatures{Mapping=tex-text}
 \setromanfont{Hiragino Mincho Pro W3}%
 \setsansfont{Hiragino Kaku Gothic Pro W3}%
 \setmonofont{Osaka-Mono}
 %
 \makeatletter
 \def\tbcaption{\def\@captype{table}\caption{キャプションの例}}
 \def\fgcaption{\def\@captype{figure}\caption{キャプションの例}}
 \makeatother
 \def\sf{\selectlanguage{french}}
 \def\se{\selectlanguage{english}}%
 \def\sj{\selectlanguage{japanese}}
 \def\sg{\selectlanguage{german}}
 \setlength{\voffset}{-43mm}
 \setlength{\hoffset}{-13mm}
 \setlength{\textwidth}{16cm}
 \setlength{\textheight}{27cm}
 \begin{document}
 
 \sj
 \chapter{PolyGlossia}
 japanese パッケージは日本語による見出し語と日付を出力するためのマクロを定義しています。
 \se
 \section{In ``\texttt{English}''}
 (The value of language code is \the\language) \par\hfil\verb:\today: :\today\hfil
 
 \fgcaption
 \tbcaption
 
 \sf
 %\section{En ``\texttt{fran\c{c}ais}''}
 \section{En ``\texttt{français}''}
 (La valeur de code de langue est \the\language) \par\hfil\verb:\today: :\today\hfil
 
 \fgcaption
 \tbcaption
 
 \sj
 \section{『\texttt{日本語}』で}
 (language コードの値は \the\language) \par\hfil\verb:\today: :\today\hfil
 
 \fgcaption
 \tbcaption
 
 \begin{itemize}
 \item \verb:\和暦: は日付の表示をデフォルトの西暦「\today」から和暦「\和暦\today 」に変更し、
 \verb:\西暦: はこれを元の表示「\西暦\today 」に戻します。
 \par\smallskip\hfil\verb:\和暦\today: :\和暦\today\hfil
 \item \verb:\和名月: は月の表示をデフォルトの表示「\today」から、月の名に和名を採用した暦
 「\和名月\today 」に変更し、\verb:\数字月: はこれを元の表示「\数字月\today 」に戻します。
 \item \verb:\出雲: は神無月を神在月に、また \verb:\大和: はその逆にします。
 \end{itemize}
 
 \sg
 \section{In ``\texttt{Deutsch}''}
 (Der Wert der Sprache Code ist \the\language) \par\hfil\verb:\today: :\today\hfil
 
 \fgcaption
 \tbcaption
 
 \end{document}

トップ   編集 差分 履歴 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS