Mercurial > hg > octave-lyh
annotate scripts/java/org/octave/TeXtranslator.java @ 15753:6e39fe7992d9
style fixes and copyright update for java files
* ClassHelper.java, DlgListener.java, JDialogBox.java,
Matrix.java, OctClassLoader.java, Octave.java, OctaveReference.java,
TeXcode.java, TeXtranslator.java:
Use Octave copyright text. Style fixes.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Sat, 08 Dec 2012 00:24:45 -0500 |
parents | acf0addfc610 |
children |
rev | line source |
---|---|
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
1 /* |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
2 |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
3 Copyright (C) 2010 Martin Hepperle |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
4 |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
5 This file is part of Octave. |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
6 |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
7 Octave is free software; you can redistribute it and/or modify it |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
8 under the terms of the GNU General Public License as published by |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
9 the Free Software Foundation; either version 3 of the License, or (at |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
10 your option) any later version. |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
11 |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
12 Octave is distributed in the hope that it will be useful, but |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
13 WITHOUT ANY WARRANTY; without even the implied warranty of |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
15 General Public License for more details. |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
16 |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
17 You should have received a copy of the GNU General Public License |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
18 along with Octave; see the file COPYING. If not, see |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
19 <http://www.gnu.org/licenses/>. |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
20 |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
21 */ |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
22 |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
23 // A primitive TeX character translator. Provides methods to translate |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
24 // a subset of TeX symbol strings into their aequivalent Unicode |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
25 // representation. |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
26 // |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
27 // Note that not all Unicode character sets contain all these characters. |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
28 // Suitable Windows fonts are e.g.: |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
29 // - Lucida Sans Unicode |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
30 // - Arial Unicode MS |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
31 // - MS Mincho |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
32 |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
33 package org.octave; |
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
34 |
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
35 public class TeXtranslator |
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
36 { |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
37 private TeXcode m_texTable[] = |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
38 { |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
39 // lower case |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
40 new TeXcode ("alpha", '\u03B1'), |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
41 new TeXcode ("beta", '\u03B2'), |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
42 new TeXcode ("gamma", '\u03B3'), |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
43 new TeXcode ("delta", '\u03B4'), |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
44 new TeXcode ("epsilon", '\u03B5'), |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
45 new TeXcode ("zeta", '\u03B6'), |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
46 new TeXcode ("eta", '\u03B7'), |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
47 new TeXcode ("theta", '\u03B8'), |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
48 new TeXcode ("vartheta", '\u03D1'), |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
49 new TeXcode ("iota", '\u03B9'), |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
50 new TeXcode ("kappa", '\u03BA'), |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
51 new TeXcode ("lambda", '\u03BB'), |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
52 new TeXcode ("mu", '\u03BC'), |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
53 new TeXcode ("nu", '\u03BD'), |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
54 new TeXcode ("xi", '\u03BE'), |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
55 new TeXcode ("pi", '\u03C0'), |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
56 new TeXcode ("rho", '\u03C1'), |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
57 new TeXcode ("sigma", '\u03C3'), |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
58 new TeXcode ("varsigma", '\u03C2'), |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
59 new TeXcode ("tau", '\u03C4'), |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
60 new TeXcode ("phi", '\u03C6'), |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
61 new TeXcode ("chi", '\u03C7'), |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
62 new TeXcode ("psi", '\u03C8'), |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
63 new TeXcode ("omega", '\u03C9'), |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
64 new TeXcode ("upsilon", '\u03C5'), |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
65 // upper case |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
66 new TeXcode ("Gamma", '\u0393'), |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
67 new TeXcode ("Delta", '\u0394'), |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
68 new TeXcode ("Theta", '\u0398'), |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
69 new TeXcode ("Lambda", '\u039B'), |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
70 new TeXcode ("Pi", '\u03A0'), |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
71 new TeXcode ("Xi", '\u039E'), |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
72 new TeXcode ("Sigma", '\u03A3'), |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
73 new TeXcode ("Upsilon", '\u03A5'), |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
74 new TeXcode ("Phi", '\u03A6'), |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
75 new TeXcode ("Psi", '\u03A8'), |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
76 new TeXcode ("Omega", '\u03A9'), |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
77 // complex |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
78 new TeXcode ("Im", '\u2111'), |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
79 new TeXcode ("Re", '\u211c'), |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
80 // special |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
81 new TeXcode ("leq", '\u2264'), |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
82 new TeXcode ("geq", '\u2265'), |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
83 new TeXcode ("neq", '\u2260'), |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
84 new TeXcode ("pm", '\u00B1'), |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
85 new TeXcode ("infty", '\u221E'), |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
86 new TeXcode ("partial", '\u2202'), |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
87 new TeXcode ("approx", '\u2248'), |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
88 new TeXcode ("circ", '\u2218'), |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
89 new TeXcode ("bullet", '\u2022'), |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
90 new TeXcode ("times", '\u00D7'), |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
91 new TeXcode ("sim", '\u007E'), |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
92 new TeXcode ("nabla", '\u2207'), |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
93 new TeXcode ("ldots", '\u2026'), |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
94 new TeXcode ("exists", '\u2203'), |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
95 new TeXcode ("neg", '\u00AC'), |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
96 new TeXcode ("aleph", '\u2135'), |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
97 new TeXcode ("forall", '\u2200'), |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
98 new TeXcode ("cong", '\u2245'), |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
99 new TeXcode ("wp", '\u2118'), |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
100 new TeXcode ("propto", '\u221D'), |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
101 new TeXcode ("otimes", '\u2297'), |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
102 new TeXcode ("oplus", '\u2295'), |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
103 new TeXcode ("oslash", '\u2298'), |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
104 new TeXcode ("cap", '\u2229'), |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
105 new TeXcode ("cup", '\u222A'), |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
106 new TeXcode ("ni", '\u220B'), |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
107 new TeXcode ("in", '\u2208'), |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
108 new TeXcode ("div", '\u00F7'), |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
109 new TeXcode ("equiv", '\u2261'), |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
110 new TeXcode ("int", '\u222B'), |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
111 new TeXcode ("perp", '\u22A5'), |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
112 new TeXcode ("wedge", '\u2227'), |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
113 new TeXcode ("vee", '\u2228'), |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
114 // sets |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
115 new TeXcode ("supseteq", '\u2287'), |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
116 new TeXcode ("supset", '\u2283'), |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
117 new TeXcode ("subseteq", '\u2286'), |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
118 new TeXcode ("subset", '\u2282'), |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
119 // cards |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
120 new TeXcode ("clubsuit", '\u2663'), |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
121 new TeXcode ("spadesuit", '\u2660'), |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
122 new TeXcode ("heartsuit", '\u2665'), |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
123 new TeXcode ("diamondsuit", '\u2666'), |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
124 new TeXcode ("copyright", '\u00A9'), |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
125 // arrows |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
126 new TeXcode ("leftarrow", '\u2190'), |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
127 new TeXcode ("uparrow", '\u2191'), |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
128 new TeXcode ("rightarrow", '\u2192'), |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
129 new TeXcode ("downarrow", '\u2193'), |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
130 new TeXcode ("leftrightarrow", '\u2194'), |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
131 new TeXcode ("updownarrow", '\u2195'), |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
132 }; |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
133 |
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
134 public TeXtranslator () |
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
135 { |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
136 /* DEBUG: output table to file |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
137 try |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
138 { |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
139 java.io.PrintWriter pwTeX = new java.io.PrintWriter ("z:/tex.txt", "UTF-8"); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
140 java.io.PrintWriter pwHTML = new java.io.PrintWriter ("z:/html.txt", "UTF-8"); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
141 java.io.PrintWriter pwOctave = new java.io.PrintWriter ("z:/octave.txt", "UTF-8"); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
142 pwOctave.print ("msgbox ( ["); |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
143 int i = 0; |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
144 for (int k = 0; k < m_texTable.length; k++) |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
145 { |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
146 if (i++ == 0) |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
147 { |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
148 pwTeX.print ("@item "); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
149 pwHTML.print ("@item "); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
150 pwOctave.print (" '"); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
151 } |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
152 else |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
153 { |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
154 pwTeX.print ("@tab "); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
155 pwHTML.print ("@tab "); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
156 pwOctave.print (" "); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
157 } |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
158 pwTeX.println ("\\" + m_texTable[k].tex); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
159 pwTeX.println ("@tab '@math{\\" + m_texTable[k].tex + "}'"); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
160 pwHTML.println ("\\" + m_texTable[k].tex); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
161 pwHTML.println ("@tab '" + m_texTable[k].ucode + "'"); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
162 pwOctave.print ("\\\\" + m_texTable[k].tex+" "); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
163 pwOctave.print (" = ''\\" + m_texTable[k].tex + " ''"); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
164 if (i == 3) |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
165 { |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
166 pwTeX.println ("@c ----------"); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
167 pwHTML.println ("@c ----------"); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
168 pwOctave.println ("', 10, ..."); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
169 i=0; |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
170 } |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
171 else |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
172 { |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
173 pwTeX.println ("@tab"); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
174 pwHTML.println ("@tab"); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
175 pwOctave.print (" "); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
176 } |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
177 } |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
178 pwOctave.print ("']);"); |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
179 pwTeX.close (); |
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
180 pwHTML.close (); |
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
181 pwOctave.close (); |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
182 } |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
183 catch (Exception e) |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
184 { |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
185 ; |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
186 } |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
187 /* */ |
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
188 } |
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
189 |
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
190 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
191 /* |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
192 NOT YET TRANSLATED |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
193 o |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
194 rfloor |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
195 lceil |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
196 lfloor |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
197 cdot |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
198 prime |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
199 0 |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
200 rceil |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
201 surd |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
202 mid |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
203 varpi |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
204 langle |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
205 rangle |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
206 */ |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
207 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
208 public String replace (String s) |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
209 { |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
210 StringBuffer sb = new StringBuffer (s); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
211 // append trailing blank |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
212 sb.append (' '); |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
213 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
214 int i = 0; |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
215 do |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
216 { |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
217 // 26 08 2010 MH szatt search at index i |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
218 i = sb.indexOf ("\\", i); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
219 if (i > -1) |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
220 { |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
221 int j = sb.indexOf (" ", i); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
222 if (j > i) |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
223 { |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
224 String token = sb.substring (i + 1, j); |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
225 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
226 for (int k = 0; k < m_texTable.length; k++) |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
227 { |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
228 if (m_texTable[k].tex.equals (token)) |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
229 { |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
230 sb.replace (i, j + 1, |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
231 Character.toString (m_texTable[k].ucode)); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
232 break; |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
233 } |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
234 } |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
235 if (sb.charAt (i) == '\\') |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
236 { |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
237 // backslash sztill there: not found |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
238 if (sb.charAt (i + 1) == 'n') |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
239 { |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
240 // newline |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
241 sb.replace (i, i + 2, "\n"); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
242 } |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
243 else if (sb.charAt (i + 1) == '\\') |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
244 { |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
245 // backslash |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
246 sb.replace (i, i + 2, "\\"); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
247 } |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
248 } |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
249 |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
250 // 26 08 2010 MH |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
251 // advance i to avoid deadlock in case of incorrect escape |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
252 // sequences like \\\\alpha (double backslash) or |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
253 // \\bogus (unknown escape sequence) |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
254 i++; |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
255 } |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
256 } |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
257 } |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
258 while (i > -1); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
259 // finall: remove trailing blank |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
260 return (sb.substring (0, sb.length () - 1).toString ()); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
261 } |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
262 } |