From 6da0d477b6b8ef5b23291b8a09f0d0242e74659d Mon Sep 17 00:00:00 2001
From: Karl Berry <karl@freefriends.org>
Date: Fri, 18 Jul 2014 20:42:10 +0000
Subject: bidi (18jul14)

git-svn-id: svn://tug.org/texlive/trunk@34654 c570f23f-e606-0410-a88d-b1316a301751
---
 Master/texmf-dist/source/xelatex/bidi/bidi.dtx | 77 ++++++++++++++++++++------
 1 file changed, 61 insertions(+), 16 deletions(-)

(limited to 'Master/texmf-dist/source/xelatex/bidi/bidi.dtx')

diff --git a/Master/texmf-dist/source/xelatex/bidi/bidi.dtx b/Master/texmf-dist/source/xelatex/bidi/bidi.dtx
index afafe7a527b..21c7355d015 100644
--- a/Master/texmf-dist/source/xelatex/bidi/bidi.dtx
+++ b/Master/texmf-dist/source/xelatex/bidi/bidi.dtx
@@ -5,7 +5,7 @@
 %<*readme>
 ___________________
 The bidi package
-v15.0
+v15.1
 
 This package provides a convenient interface for typesetting
 bidirectional texts in Plain TeX and LaTeX, using XeTeX engine.
@@ -18,13 +18,13 @@ If you want to report any bugs or typos and corrections in the documentation,
 or ask for any new features, or suggest any improvements, or ask any questions
 about the package, then please do not send any direct email to me; I will not 
 answer any direct email. Instead please use the issue tracker:
-  <http://sourceforge.net/p/bidi/tickets>
+  <https://github.com/vafa/bidi/issues>
 In doing so, please always explain your issue well enough, always include
 a minimal working example showing the issue, and always choose the appropriate
-label for your query (i.e. if you are reporting any bugs, choose `bug' label). 
+label for your query (i.e. if you are reporting any bugs, choose `Bug' label). 
 
 
-Current version release date: 2014/07/08
+Current version release date: 2014/07/18
 
 ___________________
 Vafa Khalighi
@@ -256,7 +256,7 @@ by Vafa Khalighi.
 % Bidirectional typesetting in plain \TeX{} and \LaTeX, using \XeTeX{} engine}
 % \author{Vafa Khalighi\\
 %  \url{persian-tex@tug.org}}
-% \date{\today\qquad Version 15.0}
+% \date{\today\qquad Version 15.1}
 %\maketitle
 %\vskip 0pt plus 3fill
 %\fbox{%
@@ -267,12 +267,12 @@ by Vafa Khalighi.
 %answer any direct email. Instead please use the issue tracker:
 %
 %\medskip
-%  \centerline{\url{http://sourceforge.net/p/bidi/tickets}}
+%  \centerline{\url{https://github.com/vafa/bidi/issues}}
 %
 %\medskip
 %In doing so, please always explain your issue well enough, always include
 %a minimal working example showing the issue, and always choose the appropriate
-%label for your query (i.e. if you are reporting any bugs, choose `bug' label). 
+%label for your query (i.e. if you are reporting any bugs, choose `Bug' label). 
 %\end{minipage}
 %}
 %\clearpage
@@ -296,14 +296,14 @@ by Vafa Khalighi.
 %* 
 %* Copyright © 2009–2014 Vafa Khalighi
 %* 
-%* 2014/07/08, v15.0
+%* 2014/07/18, v15.1
 %* 
 %* License: LaTeX Project Public License, version
 %* 1.3c or higher (your choice)
 %* 
 %* Location on CTAN: /macros/xetex/latex/bidi
 %* 
-%* Issue tracker: http://sourceforge.net/p/bidi/tickets
+%* Issue tracker: https://github.com/vafa/bidi/issues
 %* 
 %* Support: persian-tex@tug.org
 %****************************************************
@@ -739,6 +739,16 @@ by Vafa Khalighi.
 %The \textsf{hyperref} package works fine with bidirectional documents if and only if, your link will not span more than a line. If your link spans more than a line, then your whole document, or page or paragraph may be linked.
 %
 %
+%\subsection{The \textsf{listings} package}
+% Suppose that the main direction of the document is RTL, and you want to typeset a piece of C code in LTR mode but you also have the requirement that the caption of that particular code should be RTL. Since the direction of the code is LTR, then the direction of the caption also will be LTR and this is not something you want; sadly there is no easy way to do this. For this very reason, the \textsf{bidi} package adds a key to the \textsf{listings} package, namely \texttt{captiondirection}. This key can have the following values:
+%\begin{itemize}
+%\item \texttt{textdirection} follows the direction of the text (default).
+%\item \texttt{RTL} sets the direction of the caption to RTL.
+%\item \texttt{LTR} sets the direction of the caption to LTR.
+%\end{itemize}
+% Giving any other values gives you an error.
+%
+%
 %\subsection{\textsf{flowfram} Package}
 %You can use \textsf{flowfram} package for your bidirectional documents. Please note that \textsf{flowfram} package provides support for bidirectional column typesetting, for details, see its manual.
 %\subsection{Multicolumn Typesetting}
@@ -1043,7 +1053,7 @@ by Vafa Khalighi.
 %\iffalse
 %<*table>
 %\fi
-%% \CheckSum{41973}
+%% \CheckSum{42046}
 %% \CharacterTable
 %%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
 %%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
@@ -2574,8 +2584,8 @@ by Vafa Khalighi.
 % \subsection{\textsf{bidi.sty}}
 %    \begin{macrocode}
 \NeedsTeXFormat{LaTeX2e}
-\def\bididate{2014/07/08}
-\def\bidiversion{v15.0}
+\def\bididate{2014/07/18}
+\def\bidiversion{v15.1}
 \ProvidesPackage{bidi}[\bididate\space \bidiversion\space
 Bidirectional typesetting in plain TeX and LaTeX]
 \edef\@bidi@info{****************************************************^^J%
@@ -2597,7 +2607,7 @@ Bidirectional typesetting in plain TeX and LaTeX]
 * ^^J%
 * Location on CTAN: /macros/xetex/latex/bidi^^J%
 * ^^J%
-* Issue tracker: http://sourceforge.net/p/bidi/tickets^^J%
+* Issue tracker: https://github.com/vafa/bidi/issues^^J%
 * ^^J%
 * Support: persian-tex@tug.org^^J%
 ****************************************************}
@@ -2656,7 +2666,7 @@ Bidirectional typesetting in plain TeX and LaTeX]
 %\fi
 % \subsection{\textsf{bidi.tex}}
 %    \begin{macrocode}
-\def\bididate{2014/07/08}
+\def\bididate{2014/07/18}
 \def\bidiversion{v0.2}
 \catcode`@=11
 \let \protect \relax
@@ -2680,7 +2690,7 @@ Bidirectional typesetting in plain TeX and LaTeX]
 * ^^J%
 * Location on CTAN: /macros/xetex/latex/bidi^^J%
 * ^^J%
-* Issue tracker: http://sourceforge.net/p/bidi/tickets^^J%
+* Issue tracker: https://github.com/vafa/bidi/issues^^J%
 * ^^J%
 * Support: persian-tex@tug.org^^J%
 ****************************************************}
@@ -12119,7 +12129,42 @@ bidi implementation of tufte title]
 %\fi
 % \subsection{\textsf{listings-xetex-bidi.def}}
 %    \begin{macrocode}
-\ProvidesFile{listings-xetex-bidi.def}[2010/07/25 v0.5 bidi adaptations for listings package for XeTeX engine]
+\ProvidesFile{listings-xetex-bidi.def}[2014/07/18 v0.6 bidi adaptations for listings package for XeTeX engine]
+\lst@Key{captiondirection}{textdirection}{%
+    \lstKV@SwitchCases{#1}%
+    {textdirection&\\%
+     RTL&\chardef\bidi@lst@caption@direction\@ne\\%
+     LTR&\chardef\bidi@lst@caption@direction\z@%
+    }{\PackageError{Listings}{direction #1 unknown}\@ehc}}
+\newcommand*{\bidi@lst@ensure@caption@direction}[2]{%
+   \@ifundefined{bidi@lst@caption@direction}{}{%
+    \ifnum\bidi@lst@caption@direction=\z@%
+        #1%
+    \else%
+         \ifnum\bidi@lst@caption@direction=\@ne%
+             #2%
+         \fi%
+     \fi%
+}}
+\long\def\@bidi@lst@makecaption#1#2{%
+   \vskip\abovecaptionskip
+   \bidi@lst@ensure@caption@direction{\@RTLfalse}{\@RTLtrue}%
+   \sbox\@tempboxa{#1: #2}%
+   \ifdim \wd\@tempboxa >\hsize
+     #1: #2\par
+   \else
+     \global \@minipagefalse
+     \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}%
+   \fi
+   \vskip\belowcaptionskip}%
+\def\lst@makecaption{\@bidi@lst@makecaption}
+\def\lst@maketitle{\@bidi@lst@makecaption\lst@title@dropdelim}
+\AtBeginDocument{%
+\@ifundefined{captionlabelfalse}{}{%
+  \def\lst@maketitle{\captionlabelfalse\@bidi@lst@makecaption\@empty}}%
+\@ifundefined{caption@startrue}{}{%
+  \def\lst@maketitle{\caption@startrue\@bidi@lst@makecaption\@empty}}%
+}
 \AtBeginDocument{
   \@ifundefined{thechapter}{\let\lst@ifnumberbychapter\iffalse}{}
   \lst@ifnumberbychapter
-- 
cgit v1.2.3

