5

I want two minipages side by side, aligned to the margins and the tops aligned to each other.

I have read this previous answer but I think my problem is different and related to bidi.

In the MWE below, the output of English text on the left hand side is slightly indented away from the left margin. And the tops of the two mini pages are not aligned, despite my specifying [t] in both minipage commands.

My first question: how to fix this?

My second question relates to the nesting sequence.

Curiously, if I reverse the nesting sequence:

\begin{english}
\begin{minipage}{...

to

\begin{minipage}
\begin{english}

the indenting problem is reduced slightly, but still present. Can someone explain why there should be any difference in indenting between the two?

And why is there any indent at all? I thought minipage didn't use indent for first paragraph.

Here is the MWE

\documentclass[11pt,oneside]{report}
\usepackage{polyglossia}
\setmainlanguage[numerals=mashriq]{arabic}
\setotherlanguage{english}
\newfontfamily\arabicfont[Script=Arabic, Scale=1.50]{Times New Roman}
\newfontfamily\englishfont[Script=Latin]{Linux Libertine O}

\begin{document}

\chapter{كلمة \hfill\textenglish{text}}

\begin{footnotesize}
\linespread{1.4}\selectfont
\begin{minipage}[t]{0.47\linewidth}
كلمة كلمة كلمة كلمة كلمة كلمة كلمة كلمة كلمة كلمة كلمة كلمة كلمة كلمة كلمة كلمة كلمة كلمة كلمة كلمة كلمة كلمة 

كلمة كلمة كلمة كلمة كلمة كلمة كلمة كلمة كلمة كلمة كلمة كلمة كلمة كلمة كلمة كلمة كلمة كلمة كلمة كلمة 
\end{minipage}
\hfill
\begin{english}
\begin{minipage}[t]{0.47\linewidth}
text text text text text text text text text text text text text text text text text text text text text text text text text text 
text text text text text text text text text text text text text text text text text text text text text 
\end{minipage}
\end{english}
\end{footnotesize}

\end{document}
Tim
  • 1,539
  • 2
    The minipages are top-aligned along the top baselines, but the arabic text "floats" over the baseline, insert "xxxx" to see it. One cause of the indentation is a spurious space in the definition of \captionsarabic in gloss-arabic.ldf. – Ulrike Fischer Oct 22 '15 at 14:28
  • If you want to align the absolute tops, use \raisebox{-\height}{...} for each minipage. – John Kormylo Oct 22 '15 at 14:48

1 Answers1

6

Phew, sends you dizzy working out which end is the start of the line:-)

The problem is not indentation but space tokens making horizontal space. A couple in your document (added % but mostly in the end code of \end{english} (2 or three I was looking at \tracingall output not the actual code (that's probably a package bug)**.)

** Ulrike tracked down the bug: there are two missing spaces in the package code reported here

https://github.com/reutenauer/polyglossia/issues/115

once that is fixed, the paragraph break before \end{english} will not be needed, but for now the workaround is:

Here I put the paragraph break before \end{english} so it happens in vertical mode where space tokens do nothing.

Note you should always have a paragraph break before the end of a size change like footnotesize, whether given as a command or an environment.

enter image description here

\documentclass[11pt,oneside]{report}
\usepackage{polyglossia}
\setmainlanguage[numerals=mashriq]{arabic}
\setotherlanguage{english}
\newfontfamily\arabicfont[Script=Arabic, Scale=1.50]{Times New Roman}
\newfontfamily\englishfont[Script=Latin]{Linux Libertine O}

\begin{document}

\chapter{كلمة \hfill\textenglish{text}}

{\footnotesize
\linespread{1.4}\selectfont
\begin{minipage}[t]{0.47\linewidth}%
كلمة كلمة كلمة كلمة كلمة كلمة كلمة كلمة كلمة كلمة كلمة كلمة كلمة كلمة كلمة كلمة كلمة كلمة كلمة كلمة كلمة كلمة 

كلمة كلمة كلمة كلمة كلمة كلمة كلمة كلمة كلمة كلمة كلمة كلمة كلمة كلمة كلمة كلمة كلمة كلمة كلمة كلمة 
\end{minipage}\hfill\begin{english}%
\noindent\begin{minipage}[t]{0.47\linewidth}%
\noindent 111 text text text text text text text text text text text text text text text text text text text text text text text text text text 
text text text text text text text text text text text text text text text text text text text text text 
\end{minipage}\par%
\end{english}%


}

X1\dotfill X2

\noindent X1\dotfill X2




\noindent X\dotfill X

\end{document}
David Carlisle
  • 757,742
  • I discovered I don't need all of the code you give: all i needed for the fix is the \par before \end{english}. Also, as a newbie, I didn't know whether your use of {\footnotesize...} was exactly equivalent to my \begin{footnotesize}... ; When you give answers, changing as little as possible in my MWE helps me understand what is the main issue. :) – Tim Oct 25 '15 at 12:18
  • @Tim as I can't read the script editing the file at all in a bidi context was tricky so I didn't revert some edits even after I had found the cause:-) But it is always best to include a paragraph end within the scope of a font change, so you should have a blank line before the } or \end{footnotesize} in any case. Font sizes are normally used in {\xxx ... form but the environment form is fine too. – David Carlisle Oct 26 '15 at 08:11