Re: endfloat.styを使っている場合に\appendixの章で図表番号を変更しようとするとすべての図番号が変更されます、どうしたらよいでしょうか?

名前: misc
日時: 2004-01-27 00:47:17
IPアドレス: 211.4.123.*

>>25225 # endfloat パッケージを使用すると,個々の figure 環境・table 環境の # 中身を外部ファイルにいったん出力して,その外部ファイルを # \end{document} の際に読み込みます. # そのため,\thefigure あるいは \thetable を素朴に再定義すると, # 文書の末尾における図表の番号の形式がすべての図表に用いられる, # ということになります. # # これを回避するには,個々の図表の処理の際に \caption が # 用いられているかどうかを検査し,用いられているときには # 図表の番号の設定処理を endfloat パッケージの処理に伴い作成される # 外部ファイルの方に書き込むようにすればよいわけです. # # 具体的には,次のようになるでしょう. # (ついでに,25063 で行った補正も取り込みました.) \documentclass{article} \usepackage{endfloat} \makeatletter \def\appendix{% \par \setcounter{section}{0}% \setcounter{subsection}{0}% \gdef\thesection{\@Alph\c@section}% % ここまでは,ファイル article.cls における \appendix の定義のコピー % 以下の 4 行を \appendix の定義の外部に書くと, % \appendix 以前にある図表の番号まで変更され(ることがあり)ます. \@addtoreset{figure}{section}% \def\thefigure{\thesection.\@arabic\c@figure}% \@addtoreset{table}{section}% \def\thetable{\thesection.\@arabic\c@table}} % 言うまでもなく,上記の \appendix の再定義は endfloat パッケージの % 挙動の変更とは無関係です. % \def\thepostfig{\ref{efloat@F@\the\c@postfig}} \def\theposttbl{\ref{efloat@T@\the\c@posttbl}} \def\figure{% \efloat@init@floatenv{fff}{figure*}{postfig}\figureplace {efloat@F@\the\c@postfig}{figure}} \def\table{% \efloat@init@floatenv{ttt}{table*}{posttbl}\tableplace {efloat@T@\the\c@posttbl}{table}} % #1: 外部ファイルで用いる拡張子 % #2: 外部ファイルにおける図版の記述に用いる環境名 % #3: 図表の識別番号用のカウンタの名称 % #4: 図表の位置のメモ(“[Figure 1 about here]”の類)の出力用マクロ % #5: 図表の位置のメモのために図表の番号を参照するのに用いるラベル % #6: 図表の番号に用いられているカウンタの名称 \def\efloat@init@floatenv#1#2#3#4#5#6{% \edef\efloat@envname{\@currenvir}% \def\efloat@externalenvname{#2}% \def\efloat@curr@cnt{#6}% \efloat@condopen{#1}% \efloat@iwrite{#1}{\string\begin{#2}}% \if@domarkers% \addtocounter{#3}{1}% % bj #4% % bj \xdef\@curr@efloatid{#5}% \fi% \def\@currenvir{efloat@float}% \begingroup% \let\do\ef@makeinnocent \dospecials% \ef@makeinnocent\^^L% and whatever other special cases \endlinechar`\^^M \catcode`\^^M=12 \def\efloat@ext{#1}% \efloat@setup \ef@xfloat} \begingroup \catcode`\^^M=12\relax% \gdef\ef@xfloat#1^^M{% \edef\@tempa{#1\ef@xfloat@to@be@detected}% \expandafter\ef@xfloat@linecheck\@tempa\@nil% \ifx\@tempa\@empty% \let\efloat@currline\@empty% \edef\@tempa{#1\expandafter\@gobble\string\\caption}% \expandafter\efloat@process@caption\@tempa\@nil% \efloat@iwrite\efloat@ext{\efloat@currline}% \let\next\ef@xfloat% \else% \edef\@tempa{\noexpand\efloat@foundend% {\efloat@ext}{\efloat@externalenvname}}% \@tempa% \fi% \next}% \endgroup% \begingroup \catcode`\{=12 \catcode`\[=1 \catcode`\}=12 \catcode`\]=2 \catcode`\|=0 \catcode`\\=12 |gdef|efloat@setup[% |edef|ef@xfloat@to@be@detected[\end{|efloat@envname}]% |def|@tempa[|def|ef@xfloat@linecheck####1]% |expandafter|@tempa|ef@xfloat@to@be@detected##2|@nil[|def|@tempa[##2]]] |gdef|efloat@process@caption#1\caption#2|@nil[% |edef|efloat@currline[|efloat@currline#1]% |def|@tempa[#2]% |ifx|@tempa|@empty |let|@tempa|@empty |else |stepcounter[|efloat@curr@cnt]% |protected@edef|@tempa[|csname the|efloat@curr@cnt|endcsname]% |@onelevel@sanitize|@tempa |edef|efloat@currline[% |efloat@currline \def\the|efloat@curr@cnt{|@tempa}\relax \caption]% |def|@tempa[|efloat@process@caption#2|@nil]% |fi |@tempa] |endgroup \def\efloat@foundend#1#2{% \def\next{% \endgroup \end{efloat@float}% \efloat@iwrite{#1}{\string\label{\@curr@efloatid}}% \efloat@iwrite{#1}{\string\end{#2}}% \efloat@iwrite{#1}{\string\efloatseparator}% \efloat@iwrite{#1}{ }}}% \makeatother \begin{document} \section{samples-1} zzz \begin{figure} \caption{sample figure} \end{figure} \begin{table} \caption{sample table} \end{table} \section{samples-2} zzz \begin{figure} \caption{sample figure} \end{figure} \begin{table} \caption{sample table} \end{table} \appendix \section{samples-A1} zzz \begin{figure} \caption{sample figure} \end{figure} \begin{table} \caption{sample table} \end{table} \section{samples-A2} zzz \begin{figure} \caption{sample figure} \end{figure} \begin{table} \caption{sample table} \end{table} \end{document} # 余談ですが… # 文書クラス article には“章”(\chapter)は存在しません. # したがって,“\appendix の章で”と書いても何を指すのか判然としません. # ここでは “\appendix 以降の \section に属する図表に対して”のような具合に, # 文書中で使用したコマンドを用いて記述した方が,誤解を招きにくいでしょう. # (個々のコマンドを“標準的な意味合い”で用いている場合には # この限りではありませんが…)

この書き込みへの返事:

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