exporting.tex 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. \RequirePackage{filecontents}
  2. %
  3. % This file is public domain
  4. %
  5. \begin{filecontents*}{exporting-preamble.tex}
  6. \documentclass[12pt]{article}
  7. \usepackage[fullvoc,export=false]{arabluatex}
  8. \SetArbEasy
  9. \usepackage{csquotes}
  10. \DeclareQuoteStyle{arabic}
  11. {\textquotedblright}{\textquotedblleft}
  12. {\textquoteright}{\textquoteleft}
  13. % \renewcommand{\txarb}[1]{#1}
  14. % \renewcommand{\txtrans}[1]{\emph{#1}}
  15. % \newcommand{\aemph}[1]{#1}
  16. % \renewcommand{\arbup}[1]{\textsuperscript{#1}}
  17. \end{filecontents*}
  18. \begin{filecontents*}{exporting-dajaja.tex}
  19. \begin{arabexport}
  20. \section*{Unicode Arabic}
  21. \setquotestyle{arabic}
  22. \begin{arab}
  23. kAna \uc{'a}bU 'l-\uc{h}u_dayli 'ahd_A 'il_A
  24. \uc{m}uwaysiN dajAjaTaN. wa-kAnat dajAjatu-hu 'llatI
  25. 'ahdA-hA dUna mA kAna yuttaxa_du
  26. li-\uc{m}uwaysiN. wa-l_akinna-hu bi-karami-hi
  27. wa-bi-.husni _hu\-luqi-hi 'a.zhara 'l-ta`ajjuba min
  28. simani-hA wa-.tIbi la.hmi-hA. wa-kAna <\uc{'a}bU
  29. 'l-\uc{h}u_dayli> yu`rafu bi-'l-'imsAki
  30. 'l-^sadIdi. fa-qAla: \enquote{wa-kayfa ra'ayta yA
  31. \uc{'a}bA \uc{`i}mrAna tilka 'l-dajA\-jaTa?} qAla:
  32. \enquote{kAnat `ajabaN mina 'l-`ajabi!} fa-yaqUlu:
  33. \enquote{wa-tadrI mA jinsu-hA? wa-tadrI mA sinnu-hA?
  34. fa-'inna 'l-dajAjaTa 'inna-mA ta.tIbu bi-'l-jinsi
  35. wa-'l-sinni. wa-tadrI bi-'ayyi ^say'iN kunnA
  36. nusamminu-hA? wa-fI 'ayyi makAniN kunnA na`lifu-hA?}
  37. fa-lA yazAlu fI h_a_dA wa-'l-'A_haru ya.d.haku .da.hkaN
  38. na`rifu-hu na.hnu wa-lA ya`rifu-hu \uc{'a}bU
  39. 'l-\uc{h}u_dayli.
  40. \end{arab}
  41. \begin{arab}
  42. wa-kAna \uc{'a}bU 'l-\uc{h}u_dayli 'aslama 'l-nAsi
  43. .sadraN wa-'awsa`a-hum _huluqaN wa-'ashala-hum
  44. suhUlaTaN. fa-'in _dakarUA dajAjaTaN, qAla:
  45. \enquote{'ayna kAnat yA \uc{'a}bA \uc{`i}mrAna min
  46. tilka 'l-dajA\-jaTi?} fa-'in _dakarUA ba.t.taTaN 'aw
  47. `anAqaN 'aw jazUraN 'aw baqaraTaN, qAla:
  48. \enquote{fa-'ayna kAnat h_a_dihi 'l-jazUru fI 'l-juzuri
  49. min tilka 'l-dajAjaTi fI 'l-dajAji!} wa-'ini
  50. istasmana \uc{'a}bU 'l-\uc{h}u_dayli ^say'aN mina
  51. 'l-.tayri wa-'l-bahA'imi, qAla: \enquote{lA wa-'l-l_ahi
  52. wa-lA tilka 'l-dajAjaTu!} wa-'in _dakarUA `u_dUbaTa
  53. 'l-^sa.hmi, qAla: \enquote{`u_dUbaTu 'l-^sa.hmi fI
  54. 'l-baqari wa-'l-ba.t.ti wa-bu.tUni 'l-samaki
  55. wa-'l-dajAji, wa-lA siyyamA _d_alika 'l-jinsu mina
  56. 'l-dajAji.} wa-'in _dakarUA mIlAda ^say'iN 'aw
  57. qudUma 'insAniN, qAla: \enquote{kAna _d_alika ba`da 'an
  58. 'ahdaytu-hA la-ka bi-sanaTiN, wa-mA kAna bayna qudUmi
  59. fulAniN wa-bayna 'l-ba`_taTi bi-tilka 'l-dajAjaTi
  60. 'illA yawmuN.} wa-kAnat ma_ta\-laN fI kulli ^say'iN
  61. wa-tArI_haN fI kulli ^say'iN.
  62. \end{arab}
  63. \bigskip
  64. \begin{arab}
  65. \uc{al-jA.hi.zu}, \aemph{\uc{k}itAbu 'l-\uc{b}u_halA'i}
  66. \end{arab}
  67. \section*{Romanized Arabic}
  68. \setquotestyle{english}
  69. \begin{arab}[trans]
  70. kAna \uc{'a}bU 'l-\uc{h}u_dayli 'ahd_A 'il_A
  71. \uc{m}uwaysiN dajAjaTaN. wa-kAnat dajAjatu-hu 'llatI
  72. 'ahdA-hA dUna mA kAna yuttaxa_du
  73. li-\uc{m}uwaysiN. wa-l_akinna-hu bi-karami-hi
  74. wa-bi-.husni _hu\-luqi-hi 'a.zhara 'l-ta`ajjuba min
  75. simani-hA wa-.tIbi la.hmi-hA. wa-kAna <\uc{'a}bU
  76. 'l-\uc{h}u_dayli> yu`rafu bi-'l-'imsAki
  77. 'l-^sadIdi. fa-qAla: \enquote{wa-kayfa ra'ayta yA
  78. \uc{'a}bA \uc{`i}mrAna tilka 'l-dajA\-jaTa?} qAla:
  79. \enquote{kAnat `ajabaN mina 'l-`ajabi!} fa-yaqUlu:
  80. \enquote{wa-tadrI mA jinsu-hA? wa-tadrI mA sinnu-hA?
  81. fa-'inna 'l-dajAjaTa 'inna-mA ta.tIbu bi-'l-jinsi
  82. wa-'l-sinni. wa-tadrI bi-'ayyi ^say'iN kunnA
  83. nusamminu-hA? wa-fI 'ayyi makAniN kunnA na`lifu-hA?}
  84. fa-lA yazAlu fI h_a_dA wa-'l-'A_haru ya.d.haku .da.hkaN
  85. na`rifu-hu na.hnu wa-lA ya`rifu-hu \uc{'a}bU
  86. 'l-\uc{h}u_dayli.
  87. \end{arab}
  88. \begin{arab}[trans]
  89. wa-kAna \uc{'a}bU 'l-\uc{h}u_dayli 'aslama 'l-nAsi
  90. .sadraN wa-'awsa`a-hum _huluqaN wa-'ashala-hum
  91. suhUlaTaN. fa-'in _dakarUA dajAjaTaN, qAla:
  92. \enquote{'ayna kAnat yA \uc{'a}bA \uc{`i}mrAna min
  93. tilka 'l-dajA\-jaTi?} fa-'in _dakarUA ba.t.taTaN 'aw
  94. `anAqaN 'aw jazUraN 'aw baqaraTaN, qAla:
  95. \enquote{fa-'ayna kAnat h_a_dihi 'l-jazUru fI 'l-juzuri
  96. min tilka 'l-dajAjaTi fI 'l-dajAji!} wa-'ini
  97. istasmana \uc{'a}bU 'l-\uc{h}u_dayli ^say'aN mina
  98. 'l-.tayri wa-'l-bahA'imi, qAla: \enquote{lA wa-'l-l_ahi
  99. wa-lA tilka 'l-dajAjaTu!} wa-'in _dakarUA `u_dUbaTa
  100. 'l-^sa.hmi, qAla: \enquote{`u_dUbaTu 'l-^sa.hmi fI
  101. 'l-baqari wa-'l-ba.t.ti wa-bu.tUni 'l-samaki
  102. wa-'l-dajAji, wa-lA siyyamA _d_alika 'l-jinsu mina
  103. 'l-dajAji.} wa-'in _dakarUA mIlAda ^say'iN 'aw qudUma
  104. 'insAniN, qAla: \enquote{kAna _d_alika ba`da 'an
  105. 'ahdaytu-hA la-ka bi-sanaTiN, wa-mA kAna bayna qudUmi
  106. fulAniN wa-bayna 'l-ba`_taTi bi-tilka 'l-dajAjaTi
  107. 'illA yawmuN.} wa-kAnat ma_ta\-laN fI kulli ^say'iN
  108. wa-tArI_haN fI kulli ^say'iN.
  109. \end{arab}
  110. \bigskip
  111. \begin{arab}[trans]
  112. \uc{al-jA.hi.zu}, \aemph{\uc{k}itAbu 'l-\uc{b}u_halA'i}
  113. \end{arab}
  114. \end{arabexport}
  115. \end{filecontents*}
  116. \documentclass[12pt]{article}
  117. \usepackage[fullvoc,export=false]{arabluatex}
  118. \SetArbEasy
  119. \usepackage{csquotes}
  120. \DeclareQuoteStyle{arabic}
  121. {\textquotedblright}{\textquotedblleft}
  122. {\textquoteright}{\textquoteleft}
  123. \PassOptionsToPackage{pdfa}{hyperref}
  124. \usepackage{hyperxmp}
  125. \usepackage{hyperref}
  126. \hypersetup{colorlinks, linkcolor=blue, pdfauthor={Robert
  127. Alessi}}
  128. \title{\large Exporting Unicode Arabic to an external
  129. .tex source file}
  130. \author{}
  131. \date{}
  132. \usepackage{xcolor}
  133. \usepackage[outputdir=TMP]{minted}
  134. \definecolor{bg}{rgb}{0.95,0.95,0.95}
  135. \usepackage{ccicons}
  136. \usepackage{paralist}
  137. % \renewcommand{\txarb}[1]{#1}
  138. % \renewcommand{\txtrans}[1]{\emph{#1}}
  139. % \renewcommand{\aemph}[1]{#1}
  140. % \renewcommand{\arbup}[1]{\textsuperscript{#1}}
  141. \begin{document}
  142. \vspace*{-.5in}
  143. \noindent
  144. \textbf{\textsf{arabluatex sample file}} --- \cczero\ This
  145. file is public domain
  146. \begin{compactenum}
  147. \item Copy the source code below, paste it into your
  148. favorite tex editor and save it as
  149. \verb|exporting.tex|.
  150. \item In the preamble, set \verb|export=true| in
  151. \textsf{arabluatex} global options (line 3).
  152. \item Compile this file with Lua\LaTeX.
  153. \item Open \verb|exporting_out.tex| and compile it again
  154. with Lua\LaTeX.
  155. \item Open \verb|exporting_out_out.tex|, then:
  156. \begin{compactenum}
  157. \item In the preamble, set \verb|export=false| in
  158. \textsf{arabluatex} global options (line 3).
  159. \item Compile this file and see the resulting
  160. \verb|exporting_out_out.pdf|.
  161. \end{compactenum}
  162. \item Finally, uncomment in the preamble the four lines
  163. that are just above \verb|\begin{document}|.
  164. \item Open a terminal, then do:
  165. \begin{verbatim}
  166. pandoc exporting_out_out.tex -s -o exporting.odt
  167. \end{verbatim}
  168. and open the resulting \verb|exporting.odt| file with LibreOffice.
  169. \end{compactenum}
  170. \phantomsection
  171. \section*{Source code}
  172. \label{ref:source-begin}
  173. \inputminted[firstnumber=last, bgcolor=bg]{latex}%
  174. {TMP/exporting-preamble.tex}
  175. \begin{minted}[bgcolor=bg]{latex}
  176. \begin{document}
  177. \end{minted}
  178. \inputminted[firstnumber=last, bgcolor=bg]{latex}%
  179. {TMP/exporting-dajaja.tex}
  180. \begin{minted}[bgcolor=bg]{latex}
  181. \end{document}
  182. \end{minted}
  183. \label{ref:source-end}
  184. \end{document}