質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
TeX

フリーの組版システムで、字や図版などの要素を紙面に配置するという作業をコンピュータで行います

Q&A

1回答

3564閲覧

texのtablecontents(目次)のカスタマイズ方法

Dniwre

総合スコア4

TeX

フリーの組版システムで、字や図版などの要素を紙面に配置するという作業をコンピュータで行います

0グッド

0クリップ

投稿2020/02/17 02:20

前提・実現したいこと

WSLに導入したubuntu18.04にてtexlive-lang-japaneseを導入しています。
そこで以下のような形式の出力を行いたいのですが, 解決できませんでした。

出力したい内容

報告書(1報)

  1. はじめに..............2
  2. 結果報告.............3

上記のように
1行目を本文同じサイズで出力し、
"目次"と表示せず、目次の内容についてを続けて表示したいです。
また、pdfにしたときにtableofcontentsで出力した時と同様にリンクが張られている状態にしたいと考えています。

該当のソースコード

texをplatexにてコンパイルしています。

\documentclass{jsreport} \begin{document} 報告書(1報) \tableofcontents % 目次 \chapter{はじめに} \chapter{結果報告} \chapter{考察} \end{document}

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

unoSSkR

2020/02/21 09:52

The most common way is to redefine the tableofcontents command. See tex/latex/section/section.sty, section.dtx or section-doc.tex, which you can get from CTAN, to learn more about the command definition.
Dniwre

2020/02/26 03:15

I tried changing that file and failed. This command was a bit too esoteric for me. \newcommand{\tableofcontents}{ \settowidth\jsc@tocl@width{\headfont\prechaptername\postchaptername} \settowidth\@tempdima{\headfont\appendixname} \ifdim\jsc@tocl@width<\@tempdima \setlength\jsc@tocl@width{\@tempdima}\fi \ifdim\jsc@tocl@width<2zw \divide\jsc@tocl@width by 2 \advance\jsc@tocl@width 1zw\fi \if@twocolumn \@restonecoltrue\onecolumn \else \@restonecolfalse \fi \chapter*{\contentsname} \@mkboth{\contentsname}{} \@starttoc{toc} \if@restonecol\twocolumn\fi }
unoSSkR

2020/02/29 07:58 編集

Was it so then?
Dniwre

2020/03/04 06:30

\newcommand{\tableofcontents}{% \settowidth\jsc@tocl@width{\headfont\prechaptername\postchaptername}% \settowidth\@tempdima{\headfont\appendixname}% \ifdim\jsc@tocl@width<\@tempdima \setlength\jsc@tocl@width{\@tempdima}\fi \ifdim\jsc@tocl@width<2zw \divide\jsc@tocl@width by 2 \advance\jsc@tocl@width 1zw\fi \if@twocolumn \@restonecoltrue\onecolumn \else \@restonecolfalse \fi % \chapter*{\contentsname}% \contentsname \@mkboth{\contentsname}{}% \@starttoc{toc}% \if@restonecol\twocolumn\fi } If you make this change, you will get the following error: ./test.toc:1: LaTeX Error: Something's wrong--perhaps a missing \item. Before this change, compilation is possible.
guest

回答1

0

Here is an answer you may meet your demand, but is for one specified TeXLive version. HTH

mytoc.sty:

latex

1\renewcommand*{\l@section}{\@dottedtocline{1}{0pt}{4em}} 2% Change \contentsname's font to \normalsize 3\renewcommand\tableofcontents{% 4 \section*{{\normalsize\contentsname} 5 \@mkboth{% 6 \MakeUppercase\contentsname}{\MakeUppercase\contentsname}}% 7 \@starttoc{toc}% 8}

main.tex:

latex

1\documentclass{article} 2\usepackage[dvipdfmx]{hyperref} 3\usepackage{mytoc} 4\begin{document} 5 6\renewcommand{\contentsname}{Report No.1} 7\tableofcontents 8 9\clearpage 10\section{section no.1} 11 12\clearpage 13\section{section no.2} 14 15\clearpage 16\section{section no.3} 17 18\end{document}

投稿2020/03/08 09:43

編集2020/03/08 09:47
unoSSkR

総合スコア15

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだベストアンサーが選ばれていません

会員登録して回答してみよう

アカウントをお持ちの方は

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問