From 229926b078d21f35d3d6a5e2c42449f15fbeeca6 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Fri, 3 Jul 2015 22:05:09 +0000 Subject: bidihl (3jul15) git-svn-id: svn://tug.org/texlive/trunk@37746 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/xelatex/bidihl/README | 27 ++++ .../texmf-dist/doc/xelatex/bidihl/bidihl-doc.pdf | Bin 0 -> 123447 bytes .../texmf-dist/doc/xelatex/bidihl/bidihl-doc.tex | 42 +++++ .../texmf-dist/doc/xelatex/bidihl/test-bidihl.pdf | Bin 0 -> 28108 bytes .../texmf-dist/doc/xelatex/bidihl/test-bidihl.tex | 17 ++ Master/texmf-dist/tex/xelatex/bidihl/bidihl.sty | 173 +++++++++++++++++++++ 6 files changed, 259 insertions(+) create mode 100644 Master/texmf-dist/doc/xelatex/bidihl/README create mode 100644 Master/texmf-dist/doc/xelatex/bidihl/bidihl-doc.pdf create mode 100644 Master/texmf-dist/doc/xelatex/bidihl/bidihl-doc.tex create mode 100644 Master/texmf-dist/doc/xelatex/bidihl/test-bidihl.pdf create mode 100644 Master/texmf-dist/doc/xelatex/bidihl/test-bidihl.tex create mode 100644 Master/texmf-dist/tex/xelatex/bidihl/bidihl.sty (limited to 'Master/texmf-dist') diff --git a/Master/texmf-dist/doc/xelatex/bidihl/README b/Master/texmf-dist/doc/xelatex/bidihl/README new file mode 100644 index 00000000000..4c109a196d5 --- /dev/null +++ b/Master/texmf-dist/doc/xelatex/bidihl/README @@ -0,0 +1,27 @@ +_____________________ +The bidihl package +v0.1a + +Experimental bidi-aware text highlighting + +The package allows users to highlight RTL and LTR texts. + +The package only works with `xelatex' format and should be +loaded before `bidi' package. + +For more information, please see the documentation. + + +Current version release date: 2015/07/02 + +___________________ +Vafa Khalighi +persian-tex@tug.org + +Copyright © 2015 +It may be distributed and/or modified under the LaTeX Project Public License, +version 1.3c or higher (your choice). The latest version of +this license is at: http://www.latex-project.org/lppl.txt + +This work is “author-maintained” (as per LPPL maintenance status) +by Vafa Khalighi. diff --git a/Master/texmf-dist/doc/xelatex/bidihl/bidihl-doc.pdf b/Master/texmf-dist/doc/xelatex/bidihl/bidihl-doc.pdf new file mode 100644 index 00000000000..4f826d97bb7 Binary files /dev/null and b/Master/texmf-dist/doc/xelatex/bidihl/bidihl-doc.pdf differ diff --git a/Master/texmf-dist/doc/xelatex/bidihl/bidihl-doc.tex b/Master/texmf-dist/doc/xelatex/bidihl/bidihl-doc.tex new file mode 100644 index 00000000000..38e41a4cb1b --- /dev/null +++ b/Master/texmf-dist/doc/xelatex/bidihl/bidihl-doc.tex @@ -0,0 +1,42 @@ +\documentclass{ltxdoc} +\usepackage{framed} +\usepackage{holtxdoc} +\begin{document} +\title{The \xpackage{bidihl} Package} +\author{Vafa Khalighi\\\xemail{persian-tex@tug.org}} +\maketitle + +\begin{framed} +This manual is incomplete and the package is experimental. +\end{framed} + +\tableofcontents + +\section{Introduction} +The \xpackage{soul} package provides the \cs{hl} command for +highlighting text; unfortunately this packages does not work in right to left +documents. + +The \xpackage{bidihl} package allows users to highlight text in both right to left +and left to right directions; it needs the \xpackage{bidi} package and should always +be loaded before \xpackage{bidi} package. + + +\section{Basic usage} +\begin{declcs}{bidihl} \M{text} +\end{declcs} +Highlights the text. The default highlighting box color is yellow; if a different color is desired, then simply define a new color with +\texttt{bidihlcolor} as the name of the color; i.e. +\begin{verbatim} +\definecolor{bidihlcolor}{rgb}{0.3,0.1,0} +\end{verbatim} + +The default highlighting box height is 10pt; again if a different height is desired, then change the length of \cs{bidihlboxheight}; i.e. +\begin{verbatim} +\setlength{\bidihlboxheight}{8pt} +\end{verbatim} +The height of the highlighting box does not automatically change; you have to set its length manually. + + + +\end{document} \ No newline at end of file diff --git a/Master/texmf-dist/doc/xelatex/bidihl/test-bidihl.pdf b/Master/texmf-dist/doc/xelatex/bidihl/test-bidihl.pdf new file mode 100644 index 00000000000..b62196cec19 Binary files /dev/null and b/Master/texmf-dist/doc/xelatex/bidihl/test-bidihl.pdf differ diff --git a/Master/texmf-dist/doc/xelatex/bidihl/test-bidihl.tex b/Master/texmf-dist/doc/xelatex/bidihl/test-bidihl.tex new file mode 100644 index 00000000000..0ab69e20980 --- /dev/null +++ b/Master/texmf-dist/doc/xelatex/bidihl/test-bidihl.tex @@ -0,0 +1,17 @@ +\documentclass{article} +\usepackage{bidihl} +\usepackage{bidi} +\setRTL +\pagestyle{empty} +\begin{document} + +This is a test \bidihl{Vafa and What else} and the rest + +\bigskip + + +This is a test \bidihl{Vafa and we continue until we can go to the next line so we need to see what is going on} and here is the rest of the test as you can see + +This is a test as you can see and here we can \bidihl{Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.} Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum. + +\end{document} \ No newline at end of file diff --git a/Master/texmf-dist/tex/xelatex/bidihl/bidihl.sty b/Master/texmf-dist/tex/xelatex/bidihl/bidihl.sty new file mode 100644 index 00000000000..ff1dc66284c --- /dev/null +++ b/Master/texmf-dist/tex/xelatex/bidihl/bidihl.sty @@ -0,0 +1,173 @@ +%% +%% This is file `bidihl.sty'. +%% +%% ___________________________________________ +%% Copyright © 2015 Vafa Khalighi +%% +%% It may be distributed and/or modified under the LaTeX Project Public License, +%% version 1.3c or higher (your choice). The latest version of +%% this license is at: http://www.latex-project.org/lppl.txt +%% +%% This work is “author-maintained” (as per LPPL maintenance status) +%% by Vafa Khalighi. +%% +%% +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{bidihl}[2015/07/02 v0.1a Experimental bidi-aware text highlighting] + +%% Load color package and define highlighting color + +\RequirePackage{color} +\definecolor{bidihlcolor}{rgb}{1,1,0} % yellow + +%% Register Declaration + +\newdimen\bidihl@highlight@depth \bidihl@highlight@depth-\maxdimen +\newdimen\bidihl@highlight@thickness \bidihl@highlight@thickness.4pt + +\newdimen\bidihlboxheight \bidihlboxheight10pt + +\newdimen\bidihlspacerulewidth \bidihlspacerulewidth0.1pt + +\newdimen\bidihl@height \newdimen\bidihl@depth + +\newcount\bidihl@spacefactor + +\newif\ifbidihl@nospace + +%% User Interface and Initialization + +\def\bidihl{\bidihl@highlight\bidihl@highlight@depth{-\bidihl@highlight@depth}{-\dp\strutbox}} + + +\def\bidihl@highlight#1#2#3#4{\begingroup \let\\\bidihlnewline + \ifdim#1<\z@ \bidihl@height#3\relax + \else \bidihl@height#2\relax \fi + \bidihl@depth-\bidihl@height + \ifdim\bidihl@height<\z@ \advance\bidihl@depth\bidihl@highlight@thickness + \else \advance\bidihl@height\bidihl@highlight@thickness \fi + \bidihl@nospacetrue + \ifvmode\leavevmode\fi \bidihl@spacefactor\spacefactor + \def\@tempa{#4 }\edef\@tempb{\noexpand\@nil\space}% + \expandafter\expandafter\expandafter\bidihl@wordloop + \expandafter\@tempa\@tempb + \endgroup \bidihl@aftergroup} + + +%% Processing Word Elements + +\def\bidihl@wordloop{\bidihl@ifbgroup\bidihl@wordblock\bidihl@iwordloop} +\def\bidihl@ifbgroup#1#2{\let\@tempa#1\let\@tempb#2\futurelet\@tempc\bidihl@ifnc} +\def\bidihl@ifnc{\ifx\@tempc\bgroup \let\next\@tempa \else\let\next\@tempb \fi + \next} +\def\bidihl@wordblock#1{\bidihl@spaceskip + \def\bidihl@theword{#1}\bidihl@putword \bidihl@nospacetrue + \bidihl@wordloop} +\def\bidihl@iwordloop#1 {\def\@tempa{#1}\ifx\@tempa\@nnil \let\next\bidihl@end + \else\ifx\@tempa\empty \else + \bidihl@spaceskip + \def\bidihl@theword{}\bidihl@charloop#1\@nil\fi + \bidihl@nospacefalse \let\next\bidihl@wordloop \fi + \next} + +\def\bidihl@charloop{\bidihl@ifbgroup\bidihl@charblock\bidihl@icharloop} +\def\bidihl@charblock#1{\bidihl@putword + \def\bidihl@theword{#1}\bidihl@putword + \bidihl@charloop} +\def\bidihl@icharloop#1{\def\@tempa{#1}% + \ifx\@tempa\@nnil \bidihl@putword \let\next\relax + \else\ifx\bidihlspace#1\relax \bidihl@putword \let\next\bidihl@space + \else\ifx\bidihlnewline#1\relax \bidihl@putword \let\next\bidihl@newline + \else\edef\bidihl@theword{\bidihl@theword#1}% + \let\next\bidihl@charloop \fi\fi\fi \next} +\def\bidihlspace{\PackageError{bidihl}% + {\string\bidihlspace\space cannot be used here.}% + {\string\bidihlspace\space can be used only in the argument of + \string\bidihl.}} +\def\bidihlnewline{\PackageError{bidihl}% + {\string\bidihlnewline\space cannot be used here.}% + {\string\bidihlnewline\space can be used only in the argument of + \string\bidihl.}} + +%% Interword Spacing + +\def\bidihl@spaceskip{\ifbidihl@nospace\else + \ifdim\spaceskip=\z@ + \@tempdima\fontdimen3\font\relax + \multiply\@tempdima\bidihl@spacefactor \divide\@tempdima\@m + \@tempdimb\fontdimen4\font\relax \multiply\@tempdimb\@m + \divide\@tempdimb\bidihl@spacefactor + \@tempskipa\fontdimen2\font plus\@tempdima minus\@tempdimb\relax + \else + \edef\@tempa{\the\spaceskip\space @ @ @ @ }% + \expandafter\bidihl@setspaceskip\@tempa\@nil + \fi + \ifnum\bidihl@spacefactor<2000\else + \ifdim\xspaceskip=\z@ \advance\@tempskipa\fontdimen7\font + \else \@tempskipa\xspaceskip + \fi\fi + \bidihl@skip\@tempskipa \fi} +\def\bidihl@setspaceskip#1 #2 #3 #4 #5 #6\@nil{\@tempdima\z@ \@tempdimb\z@ + \def\@tempa{#2}\def\@tempb{#3}% + \ifx\@tempa\bidihl@plus \@tempdima#3\def\@tempa{#4}\def\@tempb{#5}\fi + \ifx\@tempa\bidihl@minus \@tempdimb\@tempb\relax\fi + \multiply\@tempdima\bidihl@specefactor \divide\@tempdima\@m + \multiply\@tempdimb\@m \divide\bidihl@spacefactor + \@tempskipa#1 plus\@tempdima minus\@tempdimb\relax} +\def\@tempa#1 #2 #3 #4 #5\@nil{\def\bidihl@plus{#2}\def\bidihl@minus{#4}} +\@tempskipa1pt plus 2pt minus 3pt +\expandafter\@tempa\the\@tempskipa\@nil + + + +%% Draw highlight text + +\def\bidihl@putword{\setbox\@tempboxa\hbox{\bidihl@theword + \global\bidihl@spacefactor\spacefactor}% + \@tempdima\wd\@tempboxa + \if@RTL% + \box\@tempboxa + {\color{bidihlcolor}\llap{\vrule\@height\bidihlboxheight\@depth\bidihl@depth\@width\@tempdima}}% + \else + {\color{bidihlcolor}\rlap{\vrule\@height\bidihlboxheight\@depth\bidihl@depth\@width\@tempdima}}% + \box\@tempboxa + \fi + \def\bidihl@theword{}} +\def\bidihl@skip#1{% + \leaders\hbox{{\color{bidihlcolor}\vrule\@height\bidihlboxheight\@depth\bidihl@depth\@width\bidihlspacerulewidth}}\hskip#1\relax} + + + +%% Explicit Spacing and Line Breaking + +\def\bidihl@space{\@ifstar\bidihl@sspace\bidihl@ispace} +\def\bidihl@sspace#1{\vrule width\z@\nobreak\bidihl@skip{#1}\bidihl@charloop} +\def\bidihl@ispace#1{\@tempskipa#1\relax + \@ifstar{\@tempswafalse\bidihl@iispace}{\@tempswatrue\bidihl@iispace}} +\def\bidihl@iispace{\@ifnextchar[%] + {\bidihl@penalty}% + {\bidihl@skip\@tempskipa \bidihl@charloop}} +\def\bidihl@penalty[#1]{\@tempcnta#1\relax + \if@tempswa + \ifnum\@tempcnta<\z@ \@tempcnta-\@tempcnta \fi + \ifcase\@tempcnta \or + \@tempcnta\@lowpenalty \or + \@tempcnta\@medpenalty \or + \@tempcnta\@highpenalty \else + \@tempcnta\@M \fi + \ifnum#1<\z@ \@tempcnta-\@tempcnta \fi \fi + \penalty\@tempcnta \bidihl@skip\@tempskipa \bidihl@charloop} + +\def\bidihl@newline{\@ifstar{\bidihl@skip{0pt plus1fil}\break \bidihl@charloop}% + {\hfil \break \bidihl@charloop}} + + + + + +%% Finalization + +\def\bidihl@end{\xdef\bidihl@aftergroup{\spacefactor\number\bidihl@spacefactor\relax}} +\endinput +%% +%% End of file `bidihl.sty'. \ No newline at end of file -- cgit v1.2.3