Skip to content

Commit

Permalink
Bidi in sections. Fixed some data related to french.
Browse files Browse the repository at this point in the history
  • Loading branch information
Javier committed Dec 19, 2017
1 parent fab36eb commit c1ce4b5
Show file tree
Hide file tree
Showing 6 changed files with 239 additions and 10 deletions.
70 changes: 63 additions & 7 deletions required/babel/babel.dtx
Expand Up @@ -229,6 +229,9 @@ use with Plain \TeX.
If you are interested in the \TeX{} multilingual support, please join
the \textsf{kadingira} list on
\texttt{http://tug.org/mailman/listinfo/kadingira}.
% You can follow the
% development of \babel{} on
% \texttt{https://github.com/latex3/latex2e/tree/master/required/babel}.

\section{The user interface}\label{U-I}

Expand Down Expand Up @@ -1230,6 +1233,11 @@ captions):
\tag{fi} Finnish\hascapu\hascapl
\tag{fil} Filipino
\tag{fo} Faroese
\tag{fr} French\hascapu\hascapl
\tag{fr-BE} French\hascapu\hascapl
\tag{fr-CA} French\hascapu\hascapl
\tag{fr-CH} French\hascapu\hascapl
\tag{fr-LU} French\hascapu\hascapl
\tag{fur} Friulian\hascapu\hascapl
\tag{fy} Western Frisian
\tag{ga} Irish\hascapu\hascapl
Expand Down Expand Up @@ -2288,6 +2296,18 @@ counterpart.
option, with a certain bidi model).
\end{warning}

\Describe{\BabelPatchSection}{\marg{section-name}}

Working -- Mainly for bidi text, but it could be useful in other
cases. |\BabelPatchSection| and the corresponding option
|layout=sectioning| takes a more logical approach (at least in many
cases) because it applies the global language to the section format,
while the section text is still the current language. The latter is
passed to tocs and marks, too. It can be set individually or to all
standard sectioning commands. TODO: In the latter case, |\markboth|
and |markright| are not redefined, because the text passed includes
already the language selector. TODO: layout=nomarks ? %%%%%

\subsection{Language attributes}

\DescribeMacro{\languageattribute}
Expand Down Expand Up @@ -8391,8 +8411,8 @@ help from Bernd Raichle, for which I am grateful.
% set left-to-right and right-to-left page layouts. As Lua\TeX-ja
% shows, vertical typesetting is posible, too. Its main drawback
% is font handling is often considered to be less mature than
% \xetex.\footnote{Although in my [JBL] experience problems are
% in fact minimal.}
% \xetex{} (but there are steps to make HarfBuzz, the \xetex{}
% font engine, available in \luatex{}).
% \end{itemize}
%
% \changes{3.15}{2017/10/30}{Use an attribute instead of tex language
Expand Down Expand Up @@ -8531,6 +8551,42 @@ help from Bernd Raichle, for which I am grateful.
\DeclareRobustCommand\babelsublr[1]{\leavevmode{\bbl@textdir\z@#1}}
% \end{macrocode}
%
% \subsection{Layout}
%
% \textbf{Work in progress}.
%
% Layout is mainly intended to set bidi documents, but there is at
% least a tool useful in general.
%
% \begin{macrocode}
\newcommand\BabelPatchSection[1]{%
\@ifundefined{#1}{}{%
\bbl@exp{\let\<bbl@ss@#1>\<#1>}%
\@namedef{#1}{%
\@ifstar{\bbl@presec@s{#1}}%
{\@dblarg{\bbl@presec@x{#1}}}}}}
\def\bbl@presec@x#1[#2]#3{%
\let\bbl@savetemplang\languagename
\select@language@x\bbl@main@language
\@nameuse{bbl@ss@#1}%
[\foreignlanguage{\bbl@savetemplang}{#2}]%
{\foreignlanguage{\bbl@savetemplang}{#3}}%
\select@language@x\bbl@savetemplang}
\def\bbl@presec@s#1#2{%
\let\bbl@savetemplang\languagename
\select@language@x\bbl@main@language
\@nameuse{bbl@ss@#1}*{\foreignlanguage{\languagename}{#2}}%
\select@language@x\bbl@savetemplang}
\IfBabelLayout{sectioning}% at begin document ???
{\BabelPatchSection{part}%
\BabelPatchSection{chapter}%
\BabelPatchSection{section}%
\BabelPatchSection{subsection}%
\BabelPatchSection{subsubsection}%
\BabelPatchSection{paragraph}%
\BabelPatchSection{subparagraph}}{}
% \end{macrocode}
%
% \subsection{Local Language Configuration}
%
% \begin{macro}{\loadlocalcfg}
Expand Down Expand Up @@ -10145,6 +10201,8 @@ help from Bernd Raichle, for which I am grateful.
%
% \subsection{Layout}
%
% In progress.
%
% Unfortunately, for proper support for \xetex{} lots of macros and
% packages must be patched somehow. At least at this stage, \babel{}
% will not do it and therefore a package similar to \textsf{bidi} will
Expand All @@ -10159,7 +10217,7 @@ help from Bernd Raichle, for which I am grateful.
% constructs are valid: |\adim\bbl@startskip|,
% |\advance\bbl@startskip\adim|, |\bbl@startskip\adim|.
%
% Consider |txtbabel| as shorthand for \textit{tex--xet babel}.
% Consider |txtbabel| as a shorthand for \textit{tex--xet babel}.
%
% \begin{macrocode}
%<*texxet>
Expand Down Expand Up @@ -10662,10 +10720,11 @@ help from Bernd Raichle, for which I am grateful.
%
% \changes{3.14}{2017/09/30}{LuaTeX - support for R/AL texts - basic-r}
%
% \textbf{Work in progress}.
%
% \subsection{Layout}
%
% \textbf{Work in progress}.
%
% Unlike \xetex{}, \luatex{} requires only minimal changes for
% right-to-left layouts, particularly in monolingual documents (the
% engine itself reverses boxes -- including column order or headings
Expand All @@ -10689,9 +10748,6 @@ help from Bernd Raichle, for which I am grateful.
\shapemode\@ne
\fi
\noindent\box\@tempboxa}
\IfBabelLayout{sectioning}
{}
{}
\IfBabelLayout{lists}
{\def\list#1#2{%
\ifnum \@listdepth >5\relax
Expand Down
Binary file modified required/babel/babel.pdf
Binary file not shown.
5 changes: 2 additions & 3 deletions required/babel/bbcompat.dtx
Expand Up @@ -185,9 +185,8 @@
%<+estonian>\input estonian.ldf\relax
%<+finnish>\def\CurrentOption{finnish}
%<+finnish>\input finnish.ldf\relax
%<+francais>\def\CurrentOption{francais}
%<+french>\def\CurrentOption{french}
%<+francais|french>\input frenchb.ldf\relax
%<+francais>\def\CurrentOption{french}
%<+francais>\input french.ldf\relax
%<+galician>\def\CurrentOption{galician}
%<+galician>\input galician.ldf\relax
%<+austrian>\def\CurrentOption{austrian}
Expand Down
Binary file added required/babel/samples/Thales.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added required/babel/samples/lua-arabic.pdf
Binary file not shown.
174 changes: 174 additions & 0 deletions required/babel/samples/lua-arabic.tex
@@ -0,0 +1,174 @@
%$LuaLaTeX -*- coding: utf-8 ; mode: latex; TeX-engine: luatex; -*-
\documentclass[a4paper]{book}

\usepackage[english, bidi=basic-r]{babel}

\babelprovide[import=ar, main]{arabic}

\babelfont{rm}
[ItalicFont=FreeSerif, Numbers=Arabic]
{FreeSerif}

\usepackage{microtype}
\usepackage{graphicx}
\usepackage{color}

\title{كهرباء} \author{From Wikipedia}

% Fix some bad kerns inserted by the font loader. I don't know where
% the bug is and why the following workaroud fixes it. It just forces
% a dir node as the second node in the par. Note it doesn't take hboxes
% into account, yet (no local_par = 9 node at the beginning). It seems
% the font loader will be fixed soon.

\directlua{

function fixkerns (head)
if head and head.id == 9 then
snd = head.next
if snd and not (snd.id == node.id'dir') then
local d = node.new(node.id'dir')
d.dir = head.dir
head = node.insert_after(head, head, d)
end
end
return head
end

where = luatexbase.priority_in_callback('pre_linebreak_filter',
'luaotfload.node_processor')

luatexbase.add_to_callback("pre_linebreak_filter", fixkerns, "fixkerns", where)
% luatexbase.add_to_callback("hpack_filter", fixkerns, "fixkerns", where)
}

\begin{document}

\frontmatter

\maketitle

\tableofcontents

\chapter{مقدمة}

الكهرباء اسم يضم مجموعة متنوعة من الظواهر الناتجة عن وجود شحنة
كهربائية وتدفقها. وتضم هذه الظواهر البرق والكهرباء الساكنة. ولكنها
تحتوي على مفاهيم أقل شيوعًا مثل المجال الكهرومغناطيسي والحث
الكهرومغناطيسي.

أما في الاستخدام العام، فمن المناسب استخدام كلمة «كهرباء» للإشارة إلى
عدد من التأثيرات الفيزيائية. ولكن في الاستخدام العلمي، يعد المصطلح
غامضًا. كما أن هذه المفاهيم المتعلقة به يُفضل تعريفها وفقًا لمصطلحات أكثر
دقة كما يلي:

\begin{description}
\item[الشحنة الكهربائية] هي خاصية لبعض الجسيمات دون الذرية تحدد
التفاعلات الكهرومغناطيسية الخاصة بها. فالمادة المشحونة كهربائيًا تتأثر
بالمجالات الكهرومغناطيسية وتنتجها.
\item[التيار الكهربائي] هو تحرك أو تدفق الجسيمات المشحونة كهربائيًا،
ويُقاس عادةً بالأمبير.
\item[المجال الكهربائي] هو تأثير تنتجه شحنة كهربائية في غيرها من
الشحنات الموجودة بالقرب منها.
\item[الجهد الكهربائي] قدرة المجال الكهربائي على الشغل، ويُقاس عادةً
بوحدة الفولت.
\item[الكهرومغناطيسية] هي التفاعل الأساسي الذي يحدث بين المجال
المغناطيسي ووجود الشحنة الكهربائية وحركتها.
\end{description}

خضعت الظواهر الكهربائية للدراسة منذ القِدم، إلا أن علم الكهرباء لم يشهد
أي تقدم حتى القرنين السابع عشر والثامن عشر. ومع ذلك فقد ظلت التطبيقات
العملية المتعلقة بالكهرباء قليلة العدد، ولم يتمكن المهندسون من تطبيق
علم الكهرباء في الحقل الصناعي والاستخدامات السكنية إلا في أواخر القرن
التاسع عشر. وقد أدى التقدم السريع في تكنولوجيا الكهرباء في ذلك الوقت
إلى إحداث تغييرات في المجال الصناعي وفي المجتمع أيضًا. كما أن
الاستعمالات المتعددة والمذهلة للكهرباء كمصدر من مصادر الطاقة أظهر
إمكانية استخدامها في عدد كبير من التطبيقات مثل المواصلات والتدفئة
والإضاءة والاتصالات والحساب. فأساس المجتمع الصناعي الحديث يعتمد على
استخدام الطاقة الكهربائية، ويمكن التكهن بأن الاعتماد على الطاقة
الكهربائية سيستمر في المستقبل.

\bigskip

\foreignlanguage*{english}{Things to do: section numbers are reversed
(“correct” in the Unicode sense, but here the full stop has a special
meaning). In red, a couple of word incorrectly rendered by default. It
seems a bug in the font loader, and a workaround is used in
this document (see the source).}

\mainmatter

\chapter{نظرة عامة}

\section{وجه التسمية}

الكهرباء لفظ فارسي مركب من کاه أي القش ومن رُبَای أي الجاذب، ومعناها
جميعا جاذب القش؛ والمراد بكلمة کهربا في الفارسية هو الكهرمان المسمى
بالعربية العنبر الأشهب، أما المقصود من كلمة الكهرباء في العربية فهو
"جاذبية الكهرمان" والتي كانت تسمى بالعربية خاصية الكهرباء فحذفوا كلمة
الخاصية واكتفوا بلفظ الكهرباء. وبذلك تحول من الفارسية إلى العربية من
معنى الفاعل (الجاذب) إلى معنى الفاعلية (الجاذبية).

الكهرمان اسمه باليونانية الإيلقطرون[3] (معرب ἤλεκτρον إيلكترون أي ذو
البريق، ومنه الإلكترون عند الفيزيائيين، وعليه تسمية الكهرباء في
الفارسية برق)، واشتق منه اسم فاعليتيه فسمي إلكترسمس (ηλεκτρ‌ισμός)
للدلالة على الكهرباء. أما باللاتينية فالكلمة للكهرباء هي إيلكترستاس
(ēlectricitās)، وهي مشتقة من إيلكتركس (ēlectricus) أي شبيه الكهرمان.

\section{تاريخ}

قبل معرفة الكهرباء بفترة طويلة، كان الناس على دراية بالصدمات التي
يحدثها سمك الرعاش، وقد أشارت النصوص التي تركها قدماء المصريين، والتي
يرجع تاريخها إلى سنة 2750 قبل الميلاد، إلى هذه الأسماك باسم "صاعقة
النيل"، كما وصفوها بأنها حامية جميع الأسماك الأخرى. وبعد حوالي ألف
عام، أشار إليها أيضًا الإغريق والرومان وعلماء الطبيعة والأطباء
المسلمون.[4] ولقد أكد الكتّاب القدامى، مثل بليني الأكبر وسكريبونيس
لارجوس على الإحساس بالتنميل الناتج عن الصدمات الكهربائية التي يحدثها
سمك السلّور الصاعق وأنقليس الرعاد الكهربائي. كما اكتشف هؤلاء الكتّاب أن
هذه الصدمات يمكن أن تنتقل عبر الأجسام الموصلة.[5] وبجميع الأحوال، ينسب
أقدم وأقرب أسلوب لاكتشاف ماهية البرق والكهرباء الصادرة عن أي مصدر آخر
إلى العرب الذين أطلقوا كلمة "برق" العربية على الشعاع الكهربائي قبل
القرن الخامس عشر. وقد كان معروفًا في الثقافات القديمة للدول المطلة على
البحر الأبيض المتوسط أن هناك أجسامًا معينة مثل قضبان الكهرمان، يمكن
حَكِّها بفرو قطة فتجذب الأجسام الخفيفة مثل الريش. وقد قام العالم
والفيلسوف الإغريقي، طاليس الملطي، حوالي عام 600 قبل الميلاد بتسجيل
مجموعة من الملاحظات تتعلق بالكهرباء الساكنة. وبعد هذه الملاحظات، توصل
إلى أن الاحتكاك يحول الكهرمان إلى مادة مغناطيسية. وعلى عكس ذلك، لا
تحتاج المعادن، مثل الماغنتيت المعروف باسم أكسيد الحديد الأسود، إلى
عملية الاحتكاك حتى تكتسب صفة المغناطيسية.[6] إلا أن طاليس كان مخطئًا في
اعتقاده بأن سبب الانجذاب هو التأثير المغناطيسي، فقد أثبتت الأبحاث
العلمية فيما بعد وجود علاقة بين المغناطيسية والكهرباء. ووفقًا لإحدى
النظريات المثيرة للجدل، فقد عرف البارثيون، إحدى شعوب بلاد فارس، الطلاء
الكهربائي وفقًا لما أفادت المعلومات التي تحصلت من اكتشاف بطارية بغداد
عام 1936. وعلى الرغم من أن هذه البطارية تشبه الخلية الجلفانية، فإنه من
غير المؤكد ما إذا كانت ذات طبيعة كهربية أم لا.

\begin{figure}
\centering
\includegraphics{Thales.png}
\caption{طاليس، أول باحث في الكهرباء.}
\end{figure}

ظلت الكهرباء لا تعني أكثر من مجرد فضول فكري لآلاف السنين حتى عام
1600. ففي ذلك العام، أجرى الطبيب الإنجليزي ويليام جيلبرت دراسة دقيقة
حول الكهرباء والمغناطيسية، وفرّق فيها بين تأثير حجر المغناطيس والكهرباء
الساكنة التي تنتج عن احتكاك مادة الكهرمان.[6] وابتكر كلمة «electricus»
وهي باللغة اللاتينية الجديدة («من الكهرمان» أو «شبيه الكهرمان»،
ومأخوذة من «ήλεκτρον» أي «إلكترون»، وهي المرادف اليوناني لكلمة
«كهرمان») للإشارة إلى خاصية جذب الأجسام الصغيرة بعد حكها. [7] أدى هذا
الارتباط إلى إبراز الكلمتين «Electric» و«Electricity» اللتين ظهرتا
لأول مرة في كتاب توماس براون «الأخطاء الشائعة» (باللاتينية:
Pseudodoxia Epidemica) الذي صدر عام 1646.

قد قدم أوتو فون جيريك وروبرت بويل وستيفن جراي وسي إف ديو فاي المزيد من
الأعمال. وأجرى بنيامين فرانكلين في القرن الثامن عشر أبحاثًا شاملة بشأن
الكهرباء، حتى أنه اضطر إلى بيع ممتلكاته لتمويل أبحاثه. وقيل أنه في شهر
حزيران/يونيو من سنة 1752، قام بربط مفتاح معدني أسفل خيط طائرة ورقية
رطب وأطلق الطائرة في سماء تنذر بهبوب عاصفة. ثم لاحظ مجموعة متلاحقة من
الشرارات تخرج من المفتاح إلى ظهر يده، الأمر الذي \textcolor{red}{برهن}
على أن البرق ذو طبيعة كهربائية بالفعل. [9] نشر لودجي جالفاني عام 1791
اكتشافه الخاص بالكهرباء الحيوية الذي أظهر أن الكهرباء هي الوسيط الذي
تقوم من خلاله الخلايا العصبية بنقل \textcolor{red}{الإشارات} إلى
العضلات.

\end{document}

0 comments on commit c1ce4b5

Please sign in to comment.