0

I am a hebrew LyX user and when creating a file most of the links in the TOC work correcrtly, except when the internal TOC link should point to a "Part" layout (Sections, subsections and so on work correctly)

Here is a minimal example of the problem. In this example, after creating the PDF, the only correct link is of the section layout.

%% LyX 2.3.5.2 created this file.  For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclass[english,hebrew]{article}
\usepackage{fontspec}
\setmainfont[Mapping=tex-text]{David CLM}
\setsansfont[Mapping=tex-text]{David}
\setmonofont{David}
\usepackage{geometry}
\geometry{verbose,tmargin=1.5cm,bmargin=1.5cm,lmargin=1.5cm,rmargin=1.5cm}
\setcounter{secnumdepth}{-1}
\setlength{\parskip}{\medskipamount}
\setlength{\parindent}{0pt}
\usepackage{latexsym}
\usepackage{setspace}
\usepackage{microtype}
\doublespacing

\makeatletter
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
% hebrew support package
\usepackage{culmus}

\newfontface\hebrewfont{David}

% \usepackage[hypertexnames=false]{hyperref}
\usepackage{hyperref}

\AtBeginDocument{
  \def\labelitemii{\(\lhd\)}
  \def\labelitemiii{\(\triangleleft\)}
  \def\labelitemiv{\(\star\)}
}

\makeatother

\usepackage{polyglossia}
\setdefaultlanguage{hebrew}
\setotherlanguage{english}
\begin{document}
\tableofcontents{}

\pagebreak{}

\part{פארט}

מילים

\newpage{}

\section{סקשן}

מילים\newpage{}

\part{פארט}

מילים

\newpage{}

סתם תוכן\newpage
\end{document}

4
  • This example is not minimal. Also, we prefer code directly here on the site...
    – Ingmar
    Oct 23, 2021 at 15:35
  • @Ingmar this is code from lyx, it is the minimal thing LyX has to offer. If I were to write in plain tex it would've been shorter. If you want I can copy the text from the link in here. Oct 23, 2021 at 15:43
  • I am really no expert for LyX, but I seem to remember it does have an export to “LaTeX” function … ? Not that many people here work with LyX in the first place.
    – Ingmar
    Oct 23, 2021 at 15:45
  • @Ingmar understood, updating now Oct 23, 2021 at 15:53

1 Answer 1

0

Disclaimer: This is not really a definite answer, but I can't format code in the comments. I have successfully run this code with LuaLaTex:

\documentclass[english,hebrew]{article}
\usepackage{fontspec}

\setmainfont[Mapping=tex-text]{DavidCLM-Medium.otf}

\setcounter{secnumdepth}{-1}

\usepackage{culmus}
\usepackage{hyperref}

\AtBeginDocument{
  \def\labelitemii{\(\lhd\)}
  \def\labelitemiii{\(\triangleleft\)}
  \def\labelitemiv{\(\star\)}
}

\usepackage{polyglossia}
\setdefaultlanguage{hebrew}
\setotherlanguage{english}

\begin{document}
\tableofcontents{}
\pagebreak{}

\part{TRAP –פארט}
מילים
\newpage{}

\section{NOITCES – קשן}
מילים
\newpage{}

\part{TRAP –פארט}
מילים
\newpage{}

סתם תוכן
\newpage
\end{document}

Disclaimer: I have no knowledge of Hebrew whatsoever, and my editor only does basic RTL. I had to install the required font and simply dropped it in the current working directory.

That said, the above code compiles for me, it produces a 5-page document and a working & clickable (to the correct page) TOC. If it works on your end, too, this could be a starting point for further development.

You must log in to answer this question.

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