2

I'm trying to learn everything about Bi-lingual typing, but I can't seem to find a neat solution to switch languages and directions, that works not only (as far as I checked) in \itemize:

\documentclass[11pt]{article}
\usepackage{fontspec}
\usepackage{polyglossia}
\usepackage{physics}
\usepackage{amsfonts}
\usepackage{mathtools}
\newfontfamily\hebrewfont[Script=Hebrew]{David}
    \setsansfont{Arial}
\newfontfamily\otherfont{Times New Roman}
\setdefaultlanguage{hebrew}
\setotherlanguage{english}
\newcommand{\eht}[1]{\text{\textenglish{\texthebrew{#1}}}}
\begin{document}
\title{שיטות סטטיסטיות ונומריות בפיזיקה - תרגיל בית 1}
\author{איתי סויד, 208679092}
\maketitle
\section{בדיקה}
$$\eht{משוואה עם מילים בעברית}=\sum_{i=0}^n \left(\frac{i}{k}\right)$$
טקסט עברי \textenglish{With english and} בנוסף \textenglish{English text}.
\\נוכל גם לעשות:\\
\begin{english} %\begin{problem}
An English paragraph \texthebrew{עם טקסט עברי} inside.\\
\texthebrew{שורה המתחילה} with Hebrew text.
\end{english} %\end{problem}
\begin{itemize}
\item כמובן גם בעברית
\item \textenglish{And english too}
\begin{english} %But here the direction does change.
\item But aligned proparly.
\end{english}
\end{itemize}
\end{document}

And the output: Output

1 Answers1

1

Your problem is that you are not starting new paragraphs.

\\ starts a new line and should not be used for new paragraphs.

If you want paragraphs without an indent, use \setlength{\parindent}{0pt}, or better yet \usepackage{parskip}.

It sort of works in your itemize because a new paragraph is inserted at each \item. But in reality the horizontal position of the item is wrong. I'd put it in a separate itemize surrounded be an english environment.

You should also use \[...\] instead of $$...$$ for display maths.

Try this (different font I have installed):

\documentclass[11pt]{article}
\usepackage{mathtools}
\usepackage{fontspec}
\usepackage{polyglossia}
\setdefaultlanguage{hebrew}
\setotherlanguage{english}
\newfontfamily\hebrewfont[Script=Hebrew]{Linux Libertine O}
\newfontfamily\englishfont{Linux Libertine O}
\newcommand{\eht}[1]{\text{\textenglish{\texthebrew{#1}}}}
\begin{document}
\title{שיטות סטטיסטיות ונומריות בפיזיקה - תרגיל בית 1}
\author{איתי סויד, 208679092}
\maketitle
\section{בדיקה}

\[
  \eht{משוואה עם מילים בעברית}=\sum_{i=0}^n \left(\frac{i}{k}\right)
\]

טקסט עברי \textenglish{With english and} בנוסף \textenglish{English text}.

נוכל גם לעשות:

\begin{english}
An English paragraph \texthebrew{עם טקסט עברי} inside.

\texthebrew{שורה המתחילה} with Hebrew text.
\end{english}

\begin{itemize}
  \item כמובן גם בעברית
  \item \textenglish{And english too}
\end{itemize}

\begin{english}
\begin{itemize}
  \item But aligned proparly.
\end{itemize}
\end{english}
\end{document}

output

David Purton
  • 25,884