17

Do you mean like this? This is just a starter really, I put it together without too much care over finer points. In particular it assumes that each paragraph just produces boxes and inter-line penalty and glue (one of each). If the paragraph contains any vadjust material (\vspace or inserts (begin{figure} or fancy specials (any random package:-) then you ...


15

The 'proper' (internal) name of the primitive has always been \textdir, but for various reasons it used to be 'activated' as \luatextextdir in LuaLaTeX. The LaTeX team have recently revised this approach and all primitives now have their 'natural' names in LuaLaTeX. Thus you should either update your code or add \directlua{ tex.enableprimitives("luatex",...


12

In my opinion, the alignment of the numbers has nothing to do with the direction of the text. Whether you write in english (LTR) or arabic (RTL), you should always align numbers on their right edge. The reason for this is that when using the hindu-arabic numeral system, you "sort of" write digits RTL: the smallest order of magnitude goes to the most right (...


11

In the Western European tradition, text runs from left-to-right (LTR) across the page, with lines stacked from top-to-bottom (TTB) down the page 1 abcdefgh 2 abcdefgh 3 abcdefgh .... Arabic, Persian, Hebrew and related middle Eastern systems have a reversal of the line direction, with text running from right-to-left (RTL) across the page. The lines still ...


11

Using the solution from Fix nested section numbers in RTL languages with polyglossia (and no, I haven't gotten down to why this works yet): \documentclass{book} \usepackage{polyglossia} \setmainlanguage[numerals=western]{farsi} \newfontfamily\arabicfont{Arial} \makeatletter \renewcommand{\SepMark}[1]{\def\@SepMark{#1}} \makeatother \SepMark{-} \begin{...


11

Disclaimer: I can't read Uyghur, so I don't actually know if this is correct. Neither polyglossia nor babel appear to support Uyghur out of the box. ArabTeX claims to, but I think you have to use Latin characters for input. However, perhaps using Arabic settings with polyglossia and a Uyghur font gives the right output. Compile this with xelatex. \...


10

Here is another alternative, in the form of a macro named \boustrophedon : \documentclass{article} \usepackage{lipsum} \usepackage{graphicx} \parindent0pt \begin{document} \newcounter{cnt} \long\def\boustrophedon#1{% \setbox1=\vbox{\advance\hsize by -20pt#1}%place contents in a box \vfuzz=10pt % supress overull warnings \splittopskip=0pt %no glue at ...


10

To get the Unicode bidirectional algorithm working correctly, you need to use babel. There are many clever things babel can now do with lualatex and right-to-left languages. Have a look through the manual. Try this (with lualatex): \documentclass[12pt,a4paper]{article} \usepackage[nil,bidi=basic-r]{babel} \babelprovide[import=ar,main]{arabic} \babelfont[...


9

Odd numbered pages should always be right pages! So you should always use \cleardoublepage before changing page numbering, because it makes no sense to change page numbering on the left side of a double sided print: \documentclass[twoside]{article}% It's better to tell already the class to use twoside! \usepackage[showframe]{geometry} \begin{document} This ...


9

Use xelatex and the polyglossia package along with the multicols package. Here's an example. Since I don't know Persian, I've just used Google translate to translate something. I'm sure the translation isn't very good. % !TEX TS-program = XeLaTeX \documentclass[12pt]{article} \usepackage{multicol} \usepackage{polyglossia} \usepackage{fontspec} \...


9

This can be solved by loading setspace after polyglossia. It's not a bug: since setspace and bidi (loaded by polyglossia for RTL languages) both mess with the footnotes, you need to let bidi do its work and then let setspace do its. % !TEX TS-program = XeLaTeX \documentclass{article} \usepackage{polyglossia} \setmainlanguage{english} \setotherlanguage{...


9

You can use only one mapping file at a time; so the solution is to merge the map files. Prepare a file texarabicdigits.map containing ; TECkit mapping for TeX input conventions <-> Unicode characters LHSName "TeX-text" RHSName "UNICODE" pass(Unicode) ; ligatures from Knuth's original CMR fonts U+002D U+002D <> U+2013 ; -- -> ...


9

As it has been mentioned already, the reverse text effect described in the TikZ manual is what you are looking for. However, you also want to first group the letters using the group letters effect, otherwise it reverses every single letter. Note that the order of both keys is important, in the example I provide below I wrote both orders to showcase the ...


8

You can use Artyom Beilis' BiDiTex, which pre-processes a (La)TeX file to reverse parentheses and enclose numbers in appropriate macros. The documentation lists the problem you mention exactly, in section 1... that's the motivation for writing that utility. Using the question's MWE: \documentclass[english,hebrew]{article} \usepackage[utf8x]{inputenc} \...


8

If you want the entire cell contents to be justified, except the last line to be right justified (\raggedleft), you can use the following length settings (original source): \leftskip=0pt plus .5fil \rightskip=0pt plus -.5fil \parfillskip=0pt plus .5fil Here is a minimal working example (MWE) showing this in a tabular with p{5cm} column and some dummy text (...


7

No, you can’t. XeTeX processes each word in isolation and does not apply the BiDi algorithm to the whole paragraph. It is possible to use interchar classes to do very primitive BiDi processing, but it is too limited to be reliable (because the nature of BiDi handling and the fact interchar classes were not meant for such use cases). P.S. I have a Bidi ...


7

The dot can be removed using the glossaries package option nopostdot. The Missing \endcsname inserted error is because you're trying to use \textarabic{...} as a label, but the label must be plain text. I don't have the required fonts installed, so I can't fully test it, but try the following: \documentclass[twocolumn]{article} \usepackage{fontspec} \...


7

You have to explicitly change the language to English: \documentclass{article} \usepackage{polyglossia} \setmainlanguage{hebrew} \setotherlanguage{english} \setmainfont{Linux Libertine O} \begin{document} \begin{itemize} \item שלום \textenglish{hello} שלום. \item שלום \textenglish{hello}. \item שלום \textenglish{hello}. \end{itemize} \end{document} ...


6

This is not an answer. I was able to produce the minimal working example as: \documentclass{article} \usepackage{hyperref} \TeXXeTstate=1 \def\neweverypar{{\setbox0\lastbox\beginR\usebox0}} \let\origeverypar=\everypar \def\everypar#1{\origeverypar{\neweverypar#1}} \begin{document} This is \href{http://google.com}{Google} and ... \end{document} after runing ...


6

The verbatim environment uses only one font, so you need a monospaced font that contains both Latin and Persian glyphs. Here's an example (but I don't know Persian, so it might be not perfect): \documentclass{article} \usepackage{fontspec} \setmonofont{FreeMono} \begin{document} \begin{verbatim} <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"...


6

Arabic support for LuaLaTeX is still in development: see Typesetting arabic with LuaLaTeX. I don't know if there's Syriac support in LuaLaTeX. There is a package for XeLaTeX, however: (unfortunately not on CTAN): XeSyriac.


6

For two-column mode throughout the document a good approach is given in a different answer (unless you also require balancing). For more than 2 columns or when balancing of column data is needed the answer should be to use the multicol package. However, as demonstrated by Vafa Khalighi this results in an incorrect ordering of toc entries. The reason for ...


6

The problem is caused the label printing macro in amsmath. This uses \@@italiccorr to apply an italic correction before the closing brace, and in this hebrew set-up that changes the character ordering. As the effect of this correction is small anyway, you could remove it in your document. You also need to change \maketag@@@ in order that \eqref works ...


6

I don't know arabic, so I don't even know what the correct quotes are in this case. But what I can tell you is that the command \DeclareQuoteOption can be used only in a configuration file csquotes.cfg. This file can contain new options which can then be used at loading time by the csquotes package. In fact it is loaded by csquotes before processing its ...


6

The problem is resolved by adding \bodydir TRT to the definition of the syriac environment. So, the correct definition is \newenvironment{syriac} {\par% Syriac paragraph \pardir TRT\textdir TRT\bodydir TRT\syriacfont} {\par} There is hardly any documentation available of the LuaTeX text direction infrastructure.


6

I think you wanted to use \raggedleft and not \raggedright. Also it has to be issued inside itemize and not outside it. MWE (I've used Amiri since I don't have Adobe Arabic installed): \documentclass[11pt]{beamer} \usetheme{Berlin} \usepackage{media9} \usepackage{polyglossia} \setdefaultlanguage[numerals=eastern]{farsi} \newfontfamily\farsifont[Script=arab]...


6

The above answer is correct. I am adding this answer for the reference. One should add this lines to the MWE provided in the question: \makeatletter \def\SepMark#1{\gdef\@SepMark{\if@RTL\fi#1\if@RTL\fi}} \makeatother So, this will work as intented: \documentclass{book} \usepackage{xepersian} \settextfont[Scale=1]{Arial} \setlatintextfont[Scale=1]{Arial} \...


5

Here's another alternative using @GonzaloMedina's \lastbox suggestion: \documentclass{article} \setlength{\fboxsep}{1pt}% \usepackage{lipsum}% http://ctan.org/pkg/lipsum \newbox\linebox \newcount\mycount \def\processline{% Underline every second line \global\advance\mycount by 1 \ifodd\mycount \makebox[\textwidth][c]{\smash{\fbox{\box\linebox}}}% ...


Only top voted, non community-wiki answers of a minimum length are eligible