2

I've tried creating Thumb Indices, using thumbs package, in a Hebrew book, and it failed. Checked again the Readme, and the last line is:

  • Right-to-left-writing with Polyglossary is probably not compatible with thumbs.

Any recommended simple alternatives? I need the thumb index to be with text inside.

If anyone is wanted, here's the failing code:

\documentclass{book}

\usepackage[height=4mm, width=1.5cm]{thumbs}
\pagenumbering{arabic}

\usepackage{polyglossia}        
\setdefaultlanguage{hebrew}       % comment this line, and get a nice thumb
\usepackage{fontspec}
\newfontfamily\hebrewfont{Times New Roman}[Script=Hebrew]

\begin{document}
\addthumb{Hello}{Hello}{white}{black}
\newpage
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris varius nisl sed enim consectetur, eu tempor libero cursus. Nulla at enim nunc. Duis vitae nibh erat. Nulla facilisi. Nunc eget ornare velit. Ut porta sed libero non tincidunt. Mauris dapibus pulvinar ornare.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris varius nisl sed enim consectetur, eu tempor libero cursus. Nulla at enim nunc. Duis vitae nibh erat. Nulla facilisi. Nunc eget ornare velit. Ut porta sed libero non tincidunt. Mauris dapibus pulvinar ornare.
\newpage
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris varius nisl sed enim consectetur, eu tempor libero cursus. Nulla at enim nunc. Duis vitae nibh erat. Nulla facilisi. Nunc eget ornare velit. Ut porta sed libero non tincidunt. Mauris dapibus pulvinar ornare.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris varius nisl sed enim consectetur, eu tempor libero cursus. Nulla at enim nunc. Duis vitae nibh erat. Nulla facilisi. Nunc eget ornare velit. Ut porta sed libero non tincidunt. Mauris dapibus pulvinar ornare.
\end{document}
1
  • Not really an answer, since it is not a package and would include manual adjustments: would the code posted in my answer to your previuous question tex.stackexchange.com/questions/299949/… work for your purpose?
    – Christian
    Commented Apr 28, 2016 at 17:21

1 Answer 1

2

This answer is a variation of my answer https://tex.stackexchange.com/a/300186/93559.

This is code generates the thumb indices using tikz. If you need a page where all the thumbs are listed at the same height as the thumb indices in the document this can also be added.

The idea is to add a hook to every page which draws a tikz picture containing the thumb index.

The command \SetThumbInd defined as

\newcommand{\SetThumbInd}[1]{%
  \setboolean{specialpage}{false}
  \addtolength{\ThumbIndY}{\ThumbStep}
  \renewcommand{\ThumbText}{#1}
  \setlength{\ThumbStep}{\totalheightof{\parbox{\ThumbIndWidth-4mm}{#1}}+5.5mm}}

is used to save the text for the thumb index to \ThumbText and to handle the position of the next thumb index. The distance between to thumb indices is stored in the command \ThumbStep.

The command \NoThumb switches off the thumb indices. Internally this is handled via the boolean specialpage which is true on pages without a thumb index.

Full code:

\documentclass{scrbook}
\usepackage{fontspec}
\usepackage{polyglossia}
\usepackage{everypage}
\usepackage{ifthen}
\usepackage{tikz}
\usepackage{calc}
\usetikzlibrary{calc}

\setmainlanguage{hebrew}

\newfontfamily\hebrewfont[Script=Hebrew]{David CLM}
\newfontfamily\hebrewfonttt[Script=Hebrew]{Miriam Mono CLM}
\newfontfamily\hebrewfontsf[Script=Hebrew]{Simple CLM}

\newcommand{\ThumbIndWidth}{1.8cm}
\newcommand{\NoThumb}{\setboolean{specialpage}{true}}

\newcommand{\ThumbText}{}
\newlength{\ThumbIndY}
\newlength{\ThumbStep}
\setlength{\ThumbIndY}{2cm}
\setlength{\ThumbStep}{0cm}

\newcommand{\SetThumbInd}[1]{%
  \setboolean{specialpage}{false}
  \addtolength{\ThumbIndY}{\ThumbStep}
  \renewcommand{\ThumbText}{#1}
  \setlength{\ThumbStep}{\totalheightof{\parbox{\ThumbIndWidth-4mm}{#1}}+5.5mm}}

\newcommand{\ThumbBreak}[1]{\addtolength{\ThumbIndY}{#1}}

\definecolor{thtcolor}{rgb}{1,1,1}
\definecolor{thbcolor}{rgb}{0.15,0.15,0.15}
\newboolean{specialpage}
\setboolean{specialpage}{true}

\AddEverypageHook{
  \ifthenelse{\boolean{specialpage}}{}{
    \ifthispageodd{
      \begin{tikzpicture}[remember picture, overlay]
        \node [shift={(0, -\the\ThumbIndY)}] at (current page.north west) {%
          \begin{tikzpicture}[remember picture, overlay]
            \node[shape=rectangle, color=thtcolor, minimum width=1.8cm, minimum height=0.7cm, text width=1.4cm,
        align=center, anchor=base, fill=thbcolor, inner sep=2mm] (ThumbInd) at (0.9,0.4) {\bf\textsf{\ThumbText}};
      \end{tikzpicture}};
      \end{tikzpicture}}{
      \begin{tikzpicture}[remember picture, overlay]
        \node [shift={(-2cm, -\the\ThumbIndY)}] at (current page.north east) {%
      \begin{tikzpicture}[remember picture, overlay]
        \node[shape=rectangle, color=thtcolor, minimum width=2cm, minimum height=0.7cm, text width=1.6cm,
        align=center, anchor=base, fill=thbcolor, inner sep=2mm] (ThumbInd) at (1,0.4) {\bf\textsf{\ThumbText}};
          \end{tikzpicture}};
      \end{tikzpicture}}}}

\begin{document}

\SetThumbInd{מילון}
\begin{center}
  \textbf{\large א}
\end{center}
\newpage
\begin{center}
  \textbf{\large ב}
\end{center}
\newpage
\NoThumb
\begin{center}
  \textbf{\large ג}
\end{center}

\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .