requesting tugboat articles

Mike Marchywka marchywka at hotmail.com
Mon Oct 3 10:14:10 CEST 2022


On Mon, Oct 03, 2022 at 01:50:41AM +0200, Reinhard Kotucha wrote:
> On 2022-10-02 at 21:55:35 +0000, Mike Marchywka wrote:
> 
>  > Thanks, at least one of those talks about a JAVA GUI to prepare
>  > input :) I'm amazed at what you can do just writing in version of
>  > TeX but I like c++ for data structures and familiarity. I guess
>  > instead of generating LaTex from c++ I could learn how to do more
>  > in TeX programming but then it is tied to TeX . Some of the
>  > charting Nicola describes may be done in R although not sure what
>  > the issues are. I have written my own svg generators in c++
>  > although I could get same result from R but I am just used to c++
>  > instead of R.
> 
> Hi Mike,
> an alternative to C++ is Lua.  Scripting languages are more portable
> than C++ because they don't have to be compiled for every platform to
> be supported.  And Lua is already supported by TeX Live (luatex and
> texlua).

Generally I need to generate code that allows latex to actually
typset instead of having me guess by breaking tables at fixed
numner of lines etc. So doing more with Xetex or Lua is
probably the way to go. As you also point out though arbitrary
"csv" files, which I use to meean space delimited lol,
is a probably and that is why I do that in c++ as it is
just  a more familiar general purpose language. 
> 
> Lua also supports data structures (called tables), see "TablesTutorial"
> at
> 
>   http://lua-users.org/wiki
> 
> If you are already familiar with C++ you should be able to learn Lua
> rather quickly.



> 
> Parsing CSV in tex is certainly less convenient than in any other
> language.
> 
> It's also difficult to parse CSV because there is no formal
> documentation.  In most cases the field separator is a semicolon
> though the name "CSV" implies something different.  If you want to
> process arbitrary files you have to determine the field separator
> in advance, one way or another.  Even nastier are quoting rules.
> 
> There is no formal specification but you might want to read this
> instead:
> 
>   https://www.ietf.org/rfc/rfc4180.txt
> 
> IMO it's worthwhile to consider Lua because Lua scripts are supported
> by all TeX distributions.
> 
> There is one thing worth to be mentioned: unlike Lua, luatex/texlua
> provide a function string.explode() which is quite helpful when
> parsing CSV files.  This is described in the LuaTeX manual:

In my ragged class ( a spreadsheet with ragged right or variable length
lines ) I ended up with a bunch of ad hoc parsers. One of these tries
to group chars based on class and when reading a text file it
becomes lines of string arrays with each string being delimited
by a change of char class- this good on words pretty often
and I can piece floats back together which tends to be
less effort than writing an accurate parser :) 

I also use "csv" files for name-value pairs per line. The name
is alphanumeric followed by a space and then unparsed text,
which may be sed or awk code, is read in from the rest of the line.



> 
>   texdoc luatex
> 
> Regards,
>   Reinhard
> 
>  > ________________________________________
>  > From: Karl Berry <karl at freefriends.org>
>  > Sent: Sunday, October 2, 2022 5:39 PM
>  > To: marchywka at hotmail.com
>  > Cc: texhax at tug.org
>  > Subject: Re: requesting tugboat articles
>  >
>  > Hi Mike -
>  >
>  >     make Tex tables from csv files.
>  >
>  > The most complete package I know of in this area is Nicola Talbot's
>  > datatool. It's for LaTeX. https://ctan.org/pkg/datatool
>  >
>  > In general, Nicola has created a number of packages that solve
>  > nontrivial problems in approximately complete ways, e.g., texlocale,
>  > texosquery, bib2gls. https://ctan.org/author/talbot
>  >
>  > FWIW ... --best, karl.
>  >
> 
> --
> ------------------------------------------------------------------
> Reinhard Kotucha                            Phone: +49-511-3373112
> Marschnerstr. 25
> D-30167 Hannover                    mailto:reinhard.kotucha at gmx.de
> ------------------------------------------------------------------

-- 

mike marchywka
306 charles cox
canton GA 30115
USA, Earth 
marchywka at hotmail.com
404-788-1216
ORCID: 0000-0001-9237-455X


More information about the texhax mailing list.