You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

95 lines
4.8 KiB

  1. <?php
  2. // Project: Web Reference Database (refbase) <http://www.refbase.net>
  3. // Copyright: Matthias Steffens <mailto:refbase@extracts.de> and the file's
  4. // original author(s).
  5. //
  6. // This code is distributed in the hope that it will be useful,
  7. // but WITHOUT ANY WARRANTY. Please see the GNU General Public
  8. // License for more details.
  9. //
  10. // File: ./includes/transtab_refbase_latex.inc.php
  11. // Repository: $HeadURL: file:///svn/p/refbase/code/branches/bleeding-edge/includes/transtab_refbase_latex.inc.php $
  12. // Author(s): Matthias Steffens <mailto:refbase@extracts.de>
  13. //
  14. // Created: 28-May-06, 17:01
  15. // Modified: $Date: 2008-10-30 17:19:48 +0000 (Thu, 30 Oct 2008) $
  16. // $Author: msteffens $
  17. // $Revision: 1288 $
  18. // Search & replace patterns for conversion from refbase markup to LaTeX markup & entities. Converts refbase fontshape markup (italic, bold) into
  19. // LaTeX commands of the 'textcomp' package, super- and subscript as well as greek letters get converted into the respective commands in math mode.
  20. // You may need to adopt the LaTeX markup to suit your individual needs.
  21. // Search & replace patterns must be specified as perl-style regular expression and search patterns must include the leading & trailing slashes.
  22. global $patternModifiers; // defined in 'transtab_unicode_charset.inc.php' and 'transtab_latin1_charset.inc.php'
  23. $transtab_refbase_latex = array(
  24. "/([{}])/" => '\\\\\\1', // escaping of curly brackets has to be done as the first action so that conversion is only applied to field contents and doesn't mess with the generated LaTeX code
  25. "/__(?!_)(.+?)__/" => '\\1', // underline is currently removed; instead, you could use '\\ul{\\1}' which requires '\usepackage{soul}'; the pattern for underline (__...__) must come before the one for italic (_..._)
  26. "/_(.+?)_/" => '\\textit{\\1}', // or use '\\it{\\1}'
  27. "/\\*\\*(.+?)\\*\\*/" => '\\textbf{\\1}', // or use '\\bf{\\1}'
  28. "/\\[super:(.+?)\\]/i" => '$^{\\1}$', // or use '\\textsuperscript{\\1}'
  29. "/\\[sub:(.+?)\\]/i" => '$_{\\1}$', // or use '\\textsubscript{\\1}' if defined in your package
  30. "/\\[permil\\]/" => '{\\textperthousand}',
  31. "/\\[infinity\\]/" => '$\\infty$',
  32. "/\\[alpha\\]/" => '$\\alpha$',
  33. "/\\[beta\\]/" => '$\\beta$',
  34. "/\\[gamma\\]/" => '$\\gamma$',
  35. "/\\[delta\\]/" => '$\\delta$',
  36. "/\\[epsilon\\]/" => '$\\epsilon$',
  37. "/\\[zeta\\]/" => '$\\zeta$',
  38. "/\\[eta\\]/" => '$\\eta$',
  39. "/\\[theta\\]/" => '$\\theta$',
  40. "/\\[iota\\]/" => '$\\iota$',
  41. "/\\[kappa\\]/" => '$\\kappa$',
  42. "/\\[lambda\\]/" => '$\\lambda$',
  43. "/\\[mu\\]/" => '$\\mu$',
  44. "/\\[nu\\]/" => '$\\nu$',
  45. "/\\[xi\\]/" => '$\\xi$',
  46. "/\\[omicron\\]/" => '$o$',
  47. "/\\[pi\\]/" => '$\\pi$',
  48. "/\\[rho\\]/" => '$\\rho$',
  49. "/\\[sigmaf\\]/" => '$\\varsigma$',
  50. "/\\[sigma\\]/" => '$\\sigma$',
  51. "/\\[tau\\]/" => '$\\tau$',
  52. "/\\[upsilon\\]/" => '$\\upsilon$',
  53. "/\\[phi\\]/" => '$\\phi$',
  54. "/\\[chi\\]/" => '$\\chi$',
  55. "/\\[psi\\]/" => '$\\psi$',
  56. "/\\[omega\\]/" => '$\\omega$',
  57. "/\\[Alpha\\]/" => '$A$',
  58. "/\\[Beta\\]/" => '$B$',
  59. "/\\[Gamma\\]/" => '$\\Gamma$',
  60. "/\\[Delta\\]/" => '$\\Delta$',
  61. "/\\[Epsilon\\]/" => '$E$',
  62. "/\\[Zeta\\]/" => '$Z$',
  63. "/\\[Eta\\]/" => '$H$',
  64. "/\\[Theta\\]/" => '$\\Theta$',
  65. "/\\[Iota\\]/" => '$I$',
  66. "/\\[Kappa\\]/" => '$K$',
  67. "/\\[Lambda\\]/" => '$\\Lambda$',
  68. "/\\[Mu\\]/" => '$M$',
  69. "/\\[Nu\\]/" => '$N$',
  70. "/\\[Xi\\]/" => '$\\Xi$',
  71. "/\\[Omicron\\]/" => '$O$',
  72. "/\\[Pi\\]/" => '$\\Pi$',
  73. "/\\[Rho\\]/" => '$R$',
  74. "/\\[Sigma\\]/" => '$\\Sigma$',
  75. "/\\[Tau\\]/" => '$T$',
  76. "/\\[Upsilon\\]/" => '$\\Upsilon$',
  77. "/\\[Phi\\]/" => '$\\Phi$',
  78. "/\\[Chi\\]/" => '$X$',
  79. "/\\[Psi\\]/" => '$\\Psi$',
  80. "/\\[Omega\\]/" => '$\\Omega$',
  81. "/\"(.+?)\"/" => '{\\textquotedblleft}\\1{\\textquotedblright}',
  82. "/ +- +/" => " -- ",
  83. // "/�/$patternModifiers" => "--"
  84. // Note that for UTF-8 based systems, '$patternModifiers' contains the "u" (PCRE_UTF8) pattern modifier which should cause PHP/PCRE
  85. // to treat pattern strings as UTF-8 (otherwise this conversion pattern would garble UTF-8 characters such as "�"). However, the
  86. // "�" character still seems to cause PREG compilation errors on some UTF8-based systems, which is why the line has been commented
  87. // out (it should work fine for a latin1-based system, though).
  88. );
  89. ?>