3.1 The
language
55
codedrawsacrudecoilbyjudicioususeofdir.Insteadofthedefaultunits,weexpressall
dimensionsintermsofaunitof2.5cm,definedatthestart:
Example
3-1-4
u=2.5cm;
path p;
p= (0,0) {dir 130}..
{dir -130}(0.25u,0){dir r 130}..
{dir -130}(0.5u,0){dir r 130}..
{dir -130}(0.75u,0){dir r 130}..
{dir -130}(u,0);
draw p p rotated d -90;
Thenextexampleshowstheeffectofcurl.Hereastraightlineisdrawnbetweenthree
pointsandthenacurveisdrawnbetweenthesamepoints,withcurlvalues:
Example
3-1-5
path p,q;
u=.5cm;
q=(0u,0u)--(6u,0u)--(4u,3u);
draw q;
p=(0u,0u){curl 4000}..(6u,0u)
..{curl 4000}(4u,3u);
draw p;
Todemonstrate
’sunusual“pens”,weapproximateaspiraldrawnwithastrange
“nib”.AcoloredversionofthisdrawingappearsinColorPlateI(a).
Example
3-1-6
pickup pencircle e scaled 3pt
yscaled .2pt t rotated 60;
n:=5;
for i i := = (n*20) step -(n) until l (n):
draw ((i,0)..(0,i)..(-i,0)
..(0,-(i-n))..(i-n,0)) scaled d 0.7;
endfor
Averycharacteristictechniquewith
iscreatingapathandthenusingitseveral
timeswithdifferenttransformations.Thefollowingcodeisanextractfromadrawingofa
Add multiple pdf files into one online - Merge, append PDF files in C#.net, ASP.NET, MVC, Ajax, WinForms, WPF
Provide C# Demo Codes for Merging and Appending PDF Document
append pdf; c# merge pdf pages
Add multiple pdf files into one online - VB.NET PDF File Merge Library: Merge, append PDF files in vb.net, ASP.NET, MVC, Ajax, WinForms, WPF
VB.NET Guide and Sample Codes to Merge PDF Documents in .NET Project
combine pdf online; c# merge pdf
56
AND
:T
E
X’SMATES
kite’stail.Notethatshapescanbemadesolidbyusingfillinsteadofdraw:
u=1cm;
path p[];
p1:=(.5u,.5u)--(1.5u,.5u)--(.5u,1.5u)
--(1.5u,1.5u)--(.5u,.5u)--cycle;
fill (p1 shifted d (0,2.5u))
rotatedaround ((u,3.5u),90);
draw p1 shifted (u,4u);
fill p1 shifted (3.5u,3u);
p2 =(2u,2u)..(u,3.5u)..(2u,5u)
..(4.5u,4u)..(7u,5u);
pickup pencircle e scaled d 4pt;
draw p2;
Example
3-1-7
Amorecomplicatedpicture,courtesyofAlanHoenigfromhisbookT
E
XUnbound[49],
demonstratesloopingcommands.Boxesofgraduallydecreasingsizearedrawnalternately
whiteandblack,witheachonebeingrotatedslightlywithrespecttothepreviousbox.
boolean timetofillbox; timetofillbox := true;
partway := 0.9; l := = .45in; u u := 1.05in;
n := = 4; theta a := 360/n; z1 1 = (0,u);
for i i := = 2 upto n:
z[i] = = z1 rotated ((i-1)*theta);
endfor
forever:
path p;
p := z1
for j j := 2 2 upto o n: : --z[j] endfor r --cycle;
if timetofillbox:
fill p; ; timetofillbox x := false;
else:
unfill p; ; timetofillbox x := = true;
fi
pair Z[];
for j j := 1 1 upto o n:
Z[j] := partway[z[j-1],z[j]];
endfor
Z1 := partway[z[n],z1];
for j j := 1 1 upto o n:
x[j] := xpart Z[j]; ; y[j] ] := = ypart t Z[j];
endfor
if not timetofillbox: l := abs(z1); fi
exitif l < < .05u;
endfor
Example
3-1-8
Online Merge PDF files. Best free online merge PDF tool.
Merge PDF, Multiple PDF files. Then press the button below and download your PDF. Also you can add more PDFs to combine them and merge them into one single
combine pdf files; acrobat split pdf into multiple files
VB.NET TWAIN: Scanning Multiple Pages into PDF & TIFF File Using
one convenient multi-page document file, like PDF and TIFF This VB.NET TWAIN pages scanning control add-on is an efficient solution to scan multiple pages into
c# combine pdf; .net merge pdf files
CHAPTER
4
Applications
4.1 Adrawingtoolkit ......................................141
4.2 Representingdatawithgraphs..............................157
4.3 Diagrams s ...........................................176
4.4 Geometry...........................................189
4.5 Scienceandengineeringapplications..........................196
4.6 3-Dextensions........................................207
Chapter3gaveageneraloverviewof
and
,aswellasanextensive
descriptionoftwomultipurposestructuringpackages,boxesand
.However,as
isthecaseforL
A
T
E
X,solutionstomanyproblemscanoftenbefoundbyusingexistinghigh-
levelpackages.Sometimesseveraldifferent
packagesareaimedatthesame
tasks,andthesepackagescomewithbothadvantagesanddrawbacks.
Unfortunately,theperfectpackageisseldomathand.Itisthereforeusefultohavea
generalideaofwhatcanbeachievedin
,andtohavesomekindoftoolbox
forproblemsolving.Understandinganumberofbasictrickswillenablethebeginnerto
supplementexistingpackagesandachievethedesiredresults.
Inthischapter,westartwithareviewofanumberofbasicproblemsandshowhow
theseproblemscanbesolved.Thenwedescribesomestandardapplicationsof
-
,rangingfromgeometrytophysics.
4.1 Adrawingtoolkit
Thissectionisdevotedtoanumberofadvancedfeatures,whicharelocatedsomewherebe-
tweenlow-level
codeandfullapplicationpackages.Weliketoconsiderall
thesefeaturesasakindoftoolkit,whichcanbeusedwithbenefitinwiderapplications.
VB.NET PDF File Split Library: Split, seperate PDF into multiple
that they can split target multi-page PDF document file to one-page PDF Add necessary references Split PDF Document into Multiple PDF Files Demo Code in VB.NET.
add pdf files together online; merge pdf online
C# Create PDF from images Library to convert Jpeg, png images to
multiple image formats into one or multiple PDF file in C# List<Bitmap> images = new List<Bitmap>(); images.Add(new Bitmap shows how to build a PDF document with
asp.net merge pdf files; pdf combine
4.1 Adrawingtoolkit
149
BogusławJackowski’shatchingpackageprovidesamoreelaboratewaytoachievehatch-
ingpatterns,byredefiningthewithcolorprimitiveinsuchawaythatitrepresentshatch-
ingparameterswhenthebluecomponentofthecolorisnegative.Thefollowingexamples
illustratethisprinciple.
Example
4-1-10
input hatching;
path p;
p:=unitsquare xscaled 30mm yscaled 15mm;
hatchfill p withcolor red
withcolor (45,2mm,-.5bp)
withcolor (-45,2mm,-.5bp);
Thenextthreeexamplesuseaspecialclosedpathshapedasastar,definedbythestar
macro:
Example
4-1-11
input hatching;
vardef star(expr r n) =
for i_:=0 0 upto o 2n-1:
if odd i_: 1/2 2 fi i (right rotated (180*(i_/n))) --
endfor cycle
enddef;
interim hatch_match:=0;
path p;
p:=star(10) xscaled 30mm
yscaled 20mm
rotated 20;
hatchfill p withcolor (0,1,.5);
draw image(hatchfill p
withcolor (45,3bp,-.5bp)
withcolor (-45,3bp,-.5bp);
) withcolor red dashed d evenly;
Example
4-1-12
input hatching;
% star r macro o defined as above
path p;
p:=star(10) xscaled 30mm
yscaled 20mm
rotated 20;
interim hatch_match:=0;
hatchoptions(withcolor blue
dashed evenly scaled 2);
hatchfill p withcolor .75white
withcolor (20,6bp,-.5bp);
hatchoptions(withcolor (blue+green)
dashed evenly
shifted (3/2bp,0));
hatchfill p withcolor (110,6bp,-.5bp);
VB.NET Create PDF from images Library to convert Jpeg, png images
Turn multiple image formats into one or multiple PDF file. images As New List(Of REImage) images.Add(New REImage example shows how to build a PDF document with
pdf mail merge plug in; attach pdf to mail merge in word
C# PDF: C#.NET PDF Document Merging & Splitting Control SDK
C#.NET Sample Codes to Merge Multiple PDF Files. C#.NET PDF Merger & Splitter SDK FAQs. Q 1: Using this C#.NET PDF merger & splitter control add-on, can I
acrobat combine pdf; pdf mail merge
174
APPLICATIONS
Amoreelaborateexampleappearsbelow.The8%correspondsto10being8%of50+
30+10+20+20.
Lions
Tigers
Hyaena
Monkeys
10
20
38 %
23 %
a segment with 8 %
a green label
input piechartmp
SetupColors((.7,.7),this,this);
SetupPercent(this, " " %");
Segment(50,"Lions"); Segment(30,"Tigers");
Segment(10,"Hyaena"); Segment(20,"Monkeys");
Segment(20,"Warthogs");
SegmentState(4,this,0.3);
SegmentState(5,invisible,this);
PieChart(2cm,0.15,60,0,0);
Label.auto(0)(name)(outwards,0);
Label(3,4,5)(value)(inwards,0) withcolor white;
Label(1,2)(percent)(inwards,0) withcolor (1,1,0);
Label.lrt(3)("a segment t with h ",percent)
((0.9,0.8),(0,-2cm)) withcolor .8red;
pickup pencircle e scaled d 2pt;
Label.auto(2)("a green label")
((0.9,0.1),(-1cm,7mm)) withcolor .8green;
Example
4-2-26
This example e has s labels with h spaces s and d needs a a font with h spaces—hence the
defaultfontdeclaration.ThisisnotaproblemwhenweareusingT
E
Xlabels.
SetupNumbers(precision,delimiter)
InadditiontotheSetupPercentcommands,severalothersetupcommandsareavailable.
Setupcommands
Thefirst,SetupNumbers,setstheaccuracyanddelimiterused.SetupNumbers(2,",")
will,forinstance,roundattwoplacesanduseacommadelimiter.
SetupColors(auto-SV,shading-SV,grayscale)
Thiscommandspecifiesthecolorsusedforsegments.Thethreeargumentsareasfollows:
auto-SV isapair(S,V),whereSisthesaturationandV V isthevalueintheHSVmodel.
ThehueHistakenfromthepositionofthesegment.
shading-SV isapairgivingthemaximumvaluesof(S,V)forshadedareasinsegments.
Thedefaultis(0.4,0.3).
grayscale isaBooleanthat,whensettotrue,switchesthecolorstograyscale.
SetupText(Mode,TeXFormat,TeXSettings)
Thiscommandsetsuphowtextishandled,usingthreearguments:
Mode isanintegerspecifyingthewaylabelsaretypeset:0isforstring-basedtypesetting
(default);1isforexternalT
E
X-basedtypesettingusingTeXFormatandTeXSettings;2is
C# Create PDF from CSV to convert csv files to PDF in C#.net, ASP.
multiple sheets CSV file to one PDF or splitting to multiple PDF documents. Add necessary references: Description: Convert to PDF/TIFF and save it into stream.
best pdf combiner; pdf merge files
VB.NET Word: Merge Multiple Word Files & Split Word Document
Split Word File(s) Created by Multiple Microsoft Word NET Word combining and splitting add-on allows controls, PDF document, image to pdf files and components
reader combine pdf; combine pdf
202
APPLICATIONS
ctext.rt(R.C.l+(1cm,0),R.C.r+(1cm,0),"$E_2$",witharrow);
B
E
C
R
C
V
CC
R
B
V
BB
C
a
I
E
I
C
I
B
E
1
E
2
Example
4-5-7
v
D
1
D
2
D
3
D
4
Z
L
input makecirc;
initlatex("\usepackage{amsmath,amssymb}");
source.a(origin,AC,90,"v","");
junction.a(S.a.p+(3cm,1cm),"")(top);
diode.a(J.a,normal,-45,pinA,"D_1","");
diode.b(D.a.K,normal,-135,pinK,"D_2","");
diode.c(D.b.A,normal,135,pinK,"D_3","");
diode.d(D.c.A,normal,45,pinA,"D_4","");
junction.b(D.b.A,"")(bot);
centerto.A(S.a.n,S.a.p)(5cm,imp);
impedance.a(A,90,"Z_L","");
wireU(S.a.p,D.a.A,1.5cm,udsq);
wireU(S.a.n,D.b.A,-1.5cm,udsq);
wire(D.a.K,Z.a.r,rlsq);
wire(Z.a.l,Z.a.l+(0,-4mm),nsq);
wireU(Z.a.l+(0,-4mm),D.d.A,-4cm,rlsq);
Example
4-5-8
input makecirc;
initlatex("\usepackage{amsmath,amssymb}");
transformer.a(origin,mid,0);
diode.a(tf.a.ss+(5mm,1cm),normal,0,pinA,"D_1","");
diode.b(tf.a.si+(5mm,-1cm),normal,0,pinA,"D_2","");
impedance.a(D.a.K+(2cm,-4mm),-90,"Z_L","300\ohm");
wire(tf.a.ss,D.a.A,udsq);wire(tf.a.si,D.b.A,udsq);
wire(D.a.K,Z.a.l,rlsq);wire(Z.a.r,tf.a.m,udsq);
wire(D.b.K,D.a.K+(5mm,0),rlsq);
junction.a(D.a.K+(5mm,0),"")(top);
centerto.A(tf.a.pi,tf.a.ps)(-15mm,sac);
source.a(A,AC,90,"220 V","v");
wire(S.a.p,tf.a.ps,udsq);wire(S.a.n,tf.a.pi,udsq);
centreof.A((xpart S.a.p,ypart tf.a.ps),tf.a.ps,cur);
current.a(c.A,phi.A,"i(t)","5 A");
imesh(tf.a.ss+(1cm,0),15mm,1cm,cw,0,"I_{cc}");
210
APPLICATIONS
hexagonalmeshes Givenafunctionz=f(x,y),ahexagonalmeshcanbeobtainedwith
thehexagonaltrimeshmacro.
input featpost3Dplus2D
def zsurface( ( expr r xc, yc ) ) =
cosd(xc*57)*cosd(yc*57)
+4*mexp(-(xc**2+yc**2)*6.4)
enddef;
f := = 7*(4,1,5);
Spread := 35;
LightSource := 10*(4,-3,4);
SubColor := 0.4background;
numeric np, ssize;
path chair;
np = = 20;
ssize = = 5;
hexagonaltrimesh( true,np,ssize,zsurface);
Example
4-6-2
cubes Thekindofcubemacroproducesacubeinanorientationdependingonitsparam-
eters.Inthisexample,eachcubeeraseswhathasbeendrawnunderit,sothatitgives
theillusionoftheremovalofhiddenparts.
input featpost3Dplus2D
Spread := 30;
f := = 5.4*(1.5,0.5,1);
numeric gridstep, sidenumber,
i, j, , coord, aa, , ab, ac;
color pa;
gridstep = 0.7;
sidenumber = = 4;
coord = = 0.5*sidenumber*gridstep;
for i=0 upto o sidenumber:
for j=0 upto o sidenumber:
pa := (-coord+j*gridstep,-coord+i*gridstep,0);
aa := uniformdeviate(360);
ab := uniformdeviate(180);
ac := uniformdeviate(90);
kindofcube(false, false,
pa, aa, ab, ac, , 0.4, , 0.4, 0.9 );
endfor;
endfor;
Example
4-6-3
4.6 3-Dextensions
211
labelsinspace Thenextexampleshowshowlabelscan n bedrawnin spaceusingthe
labelinspacemacro.
Example
4-6-4
L
a
b
e
l
input featpost3Dplus2D
verbatimtex
%&latex
\documentclass{article}
\begin{document}
etex
f := 1.1*(2,1,0.5);
ParallelProj := true;
kindofcube(false,true,(0,-0.5,0),
90,0,0,1.2,0.1,0.4);
kindofcube(false,true,(0,0,0),
0,0,0,0.5,0.1,0.8);
labelinspace(false,(0.45,0.1,0.65),
(-0.4,0,0),(0,0,0.1),
btex \framebox{\textsc{Label}} etex);
projectedsegments Thelastexampleshowshowpointscanbedefinedinspace,and
pathofstraightlineusedtodrawasegmentjoiningtheprojectionsofthesepoints.
Example
4-6-5
input featpost3Dplus2D
SphericalDistortion := true;
Spread := 50;
f := 0.4*(1.5,0.5,1);
numeric gridstep, sidenumber, i, , coord;
color pa, pb, pc, , pd;
gridstep = = 0.1;
sidenumber = 5;
coord = 0.5*sidenumber*gridstep;
for i=0 0 upto sidenumber:
pa := (-coord,-coord+i*gridstep,0);
pb := (coord,-coord+i*gridstep,0);
pc := (-coord+i*gridstep,-coord,0);
pd := (-coord+i*gridstep,coord,0);
draw pathofstraightline( ( pa, , pb );
draw pathofstraightline( ( pc, , pd );
endfor;
3DLDF
LaurenceD.Finston’sambitiousextensionto
,3DLDF(http://www.gnu.
org/software/3dldf/LDF.html)iswritteninC++usingCWEB.3DLDF(theauthor’s
initials)takesaninputsimilarto
andoutputspure
code.The
packagecurrentlycomputestheintersectionsofvariousprojectedcurves,andtheauthor
planstoimplementtheremovalofhiddenparts.
CHAPTER
5
HarnessingPostScript
InsideL
A
T
E
X:PSTricks
5.1 ThecomponentsofPSTricks................................214
5.2 Settingkeywords,lengths,andcoordinates......................217
5.3 Thepspictureenvironment ..............................220
5.4 Thecoordinatesystem...................................223
5.5 Grids..............................................224
5.6 Linesandpolygons.....................................231
5.7 Circles,ellipses,andcurves ................................240
5.8 Dotsandsymbols......................................249
5.9 Fillingareas..........................................253
5.10 Arrows............................................259
5.11 Labels.............................................265
5.12 Boxes.............................................269
5.13 Userstylesandobjects..................................279
5.14 Coordinates.........................................296
5.15 ThePSTrickscore......................................302
AswesawinChapter1,onewayofdrawinggraphicswithL
A
T
E
Xistoembedlow-levelpicture
drawingprimitivesforthetargetdeviceintoL
A
T
E
Xmacros,sothatfulltypesettinginforma-
tionisavailableandwecanworkinafamiliarmacroprogrammingenvironment.When
thetargetdeviceissomethingasrichasthefullPostScriptlanguage,thiscanresultina
verypowerfulsystem.Whilemanymacropackageshaveimplementedaccesstosomeparts
ofPostScriptforthispurpose,themostcompleteisundoubtedlyPSTricks.Inthenexttwo
chapters,wesurveyitscapabilitiesanddemonstratesomeofthepowerthatresultsfrom
combiningL
A
T
E
XandPostScript.
214
HARNESSINGPOSTSCRIPTINSIDELAT
E
X:PSTRICKS
WedonotattempttodescribeabsolutelyeveryPSTricks-relatedmacro,nordowegive
examplesofallthepossiblecombinationsandtricks,asthiswouldrequirealargebookofits
own,e.g.,[135].Wehave,however,triedtodescribeandgiveexamplesofalltheimportant
featuresofthebasicpackages.You’llfindalotofusefulinformationontheofficialPSTricks
Websiteathttp://PSTricks.tug.org/.
BecausethereareagreatmanycommandsandespeciallykeywordsinPSTricks,wepro-
videasummarydescriptionattheendofthenextchapter(Section6.8onpage459).PSTricks
anditsrelatedpackagesareextremelypowerful,andtheirfacilitiesmaytakesometimeto
understand.Itisalsodocumentedintheindividualpackagesand[127,135],anditsimple-
mentationisdescribedin[126].
5.1 ThecomponentsofPSTricks
ThePSTricksprojectwasstartedbyTimothyVanZandtalongtimeagoandisoneofthe
oldestT
E
Xpackagesstillinuse.
Istartedin1991.InitiallyIwasjusttryingtodeveloptoolsformyownuse.ThenIthought
itwouldbenicetopackagethemsothatotherscouldusethem.Itsoonbecametempting
toaddlotsoffeatures,notjusttheonesIneeded.Whenthisbecamesointerestingthatit
interferedwithmy“dayjob”,Igaveuptheproject“coldturkey”,in1994.
[TimothyVanZandt]
AfterTimothyVanZandtstoppedworkingontheproject,DenisGiroutookoverthe
tasktocareforPSTricks,mainlyfixingbugsandwritingsomemorenewpackages;nowa-
daysthisjobisdonebyHerbertVoß.Severaldevelopersareworkingonexistingandnew
packages,whichisthereasonwhythenumberoftheseadditionalpackages,whichdepend
onthebasicPSTricks,isstillincreasing.AselectionofthemisdiscussedinChapter6,and
thefulllistisavailableattheofficialWebsiteathttp://PSTricks.tug.org.
5.1.1 Thekernel
ThebasicPSTrickspackagefileispstricks.tex,whichprovidesthebasicunithandling,
andbasicgraphicmacroslikedots,lines,frames,andsoon.Forsomehistoricalreason
thepackagespstricks,pst-plot,pst-node,andpst-treebuildthecoreofPSTricksandare
allavailableonCTANinthedirectoryCTAN:/graphics/pstricks/base/generic/.
EachPSTrickspackagehasacorrespondingL
A
T
E
Xstylefile,andthebasiconesarestoredin
CTAN:/graphics/pstricks/base/latex/.Ingeneral,thestylefilesdonothingother
thanloadtheT
E
Xfileviathe\inputmacro.
ThebasicPSTrickspackagesconsistofacoreofpicture-drawingprimitivesimple-
mentedby\specialcommandsthatpassPostScriptcodetoadriver,mainlydvips.The
packagesalsocontainasetofhigher-levelmacrosforparticularapplications,likepst-plot
orpst-node.Withityoucan
• Drawlines,polygons,circles,andcurves.
• PlaceandmanipulateT
E
Xtext.
Documents you may be interested
Documents you may be interested