gB = GramText(myStr) gB.cA = GramCoord() gB.cA.xPosn = g.cA.xPosn gB.cA.yPosn = g.cA.yPosn + 1 gB.anchor = anch gB.color = 'orange' gB.draw = 'blue' gB.lineThickness = 2 #gB.draw = True gB.textSize = theTextSize gB.rotate = 0 gr.graphics.append(gB) if 0: gB = GramText(myStr) gB.cA = GramCoord() gB.cA.xPosn = g.cA.xPosn gB.cA.yPosn = g.cA.yPosn + 1 gB.anchor = anch gB.draw = True gB.textSize = theTextSize gB.rotate = 30 gr.graphics.append(gB) #gr.showTextBB = True #print(gr.graphics) #print(gr.getTikz()) gr.pdf() #gr.png() #gr.svg()
from gram import Gram gr1 = Gram() gr1.font = 'helvetica' gr1.baseName = 'gramInGram' gr1.text("Embedding gram", 0,0) gr2 = Gram() g = gr2.text("Embedded gram",0,0) gr2.gX = 0.3 gr2.gY = 0.5 gr1.grams.append(gr2) gr1.pdf() gr1.svg()
from gram import Gram myText = r"""This is some\\ multi-line text that does not work so well.\\ With $\alpha$ unusual $\beta$ characters.""" if 1: # This works gr = Gram() gr.baseName = 'minipage' stuff = r"\begin{minipage}{12cm}%s\end{minipage}" % myText g = gr.text(stuff, 1, 2) g.anchor = 'south west' gr.pdflatexOutputGoesToDevNull = False gr.pdf() if 0: # This does not work gr = Gram() gr.baseName = 'varwidth' stuff = r"\begin{varwidth}{12cm}%s\end{varwidth}" % myText g = gr.text(stuff, 1, 2) g.anchor = 'south west' gr.latexUsePackages.append("varwidth") gr.pdflatexOutputGoesToDevNull = False gr.pdf() if 0: # This does not work gr = Gram() gr.baseName = 'pbox' stuff = r"\pbox{12cm}{%s}" % myText g = gr.text(stuff, 1, 2) g.anchor = 'south west' gr.latexUsePackages.append("pbox") gr.pdflatexOutputGoesToDevNull = False
from gram import Gram gr1 = Gram() gr1.font = 'helvetica' gr1.baseName = 'gramInGram' gr1.text("Embedding gram", 0, 0) gr2 = Gram() g = gr2.text("Embedded gram", 0, 0) gr2.gX = 0.3 gr2.gY = 0.5 gr1.grams.append(gr2) gr1.pdf() gr1.svg()