1

I'm trying to write a document that contains English, so I put:

\begin{english}
 % Some lines....
\end{english}

And then, if I put TOC at the beginning, this is the result:
enter image description here

No titles of parts, sections,...

If I'm removing the TOC or the english part - it works, but not with both :-(
Do you know why and how can I solve it?

MWE:

% Preview source code

%% LyX 2.3.6.1 created this file. For more info, see http://www.lyx.org/. %% Do not edit unless you really know what you are doing. \documentclass[a4paper,english,hebrew,numbers=noenddot]{scrartcl} \usepackage{amsmath} \usepackage{amsthm} \usepackage{fontspec} \usepackage{fancyhdr} \pagestyle{fancy} \setlength{\parindent}{0bp} \usepackage{color} \usepackage{pifont} \usepackage[unicode=true,pdfusetitle, bookmarks=true,bookmarksnumbered=false,bookmarksopen=false, breaklinks=false,pdfborder={0 0 0},pdfborderstyle={},backref=false,colorlinks=true] {hyperref} \hypersetup{ linkcolor=blue}

\makeatletter

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LyX specific LaTeX commands. \pdfpageheight\paperheight \pdfpagewidth\paperwidth

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands. \newfontfamily\hebrewfont[Script=Hebrew]{David CLM} \newfontfamily\hebrewfonttt[Script=Hebrew]{Miriam Mono CLM} \newfontfamily\hebrewfontsf[Script=Hebrew]{Bellefair} \AtBeginDocument{ \renewcommand\footnoterule{% \kern -3pt \hbox to \textwidth{\hfill\vrule height 0.4pt width .4\textwidth} \kern 2.6pt }}

% Commands:

\makeatother

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

\part{שלום}

\section{שלום}

\begin{english} abcd \end{english} \end{document}

P.S. I tried to change the font to FreeSans and although this - the titles are still missing

Thank you!

heblyx
  • 2,571
  • 1
    Works OK in Lualatex in TexLive2020 (without the two LyX commands, and using FreeSans font). – Cicada Oct 02 '21 at 12:20
  • What do you get when you add \tracinglostchars=3, to make it an error when you try to use characters the font does not have? – Davislor Jun 30 '22 at 11:38

1 Answers1

1

Using the font Arial and

\newfontfamily\hebrewfont[Script=Hebrew]{Arial}
\newfontfamily\hebrewfonttt[Script=Hebrew]{Arial}
\newfontfamily\hebrewfontsf[Script=Hebrew]{Arial}

I get the same result.

But with

\setmainfont{Arial}
\setmonofont{Arial}
\setsansfont{Arial}

the result is fine

a

(I am using TeXstudio, so I removed the LyX specific LaTeX commands. They are not needed with xelatex or lualatex. They will be set by the a4paper of the class. https://tex.stackexchange.com/a/425649/161015 )

    \documentclass[a4paper,english,hebrew,numbers=noenddot]{scrartcl}
    \usepackage{amsmath}
    \usepackage{amsthm}
    \usepackage{fontspec}
    \usepackage{fancyhdr}
    \pagestyle{fancy}
    \setlength{\parindent}{0bp}
    \usepackage{color}
    \usepackage{pifont}
    \usepackage[unicode=true,pdfusetitle,
    bookmarks=true,bookmarksnumbered=false,bookmarksopen=false,
    breaklinks=false,pdfborder={0 0 0},pdfborderstyle={},backref=false,colorlinks=true]
    {hyperref}
    \hypersetup{
        linkcolor=blue}
\makeatletter

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LyX specific LaTeX commands.
%\pdfpageheight\paperheight
%\pdfpagewidth\paperwidth


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
%\newfontfamily\hebrewfont[Script=Hebrew]{DavidCLM}
%\newfontfamily\hebrewfonttt[Script=Hebrew]{Miriam Mono CLM}
%\newfontfamily\hebrewfontsf[Script=Hebrew]{Bellefair}


%% IT DOES NOT WORK
%\newfontfamily\hebrewfont[Script=Hebrew]{Arial}
%\newfontfamily\hebrewfonttt[Script=Hebrew]{Arial}
%\newfontfamily\hebrewfontsf[Script=Hebrew]{Arial}


% THIS WORKS OK ! <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
\setmainfont{Arial}
\setmonofont{Arial}
\setsansfont{Arial}

\AtBeginDocument{
    \renewcommand\footnoterule{%
        \kern -3pt
        \hbox to \textwidth{\hfill\vrule height 0.4pt width .4\textwidth}
        \kern 2.6pt
}}  
% Commands:

\makeatother

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

\begin{document}
    \tableofcontents{}

    \part{שלום}

    \section{שלום}

    \begin{english}
        abcd
    \end{english}
\end{document}

Using other fonts. In this example the .ttf files in sub-directories under the directory FONTS of the working directory.

d

b

% !TeX TS-program = xelatex

\documentclass[a4paper,english,hebrew,numbers=noenddot]{scrartcl} \usepackage{amsmath} \usepackage{amsthm} \usepackage{fontspec} \usepackage{fancyhdr} \pagestyle{fancy} \setlength{\parindent}{0bp} \usepackage{color} \usepackage{pifont} \usepackage[unicode=true,pdfusetitle, bookmarks=true,bookmarksnumbered=false,bookmarksopen=false, breaklinks=false,pdfborder={0 0 0},pdfborderstyle={},backref=false,colorlinks=true] {hyperref} \hypersetup{ linkcolor=blue}

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

% using other fonts. .ttf files in subdirectories under the directory FONTS of the working directory <<<<<<<<<<<<<<<< \setmainfont[ Path =./FONTS/TaameyDavidCLM/, Ligatures = TeX , Script = Hebrew, Extension=.ttf, UprightFont=-Medium , BoldFont=-Bold, ItalicFont=-MediumOblique, BoldItalicFont=-BoldOblique, Scale=1.0 % Adjust to match Latin font ]{TaameyDavidCLM}

\setmonofont[ Path =./FONTS/MiriamMonoCLM/, Script = Hebrew, Extension=.ttf, UprightFont=-Book, BoldFont=-Bold, ItalicFont=-BookOblique, BoldItalicFont=-BoldOblique, Scale=1.0 % Adjust to match Latin font ]{MiriamMonoCLM}

\setsansfont[ Path =./FONTS/DejaVuSans/, Ligatures = TeX , Script = Hebrew, Extension=.ttf, UprightFont=* , BoldFont=-Bold, ItalicFont=-Oblique, BoldItalicFont=*-BoldOblique, Scale=1.0 % Adjust to match Latin font ]{DejaVuSans}

\AtBeginDocument{ \renewcommand\footnoterule{% \kern -3pt \hbox to \textwidth{\hfill\vrule height 0.4pt width .4\textwidth} \kern 2.6pt }}

\begin{document} \tableofcontents

\part{שלום}

\section{שלום}

\begin{english}
    abcd
\end{english}

\section{בראשית} \textbf{בְּרֵאשִׁ֖ית} \textit{יְהִ֣י א֑וֹר}

\bigskip

\texttt{ \textbf{וַיַּ֧רְא אֱלֹהִ֛ים אֶת־הָא֖וֹר כִּי־ט֑וֹב וַיַּבְדֵּ֣ל אֱלֹהִ֔ים בֵּ֥ין} הָא֖וֹר וּבֵ֥ין הַחֹֽשֶׁךְ׃ }

\section{מבוא} זוהי עובדה מבוססת שדעתו של הקורא תהיה מוסחת עלידי טקטס קריא כאשר הוא יביט בפריסתו.

\end{document}

Simon Dispa
  • 39,141
  • Thank you! But if I want to use other fonts then Arial, this is possible? "Remove the LyX specific LaTeX commands" - what do you mean? – heblyx Oct 02 '21 at 14:21
  • @heblyx What fonts do you want to use? I am using TeXstudio so I deleted \pdfpageheight\paperheight and \pdfpagewidth\paperwidth. They are not needed. The pdf will follow the a4paper option. – Simon Dispa Oct 02 '21 at 17:29
  • It gives me error because the path of the fonts, how can I find mine? (When I add the lines: \setsansfont[ Path =./FONTS/DejaVuSans/, ...) – heblyx Oct 03 '21 at 13:28
  • @heblyx To run this example as it is: Make a directory FONTS in your working directory (where you have the example). Then underneath create a subdirectory DejaVuSans. Put in it the four .ttf files, as shown in the second figure.

    You can download the files from https://mirrors.ctan.org/fonts/dejavu.zip (subdirectory truetype).

    – Simon Dispa Oct 03 '21 at 13:55
  • @heblyx In a similar way for TaameyDavidCLM font from http://culmus.sourceforge.net/taamim/TaameyDavidCLM.zip. Other hebrew fonts can be found in the culmus project http://culmus.sourceforge.net/index.html – Simon Dispa Oct 03 '21 at 14:02
  • Still don't working :-\ – heblyx Oct 03 '21 at 16:59