Skip to content

Instantly share code, notes, and snippets.

@wtsnjp
Created June 9, 2020 01:05
Show Gist options
  • Save wtsnjp/dcf7713427a4ddf11dfc52bed984cb97 to your computer and use it in GitHub Desktop.
Save wtsnjp/dcf7713427a4ddf11dfc52bed984cb97 to your computer and use it in GitHub Desktop.
%#!platex
\documentclass[a4paper,dvipdfmx]{jsarticle}
\usepackage{bxjalipsum}
% 目次を開始したいページ数を設定
\def\tocStartPage{2}
% TeX 言語ハック
\makeatletter
\let\@ori@contentsline\contentsline
\renewcommand{\contentsline}[3]{%
\ifnum#3>\numexpr\tocStartPage -1\relax
\@ori@contentsline{#1}{#2}{#3}%
\fi}
\makeatother
% hyperref を使う場合は上記をコメントアウトし,以下を使う
%\usepackage{hyperref}
%\makeatletter
%\let\@ori@contentsline\contentsline
%\renewcommand{\contentsline}[4]{%
% \ifnum#3>\numexpr\tocStartPage -1\relax
% \@ori@contentsline{#1}{#2}{#3}{#4}%
% \fi}
%\makeatother
\begin{document}
\tableofcontents
\section{ほげ}
\jalipsum[1-5]{wagahai}
\section{ふが}
\jalipsum[6-10]{wagahai}
\section{ぴよ}
\jalipsum[11-15]{wagahai}
\end{document}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment