js*.cls 同様の文字サイズ設定を \mag によらずに行う方法:試案

名前: misc
日時: 2004-04-26 18:04:33
IPアドレス: 210.230.18.*

本質的なことは,\extract@font に追加した 2 行(とその部分の実装)です. # 完全なクラスファイルを用意したわけではなく,文字サイズ設定に # 関係しない部分の大半は省略していることに注意してください. # これは,あくまでも試案です.また,js*.cls 自身に関しては # このような(怪しい)処理を持ち込むまでもないと思います. ## 同種のものが目に付かないようでしたので書いてみましたが, ## どこかの“会員のみ閲覧可”であるような場所ですでに ## 論じられていたとしたら,ご寛恕願います. %%% File: sizetest.cls \ProvidesClass{sizetest}[2004/04/26 v0.1 fragment of a sample class] \NeedsTeXFormat{pLaTeX2e} \DeclareOption{7pt}{\def\@fontsize@magnification{.7}} \DeclareOption{8pt}{\def\@fontsize@magnification{.8}} \DeclareOption{9pt}{\def\@fontsize@magnification{.9}} \DeclareOption{10pt}{\def\@fontsize@magnification{1}} \DeclareOption{11pt}{\def\@fontsize@magnification{1.095}} \DeclareOption{12pt}{\def\@fontsize@magnification{1.2}} \DeclareOption{13pt}{\def\@fontsize@magnification{1.3}} \DeclareOption{14pt}{\def\@fontsize@magnification{1.44}} \DeclareOption{15pt}{\def\@fontsize@magnification{1.5}} \DeclareOption{17pt}{\def\@fontsize@magnification{1.728}} \DeclareOption{20pt}{\def\@fontsize@magnification{2}} \DeclareOption{21pt}{\def\@fontsize@magnification{2.074}} \DeclareOption{24pt}{\def\@fontsize@magnification{2.4}} \DeclareOption{30pt}{\def\@fontsize@magnification{3}} \DeclareOption{36pt}{\def\@fontsize@magnification{3.6}} \DeclareOption{a4paper}{% \paperwidth 210mm\relax \paperheight 297mm\relax} \DeclareOption{b5paper}{% \paperwidth 182mm\relax \paperheight 257mm\relax} \DeclareOption{onecolumn}{\@twocolumnfalse} \DeclareOption{twocolumn}{\@twocolumntrue} \ExecuteOptions{10pt,a4paper,onecolumn} \ProcessOptions\relax \expandafter\let\csname OT1/cmr/m/n/10\endcsname\relax \expandafter\let\csname OMX/cmex/m/n/10\endcsname\relax % %%% modify NFSS \def\extract@font{% \let\f@original@size\f@size \@unmagnify@fontsize %%% \f@size /= \@fontsize@magnification (locally) \get@external@font \@magnify@external@font \global\expandafter\font\font@name\external@font\relax \font@name\relax \csname \f@encoding+\f@family\endcsname \csname\curr@fontshape\endcsname \relax} \def\@unmagnify@fontsize{% \begingroup \@tempdima\f@size\p@ \@tempcnta\@tempdima \@tempdimb\@fontsize@magnification\p@ \@tempcntb\@tempdimb \@unmagnify@fontsize@ \edef\@tempa{\@tempb.}% \@unmagnify@fontsize@ \edef\@tempa{\@tempa\@tempb}% \@unmagnify@fontsize@ \edef\@tempa{\@tempa\@tempb}% \@unmagnify@fontsize@ \edef\@tempa{\@tempa\@tempb}% \@unmagnify@fontsize@ \edef\@tempa{\@tempa\@tempb}% \dimen@\@tempa\p@ \edef\@tempa{\def\noexpand\f@size{\strip@pt\dimen@}}% \expandafter\endgroup\@tempa} \def\@unmagnify@fontsize@{% \count@\@tempcnta \divide\@tempcnta\@tempcntb \edef\@tempb{\the\@tempcnta}% \multiply\@tempcnta\@tempcntb \advance\count@-\@tempcnta \@tempcnta\count@ \multiply\@tempcnta 10\relax} \def\@magnify@external@font{% \begingroup \edef\@tempa{\external@font\space at\space at}% \expandafter\@magnify@external@font@\@tempa\@nil \expandafter\endgroup\@tempa} \def\@magnify@external@font@#1 at#2 at#3\@nil{% \def\@tempa{#1}% \def\@tempb{#2}% \ifx\@tempb\@empty \dimen@\@fontsize@magnification\p@ \ifdim\dimen@>\@m\p@ \multiply\dimen@\tw@ \divide\dimen@131\relax \else \multiply\dimen@\@m \divide\dimen@\p@ \fi \edef\@tempb{ scaled\number\dimen@}% \else \dimen@\@tempb\relax \dimen@\@fontsize@magnification\dimen@ \edef\@tempb{ at\the\dimen@}% \fi \edef\@tempa{\def\noexpand\external@font{\@tempa\@tempb}}} \def\do@subst@correction{% \xdef\subst@correction{% \font@name \global\expandafter\font\csname \curr@fontshape/\f@original@size\endcsname \noexpand\fontname\font \relax}% \aftergroup\subst@correction} % %%% prepare font sizes for \normalsize etc. \toks@{} \def\PrepareTextFontSizes#1#2#3{% \dimen@#3\p@ \dimen@\@fontsize@magnification\dimen@ \expandafter\edef\csname @baselineskip@for@#1\endcsname{\strip@pt\dimen@}% \dimen@#2\p@ \dimen@\@fontsize@magnification\dimen@ \expandafter\edef\csname @size@for@#1\endcsname{\strip@pt\dimen@}% \expandafter\ifx\csname S@#2\endcsname\relax\else \expandafter\expandafter\expandafter \PrepareTextFontSizes@\csname S@#2\endcsname\gdef\gdef\gdef\gdef\@nil \edef\@tempa{% \the\toks@ \def\expandafter\noexpand\csname S@\strip@pt\dimen@\endcsname{% \gdef\noexpand\tf@size{\tf@size}% \gdef\noexpand\sf@size{\sf@size}% \gdef\noexpand\ssf@size{\ssf@size}}}% \toks@\expandafter{\@tempa}% \fi} \def\PrepareTextFontSizes@#1\gdef#2\gdef#3\gdef#4\gdef#5\@nil{% \edef\@tempa{% \edef\expandafter\noexpand\@firstoftwo#2\@empty\@empty{% \@secondoftwo#2\@empty\@empty}% \edef\expandafter\noexpand\@firstoftwo#3\@empty\@empty{% \@secondoftwo#3\@empty\@empty}% \edef\expandafter\noexpand\@firstoftwo#4\@empty\@empty{% \@secondoftwo#4\@empty\@empty}}% \@tempa \@tfor\@tempa:=\tf@size\sf@size\ssf@size\do{% \expandafter\ifx\@tempa\relax \expandafter\let\@tempa\@empty \fi \expandafter\ifx\@tempa\@empty\else \@tempdima\@tempa\p@ \@tempdima\@fontsize@magnification\@tempdima \expandafter\edef\@tempa{\strip@pt\@tempdima}% \fi}} \PrepareTextFontSizes{tiny}\@vpt\@vipt \PrepareTextFontSizes{scriptsize}\@viipt\@viiipt \PrepareTextFontSizes{footnotesize}\@viiipt{9.5} \PrepareTextFontSizes{small}\@ixpt{11} \PrepareTextFontSizes{normalsize}\@xpt{15} \PrepareTextFontSizes{large}\@xiipt{17} \PrepareTextFontSizes{Large}\@xivpt{21} \PrepareTextFontSizes{LARGE}\@xviipt{25} \PrepareTextFontSizes{huge}\@xxpt{28} \PrepareTextFontSizes{Huge}\@xxvpt{33} \the\toks@ \toks@{} \def\@set@xkanjiskip{% \xkanjiskip.25zw \@plus\p@ \@minus \ifdim.125zw<\p@ .125zw \else \p@ \fi \parindent 1zw\relax} \DeclareRobustCommand*\normalsize{% \@setfontsize\normalsize \@size@for@normalsize \@baselineskip@for@normalsize \abovedisplayskip=.5\baselineskip \abovedisplayshortskip\abovedisplayskip \belowdisplayskip=.5\baselineskip \belowdisplayshortskip\belowdisplayskip \@set@xkanjiskip \let\@listi\@listI} \DeclareRobustCommand*\small{% \@setfontsize\small \@size@for@small \@baselineskip@for@small \@set@xkanjiskip} \DeclareRobustCommand*\footnotesize{% \@setfontsize\footnotesize \@size@for@footnotesize \@baselineskip@for@footnotesize \@set@xkanjiskip} \DeclareRobustCommand*\scriptsize{% \@setfontsize\scriptsize \@size@for@scriptsize \@baselineskip@for@scriptsize \@set@xkanjiskip} \DeclareRobustCommand*\tiny{% \@setfontsize\tiny \@size@for@tiny \@baselineskip@for@tiny \@set@xkanjiskip} \DeclareRobustCommand*\large{% \@setfontsize\large \@size@for@large \@baselineskip@for@large \@set@xkanjiskip} \DeclareRobustCommand*\Large{% \@setfontsize\Large \@size@for@Large \@baselineskip@for@Large \@set@xkanjiskip} \DeclareRobustCommand*\LARGE{% \@setfontsize\LARGE \@size@for@LARGE \@baselineskip@for@LARGE \@set@xkanjiskip} \DeclareRobustCommand*\huge{% \@setfontsize\huge \@size@for@huge \@baselineskip@for@huge \@set@xkanjiskip} \DeclareRobustCommand*\Huge{% \@setfontsize\Huge \@size@for@Huge \@baselineskip@for@Huge \@set@xkanjiskip} \normalsize \setbox0\hbox{\char\euc"A1A1}% \setlength\Cht{\ht0} \setlength\Cdp{\dp0} \setlength\Cwd{\wd0} \setlength\Cvs{\baselineskip} \setlength\Chs{\wd0} % %%% set \textwidth etc. \@tempdima\paperwidth \advance\@tempdima-40mm \divide\@tempdima\dimen@ \count@\@tempdima \edef\@tempa{\if@twocolumn 62\else 40\fi} \ifnum \@tempa<\count@ \count@\@tempa\relax \fi \if@twocolumn\ifodd\count@ \advance\count@\m@ne \fi\fi \textwidth\count@\dimen@ \dimen@\paperwidth \advance\dimen@-\textwidth \divide\dimen@\tw@ \oddsidemargin\dimen@ \evensidemargin\dimen@ \marginparwidth.85\oddsidemargin \advance\oddsidemargin -1in \advance\evensidemargin -1in \dimen@\Cvs \@tempdima\paperheight \advance\@tempdima -60mm \divide\@tempdima\dimen@ \count@\@tempdima \ifnum36<\count@ \count@36\relax \fi \advance\count@\m@ne \dimen@\count@\dimen@ \advance\dimen@\topskip \textheight\dimen@ \dimen@\paperheight \advance\dimen@-\textheight \divide\dimen@\tw@ \advance\dimen@-\headheight \advance\dimen@-\headsep \advance\dimen@-1in \topmargin\dimen@ \parindent \Cwd \dimen@\@baselineskip@for@footnotesize\p@ \dimen@.7\dimen@ \footnotesep\dimen@ \skip\footins \Cvs %%% other miscellaneous stuff is omitted here... \endinput

この書き込みへの返事:

お名前
題名 
メッセージ(タグは <a href="...">...</a> だけ使えます)