tioga 1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Tioga_README +372 -0
- data/lgpl.txt +504 -0
- data/split/Dtable/defs.h +33 -0
- data/split/Dtable/dtable.c +1928 -0
- data/split/Dtable/dtable_intern.h +144 -0
- data/split/Dtable/dvector.h +61 -0
- data/split/Dtable/extconf.rb +4 -0
- data/split/Dtable/include/dtable.h +35 -0
- data/split/Dtable/lib/Dtable_extras.rb +90 -0
- data/split/Dtable/namespace.h +47 -0
- data/split/Dtable/safe_double.h +104 -0
- data/split/Dtable/symbols.c +92 -0
- data/split/Dtable/symbols.h +52 -0
- data/split/Dvector/defs.h +33 -0
- data/split/Dvector/dvector.c +5486 -0
- data/split/Dvector/dvector_intern.h +142 -0
- data/split/Dvector/extconf.rb +4 -0
- data/split/Dvector/include/dvector.h +61 -0
- data/split/Dvector/lib/Dvector_extras.rb +328 -0
- data/split/Dvector/lib/Numeric_extras.rb +134 -0
- data/split/Dvector/namespace.h +47 -0
- data/split/Dvector/safe_double.h +104 -0
- data/split/Dvector/symbols.c +92 -0
- data/split/Dvector/symbols.h +52 -0
- data/split/Flate/defs.h +33 -0
- data/split/Flate/extconf.rb +19 -0
- data/split/Flate/flate.c +156 -0
- data/split/Flate/flate_intern.h +97 -0
- data/split/Flate/include/flate.h +98 -0
- data/split/Flate/namespace.h +47 -0
- data/split/Flate/safe_double.h +104 -0
- data/split/Flate/symbols.c +92 -0
- data/split/Flate/symbols.h +52 -0
- data/split/Function/defs.h +33 -0
- data/split/Function/dvector.h +61 -0
- data/split/Function/extconf.rb +4 -0
- data/split/Function/function.c +988 -0
- data/split/Function/joint_qsort.c +258 -0
- data/split/Function/lib/Function_extras.rb +44 -0
- data/split/Function/namespace.h +47 -0
- data/split/Function/safe_double.h +104 -0
- data/split/Function/symbols.c +92 -0
- data/split/Function/symbols.h +52 -0
- data/split/Tioga/axes.c +774 -0
- data/split/Tioga/defs.h +33 -0
- data/split/Tioga/dtable.h +35 -0
- data/split/Tioga/dvector.h +61 -0
- data/split/Tioga/extconf.rb +4 -0
- data/split/Tioga/figures.c +672 -0
- data/split/Tioga/figures.h +855 -0
- data/split/Tioga/flate.h +98 -0
- data/split/Tioga/init.c +524 -0
- data/split/Tioga/lib/Arcs_and_Circles.rb +64 -0
- data/split/Tioga/lib/ColorConstants.rb +274 -0
- data/split/Tioga/lib/Colorbars.rb +10 -0
- data/split/Tioga/lib/Colormaps.rb +105 -0
- data/split/Tioga/lib/Coordinate_Conversions.rb +194 -0
- data/split/Tioga/lib/Creating_Paths.rb +94 -0
- data/split/Tioga/lib/Doc.rb +91 -0
- data/split/Tioga/lib/Executive.rb +515 -0
- data/split/Tioga/lib/FigMkr.rb +2224 -0
- data/split/Tioga/lib/FigureConstants.rb +125 -0
- data/split/Tioga/lib/Figures_and_Plots.rb +268 -0
- data/split/Tioga/lib/Images.rb +278 -0
- data/split/Tioga/lib/Legends.rb +190 -0
- data/split/Tioga/lib/MarkerConstants.rb +122 -0
- data/split/Tioga/lib/Markers.rb +129 -0
- data/split/Tioga/lib/Page_Frame_Bounds.rb +567 -0
- data/split/Tioga/lib/Rectangles.rb +94 -0
- data/split/Tioga/lib/Shading.rb +100 -0
- data/split/Tioga/lib/Special_Paths.rb +307 -0
- data/split/Tioga/lib/Strokes.rb +129 -0
- data/split/Tioga/lib/TeX_Text.rb +454 -0
- data/split/Tioga/lib/TexPreamble.rb +358 -0
- data/split/Tioga/lib/Titles_and_Labels.rb +306 -0
- data/split/Tioga/lib/Transparency.rb +89 -0
- data/split/Tioga/lib/Using_Paths.rb +164 -0
- data/split/Tioga/lib/Utils.rb +74 -0
- data/split/Tioga/lib/X_and_Y_Axes.rb +749 -0
- data/split/Tioga/lib/irb_tioga.rb +122 -0
- data/split/Tioga/lib/tioga.rb +1 -0
- data/split/Tioga/lib/tioga_ui.rb +5 -0
- data/split/Tioga/lib/tioga_ui_cmds.rb +793 -0
- data/split/Tioga/makers.c +989 -0
- data/split/Tioga/mk_tioga_sty.rb +53 -0
- data/split/Tioga/namespace.h +47 -0
- data/split/Tioga/pdf_font_dicts.c +18253 -0
- data/split/Tioga/pdfcolor.c +486 -0
- data/split/Tioga/pdfcoords.c +505 -0
- data/split/Tioga/pdffile.c +342 -0
- data/split/Tioga/pdfimage.c +536 -0
- data/split/Tioga/pdfpath.c +914 -0
- data/split/Tioga/pdfs.h +229 -0
- data/split/Tioga/pdftext.c +443 -0
- data/split/Tioga/safe_double.h +104 -0
- data/split/Tioga/symbols.c +92 -0
- data/split/Tioga/symbols.h +52 -0
- data/split/Tioga/texout.c +380 -0
- data/split/defs.h +33 -0
- data/split/extconf.rb +107 -0
- data/split/mkmf2.rb +1612 -0
- data/split/namespace.h +47 -0
- data/split/safe_double.h +104 -0
- data/split/scripts/tioga +4 -0
- data/split/symbols.c +92 -0
- data/split/symbols.h +52 -0
- data/tests/dtable_test.data +6 -0
- data/tests/dvector_read_test.data +1 -0
- data/tests/dvector_test.data +101 -0
- data/tests/tc_Dtable.rb +221 -0
- data/tests/tc_Dvector.rb +791 -0
- data/tests/tc_FMkr.rb +162 -0
- data/tests/tc_Flate.rb +45 -0
- data/tests/tc_Function.rb +111 -0
- data/tests/ts_Tioga.rb +38 -0
- metadata +163 -0
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
# Strokes.rb
|
|
2
|
+
|
|
3
|
+
module Tioga
|
|
4
|
+
|
|
5
|
+
# These are the attributes for doing stroked lines in PDF graphics.
|
|
6
|
+
# The methods for strokes include #stroke, stroke_line, stroke_rect, stroke_frame, stroke_circle, stroke_oval, and stroke_polyline.
|
|
7
|
+
|
|
8
|
+
class Strokes < Doc < FigureMaker
|
|
9
|
+
|
|
10
|
+
# Calls move_to_point, append_point_to_path, and #stroke.
|
|
11
|
+
def stroke_line(x0, y0, x1, y1)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
# :call-seq:
|
|
15
|
+
# miter_limit
|
|
16
|
+
# miter_limit = a_float
|
|
17
|
+
#
|
|
18
|
+
# Sets a maximum for the ratio of the miter length to the line width (default is 2). When the limit is
|
|
19
|
+
# exceeded, the line join is converted from a miter to a bevel. This limit
|
|
20
|
+
# is needed since when two line segments meet at a sharp angle and mitered joins have been
|
|
21
|
+
# specified as the line_join, it is possible for the miter to extend far beyond the
|
|
22
|
+
# thickness of the line stroking the path.
|
|
23
|
+
def miter_limit
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
# :call-seq:
|
|
27
|
+
# default_line_scale
|
|
28
|
+
# default_line_scale = a_float
|
|
29
|
+
#
|
|
30
|
+
# Scaling factor for the width of stroked lines (default is 1). The #stroke operations produce lines with
|
|
31
|
+
# a width determined by the product of the line_width times the default_line_scale.
|
|
32
|
+
def default_line_scale
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
# :call-seq:
|
|
36
|
+
# line_width
|
|
37
|
+
# line_width = a_float
|
|
38
|
+
#
|
|
39
|
+
# The width of stroked lines. A line width of 0 denotes the thinnest line that can be rendered at device
|
|
40
|
+
# resolution: 1 device pixel wide. However, some devices cannot reproduce 1-pixel lines, and on high-resolution
|
|
41
|
+
# devices, they are nearly invisible. Since the results of rendering such "zero-width" lines are device-dependent,
|
|
42
|
+
# their use is not recommended. The actual line width is adjusted according to the current value
|
|
43
|
+
# of the default_line_scale.
|
|
44
|
+
def line_width
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
# :call-seq:
|
|
48
|
+
# stroke_width
|
|
49
|
+
# stroke_width = a_float
|
|
50
|
+
#
|
|
51
|
+
# Alias for line_width.
|
|
52
|
+
def stroke_width
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
# :call-seq:
|
|
56
|
+
# line_cap
|
|
57
|
+
# line_cap = a_line_cap
|
|
58
|
+
#
|
|
59
|
+
# The line cap style specifies the shape to be used at the ends of open subpaths (and
|
|
60
|
+
# dashes, if any) when they are stroked. Valid values are the predefined
|
|
61
|
+
# constants: +LINE_CAP_BUTT+, +LINE_CAP_ROUND+, and +LINE_CAP_SQUARE+. For +LINE_CAP_BUTT+, the
|
|
62
|
+
# stroke is squared off at the endpoint of the path. There is no projection beyond the end of the path.
|
|
63
|
+
# For +LINE_CAP_ROUND+, a semicircular arc with a diameter equal to the line width is drawn around the endpoint and filled in.
|
|
64
|
+
# For +LINE_CAP_SQUARE+, the stroke continues beyond the endpoint of the path for a distance equal to half the
|
|
65
|
+
# line width and is then squared off. See also line_join.
|
|
66
|
+
#
|
|
67
|
+
# http://theory.kitp.ucsb.edu/~paxton/tioga_jpegs/Caps_and_Joins.jpg
|
|
68
|
+
def line_cap
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
# :call-seq:
|
|
72
|
+
# line_join
|
|
73
|
+
# line_join = a_line_join
|
|
74
|
+
#
|
|
75
|
+
# The line join style specifies the shape to be used at the corners of paths that are
|
|
76
|
+
# stroked. Join styles are significant only at points where consecutive segments of a
|
|
77
|
+
# path connect at an angle; segments that meet or intersect fortuitously receive no special
|
|
78
|
+
# treatment. Valid values are the predefined constants: +LINE_JOIN_MITER+, +LINE_JOIN_ROUND+,
|
|
79
|
+
# and +LINE_JOIN_BEVEL+. For +LINE_JOIN_MITER+, the outer edges of the strokes for the two
|
|
80
|
+
# segments are extended until they meet at an angle, as in a picture frame. If the segments
|
|
81
|
+
# meet at too sharp an angle (as defined by the miter limit parameter), a bevel join is used
|
|
82
|
+
# instead. For +LINE_JOIN_ROUND+, an arc of a circle with a diameter equal to the line width
|
|
83
|
+
# is drawn around the point where the two segments meet, connecting the outer edges of the
|
|
84
|
+
# strokes for the two segments. This pieslice-shaped figure is filled in, producing a rounded
|
|
85
|
+
# corner. For +LINE_JOIN_BEVEL+, the two segments are finished with butt caps and the resulting
|
|
86
|
+
# notch beyond the ends of the segments is filled with a triangle. See also line_cap.
|
|
87
|
+
def line_join
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
# :call-seq:
|
|
91
|
+
# line_type
|
|
92
|
+
# line_type = a_line_type
|
|
93
|
+
#
|
|
94
|
+
# The line type controls the pattern of dashes and gaps used to stroke paths.
|
|
95
|
+
# It is specified by a dash array and a dash phase. The dash array's elements are
|
|
96
|
+
# numbers that specify the lengths of alternating dashes and gaps; the dash phase
|
|
97
|
+
# specifies the distance into the dash pattern at which to start the dash. The elements
|
|
98
|
+
# of both the dash array and the dash phase are expressed in user space units.
|
|
99
|
+
# An empty dash array and zero phase can be used to set
|
|
100
|
+
# the dash pattern to a solid line.
|
|
101
|
+
#
|
|
102
|
+
# Dashed lines wrap around curves and corners just as solid stroked lines do. The
|
|
103
|
+
# ends of each dash are treated with the current line cap style, and corners within
|
|
104
|
+
# dashes are treated with the current line join style. A stroking operation takes no
|
|
105
|
+
# measures to coordinate the dash pattern with features of the path; it simply dispenses
|
|
106
|
+
# dashes and gaps along the path in the pattern defined by the dash array.
|
|
107
|
+
#
|
|
108
|
+
# When a path consisting of several subpaths is stroked, each subpath is treated independently --
|
|
109
|
+
# that is, the dash pattern is restarted and the dash phase is reapplied
|
|
110
|
+
# to it at the beginning of each subpath.
|
|
111
|
+
# http://theory.kitp.ucsb.edu/~paxton/tioga_jpegs/Line_Types.jpg
|
|
112
|
+
def line_type
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
# Adjust default_line_scale by multiplying it by the given _scale_ and adjust the current line_width accordingly.
|
|
117
|
+
def rescale_lines(scale)
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
# Calls #context, then, inside the new context, changes line_type and stroke_color (if those arguments are not +nil+),
|
|
121
|
+
# calls append_points_with_gaps_to_path, calls #stroke, and then saves the legend information (if _legend_
|
|
122
|
+
# is not +nil+). Alias for show_polyline.
|
|
123
|
+
def stroke_polyline(xs, ys, color = nil, legend = nil, type = nil, gaps = nil, close_subpaths = nil)
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
end # class
|
|
129
|
+
end # module Tioga
|
|
@@ -0,0 +1,454 @@
|
|
|
1
|
+
# TeX_Text.rb
|
|
2
|
+
|
|
3
|
+
module Tioga
|
|
4
|
+
=begin rdoc
|
|
5
|
+
|
|
6
|
+
Text in tioga goes to TeX for typesetting: you aren't using a partial emulation that is sort-of-like TeX, you are
|
|
7
|
+
using the real thing.
|
|
8
|
+
|
|
9
|
+
Since text strings in tioga are passed directly to TeX, you can basically do anything in the text of figures that
|
|
10
|
+
you can do with text in TeX. The text string can include embedded commands to change font size, family, or whatever.
|
|
11
|
+
However, more commonly the text string will leave the font selection to a higher level in the document.
|
|
12
|
+
In tioga it is easy for you to use the "NFSS", TeX's "New Font Selection Scheme" that specifies
|
|
13
|
+
the font by independently setting family, series, shape, and size. Families include roman, sans serif, and typewriter.
|
|
14
|
+
Series include medium and bold face. Shapes include upright, italic, slant, and small caps. All these, and the size, are
|
|
15
|
+
set in the SetTiogaFontInfo command in the TeX file preamble. The tioga defaults for size, family, series, and shape are
|
|
16
|
+
10 point roman, medium, and upright. You can change these by means of the attributes
|
|
17
|
+
tex_fontfamily, tex_fontseries, tex_fontshape, and tex_fontsize. Just like for
|
|
18
|
+
the tex_preview page and figure sizes, these are given as strings to be copied to the TeX preview file as part
|
|
19
|
+
of the SetTiogaFontInfo definition.
|
|
20
|
+
|
|
21
|
+
Text is
|
|
22
|
+
sized by giving a scale factor relative to a base size. The base size is given by the attribute default_font_size,
|
|
23
|
+
that is initialized to 10 and can be changed using set_default_font_size. The scale factor is called default_text_scale, is
|
|
24
|
+
initialized to 1.0, and is changed by rescale_text. When you do a show_text command in tioga, the call can include an additional scale factor.
|
|
25
|
+
The product of this extra factor times the default_text_scale times the default_font_size determines the size
|
|
26
|
+
in big points on the output page. At least that's the size the text will have if the output page doesn't get scaled up or down,
|
|
27
|
+
and the TeX document doesn't decide to change things! With text that is being passed to TeX for typesetting, the final
|
|
28
|
+
decisions aren't made until the last moment. See Page_Frame_Bounds for more details.
|
|
29
|
+
|
|
30
|
+
See Tutorial::TextForTeX for information about how to add packages and how (and how not) to enter text for TeX.
|
|
31
|
+
|
|
32
|
+
=end
|
|
33
|
+
|
|
34
|
+
class TeX_Text < Doc < FigureMaker
|
|
35
|
+
|
|
36
|
+
=begin rdoc
|
|
37
|
+
This routine takes care of text that is being sent to TeX for typesetting (see also show_marker
|
|
38
|
+
for text being used as graphics and sent directly to PDF).
|
|
39
|
+
|
|
40
|
+
The location of the reference point for the text can be given either in figure coordinates ('x' and 'y', or 'at')
|
|
41
|
+
or relative to an edge of the frame ('side', 'position', and 'shift').
|
|
42
|
+
|
|
43
|
+
You can optionally provide a color as an RGB triple which will be used in a 'textcolor' command for TeX
|
|
44
|
+
enclosing the rest of the text.
|
|
45
|
+
|
|
46
|
+
The text is scaled by the product of the 'scale' entry times the current value of the
|
|
47
|
+
default_text_scale attribute. It is rotated by the given 'angle'.
|
|
48
|
+
|
|
49
|
+
The reference point can be specified horizontally ('justification') and vertically ('alignment').
|
|
50
|
+
|
|
51
|
+
The 'text' to be sent to TeX can contain anything that TeX will let you put in a box. In addition to
|
|
52
|
+
the usual text and inline math, you can also do display math, lists, tables, etc.
|
|
53
|
+
|
|
54
|
+
You can even define your own commands in your TeX preamble and then use those commands as part of the text in
|
|
55
|
+
the figure.
|
|
56
|
+
|
|
57
|
+
NOTE: When entering text for TeX in your Ruby program, you'll generally want to use single quotes around the
|
|
58
|
+
string rather than double quotes. With single quotes, backslashes are treated as normal characters (except
|
|
59
|
+
for the two special cases of \' and \\), so TeX commands using backslashes don't cause trouble.
|
|
60
|
+
With double quotes, Ruby uses backslash for a variety of escape characters such as newline (\n) and tab (\t),
|
|
61
|
+
so the backslashes for TeX need to be entered as \\ pairs to be safe.
|
|
62
|
+
Compare '$\nu\sim\tau$' to the equivalent form "$\\\\nu\\\\sim\\\\tau$" and the incorrect form "$\nu\sim\tau$".
|
|
63
|
+
|
|
64
|
+
Dictionary Entries
|
|
65
|
+
'text' => a_string # to be processed by TeX
|
|
66
|
+
'side' => a_side # TOP, BOTTOM, LEFT, or RIGHT
|
|
67
|
+
'loc' # alias for 'side'
|
|
68
|
+
'position' => a_float # fractional distance along side from bottom left
|
|
69
|
+
'pos' # alias for 'position'
|
|
70
|
+
'shift' => a_float # distance away from side in units of text height
|
|
71
|
+
'at' => [ x, y ] # figure coordinates for text reference point
|
|
72
|
+
'point' # alias for 'at'
|
|
73
|
+
'x' => a_float # x location for reference point
|
|
74
|
+
'y' => a_float # y location for reference point
|
|
75
|
+
'color' => a_color # default is to omit color specification
|
|
76
|
+
'scale' => a_float # scale relative to default_text_scale. default 1
|
|
77
|
+
'angle' => a_float # degrees to rotate. default 0
|
|
78
|
+
'alignment' => an_alignment # see discussion of alignment
|
|
79
|
+
'justification' => a_justification # see discussion of justification
|
|
80
|
+
|
|
81
|
+
Examples
|
|
82
|
+
|
|
83
|
+
def math_typesetting
|
|
84
|
+
centerx = t.bounds_xmin + 0.5 * t.bounds_width
|
|
85
|
+
equation =
|
|
86
|
+
'\int_{-\infty}^{\infty} e^{\color{Red}-x^{2}}\, ' +
|
|
87
|
+
'\! dx = \color{Green}\sqrt{\pi}'
|
|
88
|
+
t.justification = CENTERED
|
|
89
|
+
t.rescale_text(0.8)
|
|
90
|
+
t.show_text(
|
|
91
|
+
'text'=>'Inline Math Mode',
|
|
92
|
+
'x'=>centerx,
|
|
93
|
+
'y' => t.bounds_ymin + 0.88 * t.bounds_height)
|
|
94
|
+
t.show_text(
|
|
95
|
+
'text'=>'Display Math Mode',
|
|
96
|
+
'x'=> centerx,
|
|
97
|
+
'y' => t.bounds_ymin + 0.46 * t.bounds_height)
|
|
98
|
+
t.rescale_text(0.8)
|
|
99
|
+
t.show_text(
|
|
100
|
+
'text'=>'$' + equation + '$',
|
|
101
|
+
'x'=> centerx,
|
|
102
|
+
'y' => t.bounds_ymin + 0.78 * t.bounds_height,
|
|
103
|
+
'scale'=>1.3)
|
|
104
|
+
t.show_text(
|
|
105
|
+
'text'=>'$' + equation + '$',
|
|
106
|
+
'x'=> centerx,
|
|
107
|
+
'y' => t.bounds_ymin + 0.64 * t.bounds_height,
|
|
108
|
+
'angle' => 10, 'scale'=>1.3)
|
|
109
|
+
equation = '\begin{displaymath}' + equation + '\end{displaymath}'
|
|
110
|
+
equation = '\parbox{15em}{' + equation + '}'
|
|
111
|
+
t.show_text(
|
|
112
|
+
'text'=>equation,
|
|
113
|
+
'x'=> centerx,
|
|
114
|
+
'y' => t.bounds_ymin + 0.33 * t.bounds_height,
|
|
115
|
+
'scale'=>1.3)
|
|
116
|
+
t.show_text(
|
|
117
|
+
'text'=>equation,
|
|
118
|
+
'x' => centerx,
|
|
119
|
+
'y' => t.bounds_ymin + 0.16 * t.bounds_height,
|
|
120
|
+
'angle' => 10,
|
|
121
|
+
'scale'=>1.3)
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
http://theory.kitp.ucsb.edu/~paxton/tioga_jpegs/Math_Typesetting.jpg
|
|
125
|
+
|
|
126
|
+
def strings
|
|
127
|
+
t.stroke_rect(0,0,1,1)
|
|
128
|
+
center_x = 0.5; center_y = 0.5; len = 0.125
|
|
129
|
+
hls = t.rgb_to_hls(Red)
|
|
130
|
+
angles = 10
|
|
131
|
+
delta = 360.0/angles
|
|
132
|
+
equation = '\int_{-\infty}^{\infty} \! e^{-x^{2}}\, \! dx = \sqrt{\pi}'
|
|
133
|
+
text =
|
|
134
|
+
'\parbox{15em}{\begin{displaymath}' +
|
|
135
|
+
equation + '\end{displaymath}}'
|
|
136
|
+
angles.times do |angle|
|
|
137
|
+
angle *= delta
|
|
138
|
+
dx = len*cos(angle*RADIANS_PER_DEGREE)
|
|
139
|
+
dy = len*sin(angle*RADIANS_PER_DEGREE)
|
|
140
|
+
x = center_x + 2*dx; y = center_y + 2*dy;
|
|
141
|
+
text_color = t.hls_to_rgb([angle/1.8 + 200, hls[1], hls[2]])
|
|
142
|
+
t.show_text('text' => text, 'color' => text_color, 'x' => x, 'y' => y,
|
|
143
|
+
'alignment' => ALIGNED_AT_MIDHEIGHT,
|
|
144
|
+
'scale' => 0.7, 'angle' => t.convert_to_degrees(dx,dy))
|
|
145
|
+
end
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
http://theory.kitp.ucsb.edu/~paxton/tioga_jpegs/Strings.jpg
|
|
149
|
+
|
|
150
|
+
def minipages
|
|
151
|
+
centerx = t.bounds_xmin + 0.5 * t.bounds_width
|
|
152
|
+
t.show_text(
|
|
153
|
+
'text' => 'Examples using paragraph boxes',
|
|
154
|
+
'x' => centerx,
|
|
155
|
+
'y' => 0.9)
|
|
156
|
+
t.rescale_text(0.5)
|
|
157
|
+
t.justification = CENTERED
|
|
158
|
+
str2 =
|
|
159
|
+
'The \textcolor{Red}{minipage} is a vertical alignment ' +
|
|
160
|
+
'environment with a \textcolor{Red}{specified width}. ' +
|
|
161
|
+
'It can contain paragraphs, lists, tables, ' +
|
|
162
|
+
'and equations. Hyphenation and formatting is automatic.'
|
|
163
|
+
str2 = '\parbox{15em}{' + str2 + '}'
|
|
164
|
+
t.show_text(
|
|
165
|
+
'text' => str2,
|
|
166
|
+
'x'=> centerx,
|
|
167
|
+
'y' => t.bounds_ymin + 0.68 * t.bounds_height)
|
|
168
|
+
t.show_text(
|
|
169
|
+
'text' => str2,
|
|
170
|
+
'x'=> centerx,
|
|
171
|
+
'y' => t.bounds_ymin + 0.30 * t.bounds_height, 'angle' => 20)
|
|
172
|
+
end
|
|
173
|
+
|
|
174
|
+
http://theory.kitp.ucsb.edu/~paxton/tioga_jpegs/Minipages.jpg
|
|
175
|
+
|
|
176
|
+
def framebox
|
|
177
|
+
centerx = t.bounds_xmin + 0.5 * t.bounds_width
|
|
178
|
+
t.justification = CENTERED
|
|
179
|
+
t.show_text(
|
|
180
|
+
'text' => 'Examples using \textbackslash framebox',
|
|
181
|
+
'x' => centerx, 'y' =>0.8)
|
|
182
|
+
dx = 0.05; y = 0.6; dy = -0.15; t.line_width = 0.7; t.stroke_color = Blue
|
|
183
|
+
t.rescale_text(0.75)
|
|
184
|
+
t.show_text(
|
|
185
|
+
'text' => '\framebox[20em][c]{\textbackslash framebox[20em][c]\{ a, b, c \}}',
|
|
186
|
+
'at' => [centerx, y])
|
|
187
|
+
y += dy
|
|
188
|
+
t.show_text(
|
|
189
|
+
'text' => '\framebox[20em][l]{\textbackslash framebox[20em][l]\{ a, b, c \}}',
|
|
190
|
+
'at' => [centerx, y])
|
|
191
|
+
y += dy
|
|
192
|
+
t.show_text(
|
|
193
|
+
'text' => '\framebox[20em][r]{\textbackslash framebox[20em][r]\{ a, b, c \}}',
|
|
194
|
+
'at' => [centerx, y])
|
|
195
|
+
y += dy
|
|
196
|
+
t.show_text(
|
|
197
|
+
'text' => '\framebox[20em][s]{\textbackslash framebox[20em][s]\{ a, b, c \}}',
|
|
198
|
+
'at' => [centerx, y])
|
|
199
|
+
end
|
|
200
|
+
|
|
201
|
+
http://theory.kitp.ucsb.edu/~paxton/tioga_jpegs/Framebox.jpg
|
|
202
|
+
|
|
203
|
+
=end
|
|
204
|
+
def show_text(dict)
|
|
205
|
+
end
|
|
206
|
+
|
|
207
|
+
# Changes the default_text_scale attribute by multiplying it times _scale_.
|
|
208
|
+
# This also updates the default_text_height_dx and default_text_height_dy
|
|
209
|
+
# attributes to match the new setting for default_text_scale.
|
|
210
|
+
# See also #rescale.
|
|
211
|
+
def rescale_text(scale)
|
|
212
|
+
end
|
|
213
|
+
|
|
214
|
+
# Calls check_label_clip with the location for the text reference point from the _dict_.
|
|
215
|
+
# If check_label_clip returns +false+, this routine simply returns. Otherwise, it passes
|
|
216
|
+
# the _dict_ to show_text.
|
|
217
|
+
def show_label(dict)
|
|
218
|
+
end
|
|
219
|
+
|
|
220
|
+
# Returns +true+ if the point given by the figure coordinates (_x_, _y_)
|
|
221
|
+
# is inside the current label clipping margins. The routine show_label
|
|
222
|
+
# uses this to filter out unwanted text by testing the reference point.
|
|
223
|
+
# If the point passes this test, then show_label calls show_text; otherwise,
|
|
224
|
+
# it simply returns without showing the text.
|
|
225
|
+
def check_label_clip(x, y)
|
|
226
|
+
end
|
|
227
|
+
|
|
228
|
+
# :call-seq:
|
|
229
|
+
# justification
|
|
230
|
+
# justification = a_justification
|
|
231
|
+
#
|
|
232
|
+
# Default for text horizontal justification. Valid settings are predefined
|
|
233
|
+
# constants: +LEFT_JUSTIFIED+, +CENTERED+, and +RIGHT_JUSTIFIED+.
|
|
234
|
+
# See also #alignment.
|
|
235
|
+
#
|
|
236
|
+
# http://theory.kitp.ucsb.edu/~paxton/tioga_jpegs/Text_J_and_A.jpg
|
|
237
|
+
def justification
|
|
238
|
+
end
|
|
239
|
+
|
|
240
|
+
# :call-seq:
|
|
241
|
+
# alignment
|
|
242
|
+
# alignment = an_alignment
|
|
243
|
+
#
|
|
244
|
+
# Default for text vertical alignment. Valid settings are predefined
|
|
245
|
+
# constants: +ALIGNED_AT_TOP+, +ALIGNED_AT_MIDHEIGHT+, +ALIGNED_AT_BASELINE+, and +ALIGNED_AT_BOTTOM+.
|
|
246
|
+
# See also #justification.
|
|
247
|
+
def alignment
|
|
248
|
+
end
|
|
249
|
+
|
|
250
|
+
# :call-seq:
|
|
251
|
+
# default_text_height_dx
|
|
252
|
+
#
|
|
253
|
+
# Height of text having the default_text_scale as measured in x figure coordinates.
|
|
254
|
+
def default_text_height_dx
|
|
255
|
+
end
|
|
256
|
+
|
|
257
|
+
# :call-seq:
|
|
258
|
+
# default_text_height_dy
|
|
259
|
+
#
|
|
260
|
+
# Height of text having the default_text_scale as measured in y figure coordinates.
|
|
261
|
+
def default_text_height_dy
|
|
262
|
+
end
|
|
263
|
+
|
|
264
|
+
# :call-seq:
|
|
265
|
+
# label_left_margin
|
|
266
|
+
# label_left_margin = a_float
|
|
267
|
+
#
|
|
268
|
+
# Size of margin on left of frame measured as a fraction of frame width, with positive values
|
|
269
|
+
# corresponding to margins on the inside of the frame, and negative values to margins on
|
|
270
|
+
# the outside.
|
|
271
|
+
# The show_label routine discards text having its reference point to the left of this position.
|
|
272
|
+
def label_left_margin
|
|
273
|
+
end
|
|
274
|
+
|
|
275
|
+
# :call-seq:
|
|
276
|
+
# label_right_margin
|
|
277
|
+
# label_right_margin = a_float
|
|
278
|
+
#
|
|
279
|
+
# Size of margin on right of frame measured as a fraction of frame width, with positive values
|
|
280
|
+
# corresponding to margins on the inside of the frame, and negative values to margins on
|
|
281
|
+
# the outside.
|
|
282
|
+
# The show_label routine discards text having its reference point to the right of this position.
|
|
283
|
+
def label_right_margin
|
|
284
|
+
end
|
|
285
|
+
|
|
286
|
+
# :call-seq:
|
|
287
|
+
# label_top_margin
|
|
288
|
+
# label_top_margin = a_float
|
|
289
|
+
#
|
|
290
|
+
# Size of margin on top of frame measured as a fraction of frame height, with positive values
|
|
291
|
+
# corresponding to margins on the inside of the frame, and negative values to margins on
|
|
292
|
+
# the outside.
|
|
293
|
+
# The show_label routine discards text having its reference point above this position.
|
|
294
|
+
def label_top_margin
|
|
295
|
+
end
|
|
296
|
+
|
|
297
|
+
# :call-seq:
|
|
298
|
+
# label_bottom_margin
|
|
299
|
+
# label_bottom_margin = a_float
|
|
300
|
+
#
|
|
301
|
+
# Size of margin on bottom of frame measured as a fraction of frame height, with positive values
|
|
302
|
+
# corresponding to margins on the inside of the frame, and negative values to margins on
|
|
303
|
+
# the outside.
|
|
304
|
+
# The show_label routine discards text having its reference point below this position.
|
|
305
|
+
def label_bottom_margin
|
|
306
|
+
end
|
|
307
|
+
|
|
308
|
+
# :call-seq:
|
|
309
|
+
# text_shift_on_left
|
|
310
|
+
# text_shift_on_left = a_float
|
|
311
|
+
#
|
|
312
|
+
# Default value for "shift" in show_text when "side" is +LEFT+.
|
|
313
|
+
def text_shift_on_left
|
|
314
|
+
end
|
|
315
|
+
|
|
316
|
+
# :call-seq:
|
|
317
|
+
# text_shift_on_right
|
|
318
|
+
# text_shift_on_right = a_float
|
|
319
|
+
#
|
|
320
|
+
# Default value for "shift" in show_text when "side" is +RIGHT+.
|
|
321
|
+
def text_shift_on_right
|
|
322
|
+
end
|
|
323
|
+
|
|
324
|
+
# :call-seq:
|
|
325
|
+
# text_shift_on_top
|
|
326
|
+
# text_shift_on_top = a_float
|
|
327
|
+
#
|
|
328
|
+
# Default value for "shift" in show_text when "side" is +TOP+.
|
|
329
|
+
def text_shift_on_top
|
|
330
|
+
end
|
|
331
|
+
|
|
332
|
+
# :call-seq:
|
|
333
|
+
# text_shift_on_bottom
|
|
334
|
+
# text_shift_on_bottom = a_float
|
|
335
|
+
#
|
|
336
|
+
# Default value for "shift" in show_text when "side" is +BOTTOM+.
|
|
337
|
+
def text_shift_on_bottom
|
|
338
|
+
end
|
|
339
|
+
|
|
340
|
+
# :call-seq:
|
|
341
|
+
# text_shift_from_x_origin
|
|
342
|
+
# text_shift_from_x_origin = a_float
|
|
343
|
+
#
|
|
344
|
+
# Default value for "shift" in show_yaxis when "loc" is +AT_X_ORIGIN+.
|
|
345
|
+
def text_shift_from_x_origin
|
|
346
|
+
end
|
|
347
|
+
|
|
348
|
+
# :call-seq:
|
|
349
|
+
# text_shift_from_y_origin
|
|
350
|
+
# text_shift_from_y_origin = a_float
|
|
351
|
+
#
|
|
352
|
+
# Default value for "shift" in show_xaxis when "loc" is +AT_Y_ORIGIN+.
|
|
353
|
+
def text_shift_from_y_origin
|
|
354
|
+
end
|
|
355
|
+
|
|
356
|
+
# :call-seq:
|
|
357
|
+
# default_text_scale
|
|
358
|
+
#
|
|
359
|
+
# Default factor determining text size (relative to the default font size).
|
|
360
|
+
# Is initialized to 1.0 and changed by rescale_text.
|
|
361
|
+
def default_text_scale
|
|
362
|
+
end
|
|
363
|
+
|
|
364
|
+
|
|
365
|
+
# :call-seq:
|
|
366
|
+
# default_font_size
|
|
367
|
+
#
|
|
368
|
+
# Default font size in points (relative to the default_font_size).
|
|
369
|
+
# Is initialized to 10.0 and changed by set_default_font_size.
|
|
370
|
+
# The intention is that this gets set rarely and most font sizing is done
|
|
371
|
+
# using rescale_text.
|
|
372
|
+
def default_font_size
|
|
373
|
+
end
|
|
374
|
+
|
|
375
|
+
# :call-seq:
|
|
376
|
+
# set_default_font_size(size, update_size_string) # size in points
|
|
377
|
+
#
|
|
378
|
+
# Sets the font size in points. If the 'update_size_string' flag is true,
|
|
379
|
+
# then the 'tex_fontsize' attribute will be set to match the new font size.
|
|
380
|
+
# The intention is that set_default_font_size gets called rarely and most font sizing is done
|
|
381
|
+
# using rescale_text.
|
|
382
|
+
def set_default_font_size(size, update_size_string = true)
|
|
383
|
+
end
|
|
384
|
+
|
|
385
|
+
# :call-seq:
|
|
386
|
+
# tex_fontsize
|
|
387
|
+
# tex_fontsize = a_string # giving the font size in points
|
|
388
|
+
#
|
|
389
|
+
# This string will be used as the basic font size specification in the preview TeX file.
|
|
390
|
+
# Valid strings include things like '10.0' or '12.0'.
|
|
391
|
+
#
|
|
392
|
+
# See also: tex_fontfamily, tex_fontseries, and tex_fontshape.
|
|
393
|
+
def tex_fontsize
|
|
394
|
+
end
|
|
395
|
+
|
|
396
|
+
|
|
397
|
+
# :call-seq:
|
|
398
|
+
# tex_fontfamily
|
|
399
|
+
# tex_fontfamily = a_string # giving the font family
|
|
400
|
+
#
|
|
401
|
+
# This string will be used as the basic font family specification in the preview TeX file. Valid strings include
|
|
402
|
+
# 'rmdefault', 'sfdefault', and 'ttdefault', for roman face, sans serif face, and typewriter face, respectively.
|
|
403
|
+
#
|
|
404
|
+
# See also: tex_fontsize, tex_fontseries, and tex_fontshape.
|
|
405
|
+
def tex_fontfamily
|
|
406
|
+
end
|
|
407
|
+
|
|
408
|
+
# :call-seq:
|
|
409
|
+
# tex_fontseries
|
|
410
|
+
# tex_fontseries = a_string # giving the font series
|
|
411
|
+
#
|
|
412
|
+
# This string will be used as the basic font series specification in the preview TeX file. Valid strings include
|
|
413
|
+
# 'mddefault' and 'bfdefault', for medium and bold face, respectively.
|
|
414
|
+
#
|
|
415
|
+
# See also: tex_fontsize, tex_fontfamily, and tex_fontshape.
|
|
416
|
+
def tex_fontseries
|
|
417
|
+
end
|
|
418
|
+
|
|
419
|
+
|
|
420
|
+
# :call-seq:
|
|
421
|
+
# tex_fontshape
|
|
422
|
+
# tex_fontshape = a_string # giving the font shape
|
|
423
|
+
#
|
|
424
|
+
# This string will be used as the basic font shape specification in the preview TeX file. Valid strings include
|
|
425
|
+
# *'updefault', 'itdefault', 'sldefault', and 'scdefault', for upright, italic, slant, and small caps, respectively.
|
|
426
|
+
#
|
|
427
|
+
# See also: tex_fontsize, tex_fontfamily, and tex_fontseries.
|
|
428
|
+
def tex_fontshape
|
|
429
|
+
end
|
|
430
|
+
|
|
431
|
+
|
|
432
|
+
# :call-seq:
|
|
433
|
+
# tex_xaxis_numeric_label
|
|
434
|
+
# tex_xaxis_numeric_label = a_string
|
|
435
|
+
#
|
|
436
|
+
# The string for a numeric label is put in this TeX command string to be formatted.
|
|
437
|
+
# For example, `$#1$' will give the numbers in math mode, while `$\mathsf{#1}$' will
|
|
438
|
+
# show the label using the math sans-serif font. Alias for xaxis_numeric_label_tex.
|
|
439
|
+
def tex_xaxis_numeric_label
|
|
440
|
+
end
|
|
441
|
+
|
|
442
|
+
# :call-seq:
|
|
443
|
+
# tex_yaxis_numeric_label
|
|
444
|
+
# tex_yaxis_numeric_label = a_string
|
|
445
|
+
#
|
|
446
|
+
# The string for a numeric label is put in this TeX command string to be formatted.
|
|
447
|
+
# For example, `$#1$' will give the numbers in math mode, while `$\mathsf{#1}$' will
|
|
448
|
+
# show the label using the math sans-serif font. Alias for yaxis_numeric_label_tex.
|
|
449
|
+
def tex_yaxis_numeric_label
|
|
450
|
+
end
|
|
451
|
+
|
|
452
|
+
|
|
453
|
+
end # class
|
|
454
|
+
end # module Tioga
|