拇指食指,用从右到左的语言?

拇指食指,用从右到左的语言?

我尝试使用thumbs包在希伯来语书中创建 Thumb Indices,但失败了。再次检查自述,最后一行是:

  • 使用 Polyglossary 从右到左书写可能与拇指不兼容。

有什么推荐的简单替代方案吗?我需要拇指索引里面有文字。

如果有人需要,这里是失败的代码:

\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

这个答案是我的答案的变体https://tex.stackexchange.com/a/300186/93559

这是使用 生成缩略图索引的代码tikz。如果您需要一个页面,其中所有缩略图都列在与文档中的缩略图索引相同的高度,也可以添加它。

这个想法是给每一页添加一个钩子,绘制一张tikz包含拇指索引的图片。

命令\SetThumbInd定义为

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

用于保存缩略图索引的文本\ThumbText并处理下一个缩略图索引的位置。缩略图索引之间的距离存储在命令中\ThumbStep

该命令\NoThumb关闭缩略图索引。在内部,这是通过布尔值处理的,specialpage在没有缩略图索引的页面上,布尔值为真。

完整代码:

\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}

相关内容