使用 imakeidx 的索引不会分页

使用 imakeidx 的索引不会分页

我正在尝试写一个相当长的索引。但它不会在页面末尾分开……它会穿过页边距甚至更远。

有谁知道如何做到这一点 ?

这是我的代码和结果:

在此处输入图片描述

\documentclass[12pt,twoside]{book}
\usepackage[paperheight=240mm,paperwidth=160mm, left=22mm, right = 20mm, top = 20mm, bottom = 22mm]{geometry}

\usepackage[cam,width=17.5truecm,height=25.54truecm,center,dvips,noinfo]{crop}
\usepackage[french]{babel}

\usepackage{fontspec}
\usepackage{xltabular}
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage{lipsum}
\usepackage[newparttoc]{titlesec}%
\usepackage{titletoc}
\usepackage{supertabular}
\usepackage{xcolor}
\definecolor{gray}{HTML}{BCBDC0}
\definecolor{white}{HTML}{FFFFFF}
\usetikzlibrary{positioning,shapes.misc}
\usepackage{emptypage}



\newcounter{subpara}
\setcounter{subpara}{0}
\newcommand\numsubpara[1]{\vspace{0.5cm}\par\refstepcounter{subpara} \fontsize{10}{12}\selectfont \thesubpara. \fontsize{12}{12}\selectfont \space#1\space\vspace{0.3cm}\\  \fontsize{12}{12}\selectfont}


\usepackage{multicol}
\setlength{\columnsep}{0.6cm}


\usepackage{imakeidx}
\indexsetup{othercode=\footnotesize}

\renewcommand*{\seename}{V.}
\renewcommand*{\alsoname}{V. aussi}

\makeatletter
\renewcommand\@idxitem{\par}
\renewcommand\subitem{}
\newcommand{\maybeadddot}{\@ifnextchar.{}{.}}
\newcommand{\Index}[1]{\imki@wrindexentry{MyIndex}{#1}{\thesubpara}}
\renewcommand{\indexname}{}
\makeatother

\makeindex[name=MyIndex, options= -s alphab.ist]%

\indexsetup{
  %level=\chapter,% <-- already default
  othercode={%
    \thispagestyle{alphab-title}%
    \small\raggedright}
}


\begin{document}

\numsubpara{title6}
\Index{É}
\Index{e23@é23}

\Index{B}
\Index{B1}
\Index{B2}
\Index{B3}
\Index{B4}
\Index{B5}
\Index{B6}
\Index{B7}
\Index{B8}
\Index{B9}
\Index{C1}\Index{C2}\Index{C3}\Index{C4}\Index{C5}
\Index{D1}\Index{D2}\Index{D3}\Index{C4}\Index{D5}
\Index{E1}\Index{E2}\Index{E3}\Index{E4}\Index{E5}
\Index{F1}\Index{F2}\Index{F3}\Index{F4}\Index{F5}
\Index{G1}\Index{G2}\Index{G3}\Index{G4}\Index{G5}
\Index{H1}\Index{H2}\Index{H3}\Index{H4}\Index{H5}
\Index{I1}\Index{I2}\Index{I3}\Index{I4}\Index{I5}
\Index{J1}\Index{J2}\Index{J3}\Index{J4}\Index{J5}
\Index{K1}\Index{K2}\Index{K3}\Index{K4}\Index{K5}
\Index{L1}\Index{L2}\Index{L3}\Index{L4}\Index{L5}

\newpage
\setlength{\columnsep}{-9.6cm}
\begin{multicols}{2}
\printindex[MyIndex]
\end{multicols}
\setlength{\columnsep}{0.6cm}

\end{document}

编辑:我的代码显示了不需要的新页面

\cleardoublepage
\newpage

\addtocontents{toc}{\fontsize{12.5}{12}\selectfont Table alphabétique \enspace\hfill \fontsize{8}{12}\selectfont \mdseries\thepage\vspace{0.2cm} \\}


\parbox{\linewidth}{\fontsize{18}{12}\selectfont \centerline{TABLE ALPHABÉTIQUE}~\\[-0.5cm]\centerline{\fontsize{7}{12}\selectfont \itshape{Les chiffres renvoient aux num\'eros de paragraphe}}}
\vspace{-3.5cm}

\printindex[MyIndex]



\cleardoublepage
\newpage

答案1

我不确定你为什么要multicols这么做\printindex

更改代码

\newpage
\setlength{\columnsep}{-9.6cm}
\begin{multicols}{2}
\printindex[MyIndex]
\end{multicols}
\setlength{\columnsep}{0.6cm}

进入

\printindex[MyIndex]

你会没事的。

在此处输入图片描述

为了设置索引的标题,您不想手动进行:

\documentclass[12pt,twoside]{book}
\usepackage[
  paperheight=240mm,
  paperwidth=160mm,
  left=22mm,
  right = 20mm,
  top = 20mm,
  bottom = 22mm,
]{geometry}

\usepackage[cam,width=17.5truecm,height=25.54truecm,center,dvips,noinfo]{crop}
\usepackage[french]{babel}

\usepackage{fontspec}
\usepackage{xltabular}
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage{lipsum}
\usepackage[newparttoc]{titlesec}
\usepackage{titletoc}
\usepackage{supertabular}
\usepackage{xcolor}
\usepackage{multicol}
\usepackage{emptypage}
\usepackage{imakeidx}

\definecolor{gray}{HTML}{BCBDC0}
\definecolor{white}{HTML}{FFFFFF}
\usetikzlibrary{positioning,shapes.misc}

\newcounter{subpara}
\setcounter{subpara}{0}
\newcommand\numsubpara[1]{%
  \par\addvspace{0.5cm}
  \refstepcounter{subpara}%
  {\small\thesubpara.}#1\par
  \addvspace{0.3cm}%
}

\setlength{\columnsep}{0.6cm}


\renewcommand*{\seename}{V.}
\renewcommand*{\alsoname}{V. aussi}

\makeatletter
\renewcommand\@idxitem{\par}
\renewcommand\subitem{}
\newcommand{\maybeadddot}{\@ifnextchar.{}{.}}
\newcommand{\Index}[1]{\imki@wrindexentry{MyIndex}{#1}{\thesubpara}}
\renewcommand{\indexname}{}
\makeatother

\makeindex[name=MyIndex, options= -s alphab.ist,title=Table Alphabétique,intoc]

\indexsetup{othercode=\small\raggedright}


\begin{document}

\numsubpara{title6}
\Index{É}
\Index{e23@é23}

\Index{B}
\Index{B1}
\Index{B2}
\Index{B3}
\Index{B4}
\Index{B5}
\Index{B6}
\Index{B7}
\Index{B8}
\Index{B9}
\Index{C1}\Index{C2}\Index{C3}\Index{C4}\Index{C5}
\Index{D1}\Index{D2}\Index{D3}\Index{C4}\Index{D5}
\Index{E1}\Index{E2}\Index{E3}\Index{E4}\Index{E5}
\Index{F1}\Index{F2}\Index{F3}\Index{F4}\Index{F5}
\Index{G1}\Index{G2}\Index{G3}\Index{G4}\Index{G5}
\Index{H1}\Index{H2}\Index{H3}\Index{H4}\Index{H5}
\Index{I1}\Index{I2}\Index{I3}\Index{I4}\Index{I5}
\Index{J1}\Index{J2}\Index{J3}\Index{J4}\Index{J5}
\Index{K1}\Index{K2}\Index{K3}\Index{K4}\Index{K5}
\Index{L1}\Index{L2}\Index{L3}\Index{L4}\Index{L5}

\printindex[MyIndex]

\end{document}

如果要修改索引标题的外观,请使用titlesec功能。但我认为没有理由让它与其他章节有所不同。

相关内容