Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

前付・後付の図表採番 #36

Closed
kmuto opened this issue Oct 10, 2018 · 7 comments
Closed

前付・後付の図表採番 #36

kmuto opened this issue Oct 10, 2018 · 7 comments

Comments

@kmuto
Copy link
Contributor

kmuto commented Oct 10, 2018

frontmatter・backmatterの範囲で図表採番を使うと、内部管理の章番号がそのまま出てしまいます。
何が「正しい」のかは議論の余地があるとは思いますが、番号を表示しないchapter(つまりfrontmatterやbackmatter)の場合は、「表<章>.<番号>」ではなく「表<番号>」(図も同様)とするのが無難に思います。

\documentclass[book]{jlreq}

\begin{document}
\frontmatter

\chapter{pre1}
\begin{table}
\caption{Table in Pre1}% 期待は表1、実際は表1.1
\end{table}

\chapter{pre2}
\begin{table}
\caption{Table in Pre2}% 期待は表1、実際は表2.1
\end{table}

\mainmatter
\chapter{ch1}
\begin{table}
\caption{Table in Ch1}% 期待・実際ともに表1.1
\end{table}

\chapter{ch2}
\begin{table}
\caption{Table in Ch2}% 期待・実際ともに表2.1
\end{table}

\appendix
\chapter{app1}
\begin{table}
\caption{Table in App1}% 期待・実際ともに表A.1
\end{table}

\chapter{app2}
\begin{table}
\caption{Table in App2}% 期待・実際ともに表B.1
\end{table}

\backmatter
\chapter{post1}
\begin{table}
\caption{Table in Post1}% 期待は表1、実際は表A.1
\end{table}

\chapter{post2}
\begin{table}
\caption{Table in Post2}% 期待は表1、実際は表B.1
\end{table}
\end{document}
@abenori
Copy link
Owner

abenori commented Oct 10, 2018

ありがとうございます.仰るとおりかと思います.ノンブルの方も含めて\fontmatterなどの処理が定式化できていない感じかと思うので,ちょっと整理してみます.

@abenori
Copy link
Owner

abenori commented Oct 28, 2018

一つの答えとして, 3b255e5 まででやってみました.少し中身を書いてみたいと思いますが,自然な機構に乗せていられるか微妙です.

とりあえずデフォルトの設定では「表1」みたいに出ると思います.表1が何度も出るのが気持ち悪いので前付き内の\chapterではカウンタがリセットされないようになっています.(どちらが普通なんでしょうか?)

前付き内では\thetable\arabic{table}に変更しています.これにより章番号の表示が抑制されます.

\Declare(Tobira|Heading|Runin)Headingcounter=[true/false]という設定を追加しました.counter=falseとすると「採番無し」の見出しを生成します.これを\frontmatter内のみ適用することにしました.これにより前付内の\chapterは番号がつかず,またchapterカウンタの増加も行われません.従って(chapterカウンタの増加に伴う)tableカウンタのリセットも行われません.

最初の通り「表1」が何度も出てくるようにするには,\chapterlabel_format={},after_label_space=0ptを適用すればよいです.これにより見た目上採番は消えますが,内部カウンタは通常通りに動くので,\chapterごとにtableカウンタがリセットされます.

これらの設定を支援する項目を\jlreqsetupに追加しました.

  • frontmatter_counter = {<カウンタ名>={value = <値>, the =<コード>, restore = [true/false]},...}\fontmatterにおけるカウンタの操作です.<カウンタ名>の中身の値をvalueに,\the<カウンタ名>の中身をtheにします.例えばtable={value = 0, the = {\arabic{table}}}とすると\frontmatter\setcounter{table}{0} \renewcommand{\thetable}{\arabic{table}}を実行します.restore=trueが指定されている場合は,\mainmatterで値と\the<カウンタ名>の中身が戻ります.

  • frontmatter_modifyheading = {<見出し命令名>={<見出し命令設定>,restore = [true/fallse]},...}\fontmatter\ModifyHeading{<見出し命令名>}{<見出し命令設定>}を実行します.restore = trueが指定されていれば,\mainmatterで見出し命令を復帰します.

  • 同様にmainmatter_counterとかbackmatter_modifyheadingとかもあります.ただしrestoreは使えません.

@kmuto
Copy link
Contributor Author

kmuto commented Oct 29, 2018

ありがとうございます。

  • frontmatter_counterのrestoreはtrueデフォルトのほうがいいのかなと思いました(restoreなしのfrontmatter_counterを定義したとたんに1章からが表1になってしまうのはちょっと驚きそう)。
  • backmatterのほうは何もjlreqsetupしない状態でもchapter登場ごとにカウンタリセットされるようになりました。frontmatterをこの挙動に寄せるか、はたまたbackmatterのほうを連番に寄せるか…。自分の作業範囲だと、章番号有無にかかわらずchapterで切ったらカウンタをリセットする(表1が何度も出る)のほうが自然な挙動です。

@abenori
Copy link
Owner

abenori commented Oct 29, 2018

backmatterのほうは何もjlreqsetupしない状態でもchapter登場ごとにカウンタリセットされるようになりました。

あれ,そもそもtableカウンタが増加していない気がしますね.おかしいな.

@abenori
Copy link
Owner

abenori commented Oct 29, 2018

81e5c5c で直しました.

@abenori
Copy link
Owner

abenori commented Oct 31, 2018

8ff33e5restore=trueをデフォルトにしました.少しバグを直しています.

前付でのchapterのところで,tableがリセットしないという挙動ですが,どのくらい不自然でしょう.現実としてそういうのもあり得るならば,jbookにあわせてリセットしないようにしておこうかと思います.(jbookの後付の採番はおかしいので,それにあわせてよいのかというのはちと疑問ですが…….)
有効にしたければ上記のように,ということで.

この方式を採用するかはもう少し悩みます.

@abenori
Copy link
Owner

abenori commented Nov 2, 2018

frontmatter_modifyheadingfrontmatter_headingに改名し,heading_typeheading_levelを追加しました.heading_type=Blockとすると\RenewBlockHeadingによる処理になります.heading_levelでレベルを設定できますが,設定しない場合は\fontmatter時でのもとのレベルが適用されます.

@abenori abenori closed this as completed Dec 10, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants