diff options
author | Hans Hagen <pragma@wxs.nl> | 2017-09-21 21:43:12 +0200 |
---|---|---|
committer | Context Git Mirror Bot <phg42.2a@gmail.com> | 2017-09-21 21:43:12 +0200 |
commit | f7ee609d470a08a16e5cdaad14582fc8ed993c5e (patch) | |
tree | 56f85523ff7b19d926d026f470bb2c75d192e23b /doc/context/sources/general/manuals | |
parent | 772472f057060460c83828cf7fd1631298165e37 (diff) | |
download | context-f7ee609d470a08a16e5cdaad14582fc8ed993c5e.tar.gz |
2017-09-21 21:10:00
Diffstat (limited to 'doc/context/sources/general/manuals')
3 files changed, 217 insertions, 0 deletions
diff --git a/doc/context/sources/general/manuals/details/details-floatingaround.tex b/doc/context/sources/general/manuals/details/details-floatingaround.tex index 11fe0601c..719819fb6 100644 --- a/doc/context/sources/general/manuals/details/details-floatingaround.tex +++ b/doc/context/sources/general/manuals/details/details-floatingaround.tex @@ -1132,6 +1132,169 @@ The black rules are set up with: \setupbackgrounds [text] [leftmargin] [background=] \setupbackgrounds [text] [rightmargin] [background=] +We will now demonstrate some features in a way that makes it possible to +compare to the simple default case. Options can be passed as keywords: + +\starttyping +\placefigure + [left,...] + [fig:whatever] + {caption} + {content} +\stoptyping + +or as settings: + +\starttyping +\startplacefigure + [default={left,...}, + title=caption, + reference=fig:whatever] + + content + +\stopplacefigure +\stoptyping + +It is important to realize that all that spacing can interfere with additional +hard coded corrections at the users end. We don't show the effects of \type +{sidespacebefore} and \type {sidespaceafter}, the two general vertical spacing +hooks. These are currently set to {\tttf \rootfloatparameter {sidespacebefore}} +and {\tttf \rootfloatparameter {sidespaceafter}} respectively. The \type +{sidealign} parameter is always winning from a keyword doing the same. + +The last few examples demonstrate that you can define an instance. Often that's +the best way to deal with special cases in a consistent way. For instance: + +\starttyping +\definefloat + [LeftTwo] + [figure] + +\setupfloat + [LeftTwo] + [default=left, + sidealign=line] +\stoptyping + +First we show some keyword variant, next some parameter driven versions. + +\def\SampleKeyword#1% + {\setbuffer[foo] + \useMPlibrary[dum] + \setupbodyfont[dejavu] + \setuplayout[page] + \placefigure[left]{}{\externalfigure[dummy]} \samplefile{sapolsky} \samplefile{sapolsky} + \placefigure[#1] {}{\externalfigure[dummy]} \samplefile{sapolsky} \samplefile{sapolsky} + \endbuffer + \framed + [background=color,backgroundcolor=white] + {\scale + [width=.45\textwidth] + {\typesetbuffer[foo]}}} + +\def\SampleSettings#1#2#3% + {\setbuffer[foo] + \useMPlibrary[dum] + \setupbodyfont[dejavu] + \setuplayout[page] + \definefloat[#1][figure] + \setupfloat[#1][default=left] + \definefloat[#2][figure] + \setupfloat[#2][#3] + \startplacefloat[#1] \externalfigure[dummy] \stopplacefloat \samplefile{sapolsky} \samplefile{sapolsky} + \startplacefloat[#2] \externalfigure[dummy] \stopplacefloat \samplefile{sapolsky} \samplefile{sapolsky} + \endbuffer + \framed + [background=color,backgroundcolor=white] + {\scale + [width=.45\textwidth] + {\typesetbuffer[foo]}}} + +\startbuffer[LeftOne] +\definefloat[LeftOne][figure] + +\setupfloat + [LeftOne] + [default=left] +\stopbuffer + +\startbuffer[LeftTwo] +\definefloat[LeftTwo][figure] + +\setupfloat + [LeftTwo] + [default=left, + sidealign=line] +\stopbuffer + +\startbuffer[LeftThree] +\definefloat[LeftThree][figure] + +\setupfloat + [LeftThree] + [default={left,2*line}] +\stopbuffer + +\startbuffer[LeftFour] +\definefloat[LeftFour][figure] + +\setupfloat + [LeftFour] + [default={left}, + topoffset=5pt] +\stopbuffer + +\startbuffer[LeftFive] +\definefloat[LeftFive][figure] + +\setupfloat + [LeftFive] + [default={left}, + bottomoffset=5pt, + topoffset=5pt] +\stopbuffer + +\startlinecorrection +\startcombination[2*2] + {\SampleKeyword{left,high}} {\type{left,high}} + {\SampleKeyword{left,low}} {\type{left,low}} + {\SampleKeyword{left,high,low}} {\type{left,high,low}} + {\SampleKeyword{left,fit}} {\type{left,fit}} +\stopcombination +\stoplinecorrection + +\startlinecorrection +\startcombination[2*2] + {\SampleKeyword{left,halfline}} {\type{left,halfline}} + {\SampleKeyword{left,height}} {\type{left,height}} + {\SampleKeyword{left,depth}} {\type{left,depth}} + {\SampleKeyword{left,grid}} {\type{left,grid}} +\stopcombination +\stoplinecorrection + +\startlinecorrection +\startcombination[2*2] + {\SampleKeyword{left,line}} {\type{left,line}} + {\SampleKeyword{left,1*line}} {\type{left,1*line}} + {\SampleKeyword{left,2*line}} {\type{left,2*line}} + {\SampleKeyword{left,3*line}} {\type{left,3*line}} +\stopcombination +\stoplinecorrection + +\startlinecorrection +\startcombination[2*2] + {\SampleSettings{LeftOne}{LeftTwo} {default={left,line}}} + {\typ{default={left,line}}} + {\SampleSettings{LeftOne}{LeftThree}{default={left,2*line}}} + {\typ{default={left,2*line}}} + {\SampleSettings{LeftOne}{LeftFour} {default=left,topoffset=5pt}} + {\typ{default=left, topoffset=5pt}} + {\SampleSettings{LeftOne}{LeftFive} {default=left, topoffset=5pt, bottomoffset=5pt}} + {\typ{default=left, topoffset=5pt, bottomoffset=5pt}} +\stopcombination +\stoplinecorrection + \stopchapter \stopcomponent diff --git a/doc/context/sources/general/manuals/luatex/luatex-modifications.tex b/doc/context/sources/general/manuals/luatex/luatex-modifications.tex index 10b4fd7a4..af2c69363 100644 --- a/doc/context/sources/general/manuals/luatex/luatex-modifications.tex +++ b/doc/context/sources/general/manuals/luatex/luatex-modifications.tex @@ -1255,6 +1255,28 @@ previous code (that mostly used \type {getc} calls), it can be quite a bit faste \stopsubsection +\startsubsection[title=Tabs and spaces] + +We conform to the way other \TEX\ engines handle trailing tabs and spaces. For +decades trailing tabs and spaces (before a newline) were removed from the input +but this behaviour was changed in September 2017 to only handle spaces. We are +aware that this can introduce compatibility issues in existing workflows but +because we don't want too many differences with upstream \TEXLIVE\ we just follow +up on that patch (which is a functional one and not really a fix). It is up to +macro packages maintainers to deal with possible compatibility issues and in +\LUATEX\ they can do so via the callbacks that deal with reading from files. + +The previous behaviour was a known side effect and (as that kind of input +normally comes from generated sources) it was normally dealt with by adding a +comment token to the line in case the spaces and|/|or tabs were intentional and +to be kept. We are aware of the fact that this contradicts some of our other +choices but consistency with other engines and the fact that in \KPSE\ mode a +common file \IO\ layer is used can have a side effect of breaking compatibility. +We still stick to our view that at the log level we can (and might be) more +incompatible. + +\stopsubsection + \stopsection \stopchapter diff --git a/doc/context/sources/general/manuals/publications/publications-database.tex b/doc/context/sources/general/manuals/publications/publications-database.tex index 13663b1b5..675a28286 100644 --- a/doc/context/sources/general/manuals/publications/publications-database.tex +++ b/doc/context/sources/general/manuals/publications/publications-database.tex @@ -531,6 +531,38 @@ that these programs are not standards and many of them may introduce invalid extensions that might not even be handled correctly by \BIBTEX\ itself. \stopaside +Here is an example of a loader. Each loader takes two arguments, a dataset +identifier and a filename. The \LUA\ loader takes an extra optional argument: a +function that returns a \LUA\ table. Here we use one of the loaders present in +\CONTEXT: + +\starttyping +\startluacode + function publications.loaders.json(dataset,filename) + publications.loaders.lua(dataset,filename,utilities.json.load) + end +\stopluacode +\stoptyping + +Here is an easy way to debug your own functions: + +\starttyping +\startluacode + local function myloader(filename) + inspect(filename) -- shows the full filename used + local result = { + -- loaded entries + } + inspect(result) -- shows the loaded data + return result + end + + function publications.loaders.json(dataset,filename) + return publications.loaders.lua(dataset,filename,myloader) + end +\stopluacode +\stoptyping + \stopsection \stopchapter |