
\documentclass[12pt,a4paper]{mathbook_arabic}
%\newfontfamily\arabicfont[Script=Arabic]{Arial}
\addto\captionsarabic{\renewcommand{\contentsname}{الفهرس}}
% \newfontfamily\arabicfonttt[Script=Arabic]{Arial}
\usepackage{listings}
\usepackage{mathrsfs}
\definecolor{bleu}{cmyk}{0.59,0.11,0,0.59}
\definecolor{vert}{cmyk}{0.78,0,0.74,0.45}
\begin{document}
\tableofcontents
\chapter*{Intro}
some textes
\chapter{ch1}
\end{document}
これをコンパイルするとエラーが発生します
@dottedtocline の使用をスキャン中にファイルが終了しました。\par l.68 \tableofcontents
答え1
Overleaf のテンプレートにリンクしていただきありがとうございます。TeX Live 2020 ではあなたのバグを再現できませんが、別のバグは発生します。 の\newfontfamily\arabicfonttt
107 行目は でmathbook_arabic.sty
ある必要があります\newfontfamily\arabicfontsf
。その後、次の行で再宣言します\newfontfamily\arabicfonttt
。 の古いバージョンではfontspec
これが許可されていましたが、最近のバージョンではバグとしてフラグが付けられます。
このテンプレートには、その本に特有の内容が多く含まれており、少し古くなっています。好きなテンプレートを自由に使用できる場合は、まずこのようなテンプレートから始めて、必要に応じて変更することをお勧めします。
\documentclass[a4paper]{book} % Or article, scrbook, etc.
\tracinglostchars=2 % Warn if the current font does not have a character.
%% The previous sample you were using loaded the cmyk color space and manually
%% declared color names in French. This loads the standard color names used in
%% CSS, SVGs and HTML, e.g. Blue and DarkCyan. You can add HTML to allow hex
%% values.
\usepackage[svgnames]{xcolor}
%% Requires LuaHBTeX, or LuaLaTeX from 2020 or later.
\usepackage[bidi=basic, layout=sectioning]{babel}
\usepackage{unicode-math}
\usepackage{microtype}
%% You will certainly want to set more options than this, either here or with
%% \hypersetup.
\usepackage[unicode,
colorlinks]{hyperref}
%% Can substitute import=ar-DZ, import=ar-MA or import=ar-SY for import.
%% To change the numbers from Western to localized, add the maparabic option.
%% Can also change other counters, e.g. alph=alphabetic, Alph=abjad.
\babelprovide[import, main, onchar=ids fonts]{arabic}
\babelprovide[onchar=ids fonts]{english}
\defaultfontfeatures{Scale=MatchLowercase, Ligatures=TeX, Renderer=HarfBuzz}
%% You can change these to your fonts of choice.
\babelfont{rm}
[Scale=1.0, Ligatures=Common, Script=Default, Language=Default]{Libertinus Serif}
\babelfont[arabic]{rm}
{Amiri}
\babelfont{sf}
[Ligatures=Common, Script=Default, Language=Default]{Libertinus Sans}
\babelfont[arabic]{sf}
[Language=Default]{Noto Sans Arabic}
\babelfont{tt}
[Script=Default, Language=Default]{Libertinus Mono}
\babelfont[arabic]{tt}
{ALM Fixed}
\setmathfont{Libertinus Math}
\babeltags{english=english}
%% \babeltags would fail to redefine \arabic, so provide `\textArabic`, etc.
%% You are unlikely to need them, because babel will switch to Arabic whenever
%% you use the Arabic script.
\babeltags{Arabic=arabic}
\begin{document}
\chapter{A Chapter}
للُّغَة العَرَبِيّة هي أكثر اللغات السامية تحدثاً، وإحدى أكثر اللغات انتشاراً في العالم، يتحدثها أكثر من 467 مليون نسمة،
\begin{english}
Arabic (اَلْعَرَبِيَّةُ, al-ʿarabiyyah, [al ʕaraˈbijːa] or عَرَبِيّ, ʿarabīy, [ˈʕarabiː]
or [ʕaraˈbij]) is a Semitic language that first emerged in the 1st to 4th
centuries CE.
\end{english}
\end{document}
このバージョンのテンプレートは、ラテン文字を入力すると英語に、アラビア文字を入力するとアラビア語に自動的に切り替わります。この例では言語タグを1つ使用していますが、これは私がコピー&ペーストしたソースのIPA記号がどちらでもないためですが、英語フォントでは左から右に表示されるはずです。Babelにそれらを英語と見なすように指示することは可能です。次のように、欠落している文字ごとに再定義を追加することもできます。
\babelcharproperty{`ʕ}{locale}{english}
私が選んだメインのフォントは、Khaled Hosny の Amiri と Libertinus Sans です。どちらも以前のデザインに基づいており、お互いを非常によく補完しています。
これらを好みのフォントに変更できます。たとえば、一部の OS にまだ同梱されている古いバージョンの Arial ではなく、Windows 10 に同梱されている新しいバージョンの Arial をお持ちの場合は、\babelfont{sf}
と その後の 3 行を に置き換えることができます\babelfont{sf}{Arial}
。フォントは自動的に拡大縮小され、正しいOpenType 機能Script
と機能が選択されますLanguage
(実際には、このLanguage=
機能によって誤った警告が表示されるため、 を使用して警告を抑制することができます\babelfont{sf}[Language=Default]{Arial}
)。
数学については、Libertinus Math を にロードしましたunicode-math
。つまり、 などの従来の数学フォント パッケージは必要なく (使用すべきでもありません) amssymb
。 は\boldmath
と をサポートしています\boldsymbol
。これが望ましくない場合は、 との行を次のように\usepackage{unicode-math)
置き換えることができます。\setmathfont
\usepackage{fontspec}
\usepackage[libertine]{newtxmath}
\usepackage{bm}
ページ、タイトル、章、目次などのデフォルトの形式は変更しませんが、 や などの任意のパッケージを使用してこれを行うことができtocloft
ますfancyhdr
。