Difference between revisions of "User:Luigi.scarso"

From Wiki
Jump to navigation Jump to search
 
(26 intermediate revisions by 5 users not shown)
Line 1: Line 1:
__TOC__
+
== Some materials ==
 +
=== Npp for ConTeXt ===
  
= Modules::documentation=
+
[https://github.com/luigiScarso/context-npp This] is a notepad++ plugin for ConTeXt. Original work by Jason Yu, current developer Luigi Scarso.
  
Modules as name come from <code>modules</code> switch in <br/>
+
The plugin is available here: [[File:Npp-for-ConTeXt.zip]].
<code>
+
Manual under doc/npp-context-manual.pdf of the archive.
texexec --pdf --modules ''module name''
 
</code><br/>
 
or<br/>
 
<code>
 
texmfstart texexec --pdf --modules ''module name''
 
</code><br/>
 
which is  
 
a way to make pdf of documentation and code of ''module name'' .
 
 
 
* first, see ''Inside_ConTeXt'' in [http://sandbox.contextgarden.net/Inside_ConTeXt];
 
* also, see ''CONTEXT System Macros''  at [http://tex.aanhet.net/context/syst-gen-doc.pdf]
 
* [[User:Luigi.scarso/modules.pdf]] for a comprensive set of pdf
 
 
 
-- Maybe you are searching for [[Modules]], ie extensions to ConTeXt's core functions.--
 
 
 
= Other stuffs=
 
 
 
*AutoSize: see supp-fun.tex. Some stuff here: http://wiki.contextgarden.net/User:Luigi.scarso/autosize
 
 
 
* Two SRA3 papers labels here http://wiki.contextgarden.net/Image:SRA3.jpg <!--[[Image:SRA3.jpg]] -->
 
 
 
*I have download preprint of EUROTEX 2005 [http://www.gutenberg.eu.org/EuroTeX2005/] It's very interesting.<br/>
 
 
 
*For EUROTEX 2006, see slides here:http://www.matexhu.org/eurotex2006/lectures/
 
 
 
* For EUROTEX 2007, see some slides here: http://www.logosrl.it/context/EuroTeX2007/
 
*Also very interesting are colors (here [http://contextgarden.net/index.php?title=Colors])
 
 
 
----
 
*Is Indesign CS2 better than ConTeXt ?
 
----
 
 
 
=Cool links=
 
*http://pdfedit.petricek.net/ pdfeditor
 
 
 
 
 
*http://www.mail-archive.com/poppler@lists.freedesktop.org/msg00334.html There is a Ruby binding, Ruby/Poppler, in Ruby-GNOME2 project.
 
 
 
*http://podofo.sourceforge.net/ PDF parsing library
 
 
 
*http://www.fauskes.net/ pgf and so.
 
 
 
 
 
*http://pybrary.net/pyPdf/
 
 
 
*http://www.boddie.org.uk/david/Projects/Python/pdftools/.
 
 
 
 
 
*http://wiki.contextgarden.net/HTML_and_ConTeXt
 
 
 
= Luatex examples =
 
Examples from <tt>Vyatcheslav Yatskovsky <yatskovsky at gmail.com> </tt>
 
 
 
*Say you needed to prepare about twenty test papers with 10 questions per a paper, that is, 200 questions. Examples: "1. convert Dec 36 into Hex", "2. convert Bin 10010101 into Dec", etc. The wording of every question should remain the same, only figures have to be changed through papers. Instead of inventing those numbers, you can write simple Lua scripts to generate random values withing given range:
 
<pre>
 
% random decimal number
 
Convert
 
\ctxlua{n=math.random(30,60); tex.print(n);}\low{10}
 
into Bin.
 
 
 
% random binary number
 
Convert
 
\startluacode
 
for c = 1, 16 do
 
n = math.random(0,1)
 
tex.sprint(n)
 
end
 
\stopluacode\low{2} into Hex.
 
 
 
% a pair of random hexadecimals
 
Perform logical AND, OR and XOR under the following pair of hexadecimal numbers:
 
\startluacode
 
n = math.random(10,255)
 
m = math.random(10,255)
 
tex.print(string.format("%X, %X", n, m))
 
\stopluacode
 
 
 
% random word
 
Encode your full name as
 
\startluacode
 
a = {'null-terminated', 'dollar-terminated', 'Pascal shortstring'}
 
tex.print( string.format('%s string.', a[math.random(1,3)]) );
 
\stopluacode
 
</pre>
 
 
 
= Luatex hosts python =
 
Following [http://labix.org/lunatic-python] I was able, in a linux box, to modify luatex-snapshot-20070820.tar.bz2  so that <tt>luatex --luaonly</tt> can  host python. Of course <tt>\directlua0{....}</tt> also works.<br/>
 
'''WARNING: these modifications break security and portability''' <br/>
 
'''WARNING: these are not examples of proprer context mkiv code''' <br/>
 
<pre>
 
% engine=luatex
 
\def\TestA#1{%
 
\directlua0{%
 
require('python')
 
re = python.import("re")
 
pattern = re.compile(".*(TeX).*")
 
match = pattern.match("#1")
 
if match
 
then
 
  print( 'match.group(1)===>',match.group(1))
 
else
 
print ('#1 no match')
 
end
 
}}
 
 
 
\def\TestB#1{%
 
\directlua1{%
 
require('python')
 
re = python.import("re")
 
pattern = re.compile(".*(TeX).*")
 
match = pattern.match("#1")
 
if match
 
then
 
  print( 'match.group(1)===>',match.group(1))
 
else
 
print ('#1 no match')
 
end
 
}}
 
 
 
\def\TestC{%
 
\directlua0{%
 
require('python')
 
python.execute('n=1')
 
n=python.eval('n')
 
print("PYTHON:"..n)
 
%% --[[ --]]
 
python.execute('s="XYZ"')
 
s=python.eval('s')
 
print("PYTHON:"..s,",lenght="..\letterhash s)
 
%% --[[ --]]
 
python.execute('d={"Boo":1}')
 
python.execute('d["FOO"]=2')
 
d=python.eval('d')
 
print("PYTHON:",d)
 
print("PYTHON:",d.Boo,d["Boo"],d.FOO,d["FOO"])
 
%% --[[ --]]
 
python.execute('a=[1,3,2,5,9]')
 
a=python.eval('a')
 
print("PYTHON:",a)
 
print("PYTHON:",a[0],a[1])
 
python.execute('a.append("X")')
 
python.execute('a.sort()')
 
a=python.eval('a')
 
print("PYTHON:",a)
 
print("PYTHON:",a[0],a[1])
 
%% --[[ --]]
 
a=python.eval('[0,3,8,2,-1]')
 
print("PYTHON:",a[3])
 
print("PYTHON:",a,type(a))
 
%%
 
}}
 
 
 
%%-- testD.lua
 
%% require('python')
 
%% print("BEGIN PYTHON")
 
%% pycode=[[
 
%% class Test(object):
 
%%  def __init__(self):
 
%%    self.a=[0,3,81,2,-1]
 
%%    self.b=self.a[:]
 
%%    self.a.sort()
 
%%   
 
%%  def get(self):   
 
%%    return self.a,self.b
 
%% ]]
 
%% python.execute(pycode)
 
%% python.execute("t=Test()")
 
%% print(python.eval("t.get()"))
 
%% t=python.eval("Test()")
 
%% print(t.get())
 
%% print(t.get()[0])
 
%% print(t.get()[0][0])
 
%% print(TeX)
 
%% print("END PYTHON")
 
\def\TestD#1{%
 
\directlua0{%
 
TeX='#1'
 
dofile('testD.lua')}%
 
}
 
 
 
%% -- testG.lua
 
%% require('python')
 
%% tex.print("\\ruledvbox{testG}\\blank")
 
%% tex.print("\\ruledvbox{BEGIN PYTHON}\\blank")
 
%% pyg = python.globals()
 
%% pycode=[[
 
%% class Test(object):
 
%%  def __init__(self,tex):
 
%%    self.tex=tex
 
%%   
 
%%  def getbboxpage(self):   
 
%%    return self.tex['hsize'],self.tex['vsize']
 
%%
 
%% ]]
 
%% python.execute(pycode)
 
%% --
 
%% pyg.tex = tex
 
%% python.execute("test=Test(tex)")
 
%% test=python.eval("test")
 
%% bboxpage = test.getbboxpage()
 
%% tex.print(tostring(bboxpage))
 
%% tex.print("\\blank\\ruledvbox{END PYTHON}")
 
\def\TestG{\directlua0{dofile('testG.lua')}}
 
 
 
 
 
\starttext
 
 
 
\TestD
 
 
 
\stoptext
 
 
 
 
 
</pre>
 
 
 
=Future ConTeXt Users=
 
[[Future_ConTeXt_Users]]
 

Latest revision as of 08:13, 13 February 2018

Some materials

Npp for ConTeXt

This is a notepad++ plugin for ConTeXt. Original work by Jason Yu, current developer Luigi Scarso.

The plugin is available here: File:Npp-for-ConTeXt.zip. Manual under doc/npp-context-manual.pdf of the archive.