ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Trial to use LibreOffice Calc (+ python) to build ConTeXt customized environnements files
@ 2023-04-10 17:23 Garulfo via ntg-context
  0 siblings, 0 replies; only message in thread
From: Garulfo via ntg-context @ 2023-04-10 17:23 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Garulfo

[-- Attachment #1: Type: text/plain, Size: 2305 bytes --]

Hi all,

I started an attempt to help producing customized environnements files 
with LibreOffice Calc and macro with python, to see if and how it can 
helps newcomers (after viewing video about batch commander from Ricardo 
Lafuente and Kaveh Bazargan).

It is very early stage (and very quick and dirty), but any feedback is 
welcome.

=================================================================

Currently working:

- one sheet to setup colors      ==> env_A05_color.tex
   - after clicking on button Go!, colors are actually shown
     deduced from hsv parameter

- one sheet to setup sectionning ==> env_B14_section.tex
   - Options are categorized
     - 01-Style
     - 02-Numbering
     - 03-Position (not yet clear)
     - 04-Insert
     - 05-Reference
     - 06-commands

- one sheet to setup layout      ==> env_A01_layout.tex

- one sheet to setup font        ==> env_A04_fonts.tex
   - thanks to mtxrun --script font it provides
     - the list of available font families
       - after 1st clic on fonts button
     - the list of available font names
       - after selecting families and 2nd clic on fonts button
   - it can help to produce simple typescripts in 1min

=================================================================
Package can be found at 
https://wiki.contextgarden.net/images/7/73/SetupContext_with_libreoffice_v00.04.zip

4 files

1/ SetupContext_with_libreoffice.py -----------------------
Python file that should be put in
- gnu+linux : ~/.config/libreoffice/4/user/Scripts/python
- win : C:\Users\xxxxx\AppData\Roaming\OpenOffice\4\user\Scripts\python
- mac : /Applications//LibreOffice\ 
Vanilla.app/Contents/Resources/Scripts/python/

def Initialization(): should be adapted for
  ContextPath = "path to …/tex/texmf-linux-64/bin/"

2/ readme.tex ----------------------------------------------------
Basic document with content and ref to global environnement file

3/ env_00.tex ----------------------------------------------------
environnement file that refers to other specific environnement files
which are produced by the macro

4/ gui_v04.ods ----------------------------------------------------
LibreOffice Calc as interface for user

=================================================================
examples of output env files are attached.




[-- Attachment #2: env_A01_layout.tex --]
[-- Type: text/x-tex, Size: 399 bytes --]


\setuplayout
  [
   backspace=37mm,
   width=136mm,
   topspace=12mm,
   height=273mm,
   margindistance=5mm,
   leftmargin=20mm,
   rightmargin=20mm,
   edgedistance=2mm,
   leftedge=5mm,
   rightedge=5mm,
   headerdistance=5mm,
   header=10mm,
   footerdistance=5mm,
   footer=10mm,
   topdistance=2mm,
   top=5mm,
   bottomdistance=2mm,
   bottom=5mm,
   grid=no,
  ]





\setuppapersize[A4]



[-- Attachment #3: env_A04_fonts.tex --]
[-- Type: text/x-tex, Size: 3838 bytes --]


\starttypescript [serif] [myfont]
\setups[font:fallback:serif]
  \definefontsynonym [Serif]                             [name:palatinoltstdlight]           [features=default]
  \definefontsynonym [SerifItalic]                       [name:palatinoltstdlightitalic]     [features=default]
  \definefontsynonym [SerifBold]                         [name:palatinoltstdmedium]          [features=default]
  \definefontsynonym [SerifBoldItalic]                   [name:palatinoltstdmediumitalic]    [features=default]
\stoptypescript

\starttypescript [sans] [myfont]
\setups[font:fallback:sans]
  \definefontsynonym [Sans]                             [name:ibmplexsans]                  [features=default]
  \definefontsynonym [SansItalic]                       [name:ibmplexsansitalic]            [features=default]
  \definefontsynonym [SansBold]                         [name:ibmplexsansbold]              [features=default]
  \definefontsynonym [SansBoldItalic]                   [name:ibmplexsansbolditalic]        [features=default]
\stoptypescript

\starttypescript [mono] [myfont]
\setups[font:fallback:mono]
  \definefontsynonym [Mono]                             [name:sourcecodeprolight]           [features=default]
  \definefontsynonym [MonoItalic]                       [name:sourcecodeprolightit]         [features=default]
  \definefontsynonym [MonoBold]                         [name:sourcecodeprobold]            [features=default]
  \definefontsynonym [MonoBoldItalic]                   [name:sourcecodeproblackit]         [features=default]
\stoptypescript

\starttypescript [math] [myfont]
\setups[font:fallback:math]
  \definefontsynonym [Math]                             [name:lmroman10regular]             [features=default]
  \definefontsynonym [MathItalic]                       [name:lmroman10italic]              [features=default]
  \definefontsynonym [MathBold]                         [name:lmroman10bold]                [features=default]
  \definefontsynonym [MathBoldItalic]                   [name:lmroman10bolditalic]          [features=default]
\stoptypescript

\starttypescript [handwriting] [myfont]
\setups[font:fallback:handwriting]
  \definefontsynonym [Handwriting]                             [name:snellroundhandltstdscr]       [features=default]
  \definefontsynonym [HandwritingItalic]                       [name:snellroundhandltstdscr]       [features=default]
  \definefontsynonym [HandwritingBold]                         [name:snellroundhandltstdscr]       [features=default]
  \definefontsynonym [HandwritingBoldItalic]                   [name:snellroundhandltstdscr]       [features=default]
\stoptypescript

\starttypescript [calligraphy] [myfont]
\setups[font:fallback:calligraphy]
  \definefontsynonym [Calligraphy]                             [name:sabonltstdroman]              [features=default]
  \definefontsynonym [CalligraphyItalic]                       [name:sabonltstditalic]             [features=default]
  \definefontsynonym [CalligraphyBold]                         [name:sabonltstdbold]               [features=default]
  \definefontsynonym [CalligraphyBoldItalic]                   [name:sabonltstdbolditalic]         [features=default]
\stoptypescript

\starttypescript[myfont]
\definetypeface [myfont] [rm] [serif]       [myfont] [default]
\definetypeface [myfont] [ss] [sans]        [myfont] [default]
\definetypeface [myfont] [tt] [mono]        [myfont] [default]
\definetypeface [myfont] [mm] [math]        [myfont] [default]
\definetypeface [myfont] [hm] [handwriting] [myfont] [default]
\definetypeface [myfont] [cg] [calligraphy] [myfont] [default]
\stoptypescript



\setuptolerance[strict]
\setupalign[hz]
\setupalign[hanging]
\setupalign[lesshyphenated]
\setupalign[verytolerant]
\setupalign[stretch]
\setupwhitespace [big] 
\setupbodyfont[myfont,ss,12pt]



[-- Attachment #4: env_A05_color.tex --]
[-- Type: text/x-tex, Size: 1903 bytes --]


\definecolor [MaCouleur0]         [h=340.0,s=0.85,v=0.1,a=1.0,t=1.0]
\definecolor [MaCouleur1]         [h=210.0,s=0.9,v=0.5,a=1.0,t=1.0]
\definecolor [MaCouleur2]         [h=210.0,s=0.8,v=0.6,a=1.0,t=1.0]
\definecolor [MaCouleur3]         [h=210.0,s=0.7,v=0.7,a=1.0,t=1.0]
\definecolor [MaCouleur4]         [h=210.0,s=0.6,v=0.8,a=1.0,t=1.0]
\definecolor [MaCouleur5]         [h=210.0,s=0.5,v=0.9,a=1.0,t=1.0]
\definecolor [MaCouleur6]         [h=30.0,s=0.9,v=0.5,a=1.0,t=1.0]
\definecolor [MaCouleur7]         [h=30.0,s=0.8,v=0.6,a=1.0,t=1.0]
\definecolor [MaCouleur8]         [h=30.0,s=0.7,v=0.7,a=1.0,t=1.0]
\definecolor [MaCouleur9]         [h=30.0,s=0.6,v=0.8,a=1.0,t=1.0]
\definecolor [MaCouleur10]        [h=30.0,s=0.5,v=0.9,a=1.0,t=1.0]
\definecolor [MaCouleur11]        [h=120.0,s=0.3,v=1.0,a=1.0,t=1.0]
\definecolor [MaCouleur12]        [h=200.0,s=0.3,v=1.0,a=1.0,t=1.0]
\definecolor [MaCouleur13]        [h=200.0,s=0.9,v=0.9,a=1.0,t=1.0]
\definecolor [MaCouleur14]        [h=120.0,s=0.9,v=0.9,a=1.0,t=1.0]
\definecolor [MaCouleur15]        [h=200.0,s=0.9,v=0.9,a=1.0,t=1.0]


\definecolor [CouleurPrincipale]  [MaCouleur0]
\definecolor [Couleur1]           [MaCouleur1]
\definecolor [Couleur2]           [MaCouleur2]
\definecolor [Couleur3]           [MaCouleur3]
\definecolor [Couleur4]           [MaCouleur4]
\definecolor [Couleur5]           [MaCouleur5]
\definecolor [CouleurContraste1]  [MaCouleur6]
\definecolor [CouleurContraste2]  [MaCouleur7]
\definecolor [CouleurContraste3]  [MaCouleur8]
\definecolor [CouleurContraste4]  [MaCouleur9]
\definecolor [CouleurContraste5]  [MaCouleur10]
\definecolor [CouleurFond1]       [MaCouleur11]
\definecolor [CouleurFond2]       [MaCouleur12]
\definecolor [CouleurURL]         [MaCouleur13]
\definecolor [CouleurType]        [MaCouleur14]
\definecolor [CouleurLiens]       [MaCouleur15]


\setupcolors
  [
   textcolor=CouleurPrincipale,
  ]




[-- Attachment #5: env_B14_section.tex --]
[-- Type: text/x-tex, Size: 1118 bytes --]


\setuphead
  [part]
  [
   style=\bfd,
   textcolor=Couleur1,
   numbercolor=CouleurContraste1,
   bodypartlabel=Part,
   placehead=yes,
   page=left,
   header=high,
   align=flushleft,
   alternative=middle,
   before={\strut\godown[4cm]},
  ]

\setuphead
  [chapter]
  [
   style=\bfc,
   textcolor=Couleur2,
   numbercolor=CouleurContraste2,
   sectionsegments=1:2,
   page=yes,
   align=flushleft,
  ]

\setuphead
  [title]
  [
  ]

\setuphead
  [section]
  [
   style=\bfb,
   textcolor=Couleur3,
   numbercolor=CouleurContraste3,
   sectionsegments=1:3,
   page=yes,
   align=flushleft,
  ]

\setuphead
  [subject]
  [
  ]

\setuphead
  [subsection]
  [
   style=\bfa,
   textcolor=Couleur4,
   numbercolor=CouleurContraste4,
   sectionsegments=1:4,
   align=flushleft,
  ]

\setuphead
  [subsubject]
  [
  ]

\setuphead
  [subsubsection]
  [
   style=\bf,
   textcolor=Couleur5,
   numbercolor=CouleurContraste5,
   sectionsegments=1:5,
   align=flushleft,
  ]

\setuphead
  [subsubsubject]
  [
  ]

\setuphead
  [subsubsubsection]
  [
   textcolor=CouleurContraste3,
   numbercolor=CouleurContraste3,
  ]




[-- Attachment #6: Type: text/plain, Size: 496 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : https://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-04-10 17:23 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-10 17:23 Trial to use LibreOffice Calc (+ python) to build ConTeXt customized environnements files Garulfo via ntg-context

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).