Hello On Fri, Oct 28, 2011 at 4:59 AM, Andrew Parsloe <apars...@clear.net.nz> wrote: > Rainer, > > In my view spreadtab is exactly what you are after, but not 'out of the box' > because you will be immersed in ERT and it will hardly seem worth it. I > created a LyX module earlier in the year to aid using spreadtab. Since then > spreadtab has been updated (and gained a command for LyX users through my > nagging the developer Christian Tellechea). Unfortunately, the changes in > the newer spreadtab (v.0.4a) mean the earlier module won't work with the new > version. I've had updating this on my mind for the last 3 months but other > work has got in the way. Your request has spurred me to action and I include > at the bottom of this email the revised module which will work with > spreadtab 0.4 (but not 0.3). > Would you consider uploading both versions on the wiki [1]?
Regards Liviu [1] http://wiki.lyx.org/Layouts/Modules#toc6 > If you copy this to a text editor and save as spreadtab.module in your user > directory for LyX layouts (in Windows on my machine, > C:\Users\Andrew\AppData\Roaming\LyX2.0\layouts) and reconfigure LyX so it > recognises the new module, then all you need to do for your quote is > something like the following. Create a table in LyX like so, > > `Main task1 `Secondary task1.1 30.00 > `Secondary task1.2 20.00 > `Secondary task1.3 50.00 > `Main task2 `Secondary task2.1 30.75 > `Secondary task2.2 20.50 > `Secondary task2.3 50.00 > `Total sum(c1:c6) > > or something similar, position the cursor hard before the table and from the > drop-down list of environments select sLTable, nestling at the bottom with > sLTablePlus. Now when you produce the pdf you will find the sum of the > figures totalled in the bottom-right cell. (Note the grave accents ` in the > first two columns -- they show spreadtab that these are text cells, not > numeric ones. As in spreadsheets the columns are a, b, c, ... and the rows > 1, 2, 3, ...) In this case no ERT is needed at all. > > ERT is needed if you want to multiply figures because the multiply symbol * > is 'protected' by LyX -- if you look at View Source you'll see it is > enclosed in braces {*} which confuses spreadtab. In that case the formula > does need to be in ERT. The same goes for some other operations, but > addition, subtraction and division can be managed without any ERT. > > I've attached a file SpreadtabWithLyX in 7-zipped format (9 pages when > compiled to pdf) which has other instructions (e.g. number formatting). > > Andrew > > ************************************ > #\DeclareLyXModule[spreadtab.sty,fp.sty,xstring.sty]{Spreadtab} > #DescriptionBegin > #Adds commands which convert LyX tables to spreadtab tables. These > #allow columns of numbers to be summed and other spreadsheet-like > #calculations. The tables are built in LyX using its table toolbar. > #The calculated values appear only in the pdf (ps, dvi etc) document > #not in LyX. A one-celled table provides a calculator of sorts. > #DescriptionEnd > # > #v.1.1 2011-10-28 > #Assumes version 0.4a of spreadtab.sty and > #will fail with 0.3 and earlier versions. > #Author: Andrew Parsloe <apars...@clear.net.nz> > #The author & maintainer of spreadtab.sty is > #Christian Tellechea <unbonpe...@gmail.com> > > Format 35 > > AddToPreamble > \usepackage{spreadtab} > %for LyX > \STeol{\tabularnewline} > %default text cell marker is @ but ` is neater > \renewcommand{\STtextcell}{`} > EndPreamble > > Style sLTable > Category Tables > LatexType Command > LatexName sLTable > OptionalArgs 1 > NextNoIndent 0 > TopSep 0.5 > BottomSep 0.5 > Align Center > Preamble > \makeatletter > > \def\sLt@b[#1]#2\begin#3#4#5\end#6{\spreadtab[#1]{{#3}{#4}}#5\endspreadtab} > \newcommand{\sLTable}[2][]{\begin{center}\sLt@b[#1]#2\end{center}} > \makeatother > EndPreamble > End > > Style sLTablePlus > CopyStyle sLTable > LatexName sLTablePlus > Preamble > \makeatletter > > \def\sLt@bplus[#1]#2\begin#3#4#5\end#6{\spreadtab[#1]{{#3}{#2}}#5\endspreadtab} > > \newcommand{\sLTablePlus}[3][]{\begin{center}\sLt@bplus#1#2#3\end{center}} > \makeatother > EndPreamble > End > > InsetLayout Flex:sLCalculate > LyXType custom > LatexType Command > LatexName sLdocalc > ContentAsLabel 1 > Decoration Classic > Display 0 > LabelString Calc > Multipar 0 > PassThru 1 > ResetsFont 0 > Preamble > \def\sLdocalc#1{\mbox{\kern -.6em% > > \spreadtab[\STsavecell\sLlastcalc{a1}]{{tabular}{c}}#1\tabularnewline\endspreadtab% > \kern -.6em}% > } > EndPreamble > End > > InsetLayout Flex:sLNumberFormat > LyXType custom > LatexType Command > LatexName sLdoNF > ContentAsLabel 1 > Decoration Classic > Font > Color phantomtext > End > Display 0 > LabelString Fmt > Multipar 0 > PassThru 1 > ResetsFont 0 > Preamble > \def\sLdoNF#1{\sLdofmt#1} > \def\sLdofmt#1,#2{\def\sLsigfig{#1}% > \if*#2\def\sLfillzeros{*}\else\def\sLfillzeros{}\fi% > \expandafter\STautoround\sLfillzeros{\sLsigfig}} > EndPreamble > End > > > -- Do you know how to read? http://www.alienetworks.com/srtest.cfm http://goodies.xfce.org/projects/applications/xfce4-dict#speed-reader Do you know how to write? http://garbl.home.comcast.net/~garbl/stylemanual/e.htm#e-mail