Difference between revisions of "Generate Authorlist from Head Content"

From Wiki
Jump to navigation Jump to search
m
 
(10 intermediate revisions by 3 users not shown)
Line 1: Line 1:
== Environment for a German diploma thesis ==
+
An example on how to generate a sorted list of all authors contributed to a conference proceeding.
 
 
This layout do not match the guidelines from the university.
 
  
 
<texcode>
 
<texcode>
 +
\setuphead
 +
  [title]
 +
  [page=no,command=,]
  
\startenvironment env-diplom
+
\setuphead
 
 
 
 
%%%% Language-settings: hyphenation, etc.
 
 
 
 
 
\setuplanguage
 
  [de]
 
  [rightquotation=«,leftquotation=», % use guillemets
 
  rightquote=‹,leftquote=›,
 
  lefthyphenmin=2,  % default: (left|right)hyphenmin=3 (-> lang-ger.tex)
 
  righthyphenmin=2] % z.B. Glau-be
 
   
 
\hyphenation{Ta-d-schi-ki-s-tan}
 
\hyphenation{Kir-gi-si-s-tan}
 
 
 
\mainlanguage[de]
 
 
 
\setupquotation[method=font] % otherwise no expansion, protruding
 
 
 
\definesymbol[1][•] % otherwise lmr is used
 
 
 
\setbreakpoints[compound] % hyphenate compound words
 
 
 
 
 
%% Colors
 
 
 
\definecolor[headcolor]  [s=.1]
 
\definecolor[subheadcolor][s=.3]
 
\definecolor[refcolor]    [r=.5]
 
 
 
 
 
 
 
%%%% Draft-mode (debugging, etc.)
 
 
 
 
 
\startmode[draft] % -> \enablemode[draft]
 
  \synctex=1
 
  % \hbadness=10000 % don't complain underfull hboxes
 
  % \version[temporary] % final|concept|temporary -> Error
 
  \overfullrule=6pt
 
 
 
  \definepalet[layout][grid=blue:4,page=green]
 
 
 
  % \showframe[text] % []
 
  \showgrid
 
 
 
  % \setuppapersize[A4][A4,oversized]
 
 
 
  %% Show 8mm BCOR (Binderand)
 
 
 
  \definelayer
 
    [page]
 
    [width=\paperwidth,
 
    height=\paperheight]
 
 
 
  \setupbackgrounds [leftpage]  [background=page]
 
  \setupbackgrounds [rightpage] [background=page]
 
 
 
  \startsetups binderand:links
 
    \setlayerframed
 
      [page]
 
      [preset=middleright]
 
      [frame=off,
 
      background=color,
 
      backgroundcolor=lightgray,
 
      width=8mm,
 
      height=\paperheight]{}
 
  \stopsetups
 
 
 
  \startsetups binderand:rechts
 
    \setlayerframed
 
      [page]
 
      [preset=middleleft]
 
      [frame=off,
 
      background=color,
 
      backgroundcolor=lightgray,
 
      width=8mm,
 
      height=\paperheight]{}
 
  \stopsetups
 
   
 
  \setupbackgrounds [leftpage]  [setups=binderand:links]
 
  \setupbackgrounds [rightpage] [setups=binderand:rechts]
 
\stopmode
 
 
 
 
 
%% Interaction (references etc.)
 
 
 
\setupinteraction
 
  [state=start,
 
  color=refcolor,
 
  contrastcolor=green,
 
  style=normal, % otherwise bold
 
  title={Gesellschaftsbilder und Selbstverständnis russlanddeutscher
 
    Aussiedler in der Sowjetunion und in Deutschland},
 
  subject={Diplomarbeit in Erziehungswissenschaft, Sozialpädagogik,
 
    Sozialarbeit}, % -> not recognized, why?
 
  keywords={Diplomarbeit in Erziehungswissenschaft, Sozialpädagogik,
 
    Sozialarbeit}, % -> not recognized, why?
 
  author=Katharina Harder] % \getvariable{Diplom}{author}
 
 
 
% \setupinteractionscreen[option=doublesided] % viewer dependent
 
 
 
\placebookmarks[chapter,appchapter,section,appsection,subsection]
 
 
 
 
 
 
 
%%%% Layout
 
 
 
 
 
% | Bund-/Innensteg | Außensteg  | Kopfsteg  | Fußsteg      |
 
% | (backspace)    | (cutspace) | (topspace) | (bottomspace) |
 
% |-----------------+------------+------------+---------------|
 
% | 12.5mm + 8mm    | 22.5mm    | 19.5mm    | 32.5mm        |
 
% | 10mm  + 8mm    | 20mm      | 15mm      | 25mm          |
 
 
 
\setuplayout % default-layout
 
  [width=middle,
 
  height=fit,
 
  topspace=12mm,        % Kopfsteg: 15mm
 
  header=10mm,          % + 10mm Kopf
 
  footer=\headerheight, % Fuß: 10mm + 15mm Fußsteg
 
  backspace=18mm,      % 12.5mm Innensteg + 8mm Binderand
 
  cutspace=20mm,        % Außensteg: 22.5mm
 
  margin=10mm,
 
  margindistance=10pt,
 
  location=doublesided, % if oversized
 
  % lines=59, % 60
 
  grid=tolerant]
 
 
 
 
 
%% Front part layout: inherit all settings besides back- and cutspace
 
 
 
\definelayout [frontpart] [backspace=30.5mm,cutspace=32.5mm]
 
\definelayout [default]  [] % default-layout
 
 
 
 
 
\setupalign[stretch,hz,hanging,verytolerant]
 
 
 
\setupindenting[small,next,yes]
 
 
 
\setupcolumns[distance=1.2em]
 
 
 
%% alternative with columnsets (-> manual balancing)
 
\definecolumnset[two][distance=1em,balancing=yes]
 
% \setupcolumnsetlines[two][page][column][line]
 
 
 
 
 
%% Page numbering
 
 
 
\setuppagenumbering[location=,alternative=doublesided]
 
 
 
\setupuserpagenumber[numberconversionset=pagenumber]
 
 
 
 
 
%% empty page on last chapter pages
 
 
 
\setupsectionblock [frontpart] [page=mychapterpagebreak]
 
\setupsectionblock [appendix]  [page=mychapterpagebreak]
 
\setupsectionblock [bodypart]  [page=mychapterpagebreak]
 
 
 
 
 
%% different layouts for different parts
 
 
 
\startsectionblockenvironment[frontpart] % -> frontmatter
 
  \setuplayout[grid=no]
 
  \setuplayout[frontpart]
 
  \setupuserpagenumber[numberconversion=romannumerals,start=3]
 
  \setupheadertexts[][\setups{rechte:Seite}][\setups{linke:Seite:Anfang}][]
 
\stopsectionblockenvironment
 
 
 
\startsectionblockenvironment[bodypart] % -> bodymatter
 
  \setuplayout[grid=tolerant]
 
  \setuplayout[default]
 
  \setuppagenumber[number=1]
 
  \setupheadertexts[][\setups{rechte:Seite}][\setups{linke:Seite:Hauptteil}][]
 
  \def\Kapitel{Kapitel}
 
\stopsectionblockenvironment
 
 
 
\startsectionblockenvironment[appendix] % -> appendices
 
  \setupheadertexts[][\setups{rechte:Seite}][\setups{linke:Seite:Hauptteil}][]
 
  \def\Kapitel{Anhang}
 
\stopsectionblockenvironment
 
 
 
 
 
%% manualy adjust the inter-word spacing to achieve better (page) breaks
 
%% (perhaps there are better methods!?)
 
 
 
\definetolerancemethod % default space: 2.5pt
 
  [horizontal] [myspace] % .3em ~ 3pt
 
  {\spaceskip.3em plus.2em minus.15em\relax}
 
 
 
\definestartstop
 
  [SloppyPar] % \setuptolerance[myspace,stretch]
 
  [before=\start\doifmode{draft}{\red}, % -> adjust with \looseless±1
 
  after=\stop]
 
 
 
 
 
 
 
%%%% Fonts
 
 
 
 
 
\doiffontpresentelse{LinLibertineO}{\enablemode[Libertine]}{\enablemode[Termes]}
 
 
 
\startmode[Libertine]  % Linux Libertine (Serif) and Linux Biolinum (Sans)
 
  \usetypescriptfile[type-linlibertine]
 
 
 
  \usetypescript[libertine]
 
  \setupbodyfont[libertine,10pt]
 
 
 
  \setupinterlinespace[height=.8,depth=.2,line=2.8ex,stretch=0]
 
\stopmode
 
 
 
\startmode[Termes]  % TeX Gyre Termes (Serif) and TeX Gyre Heros (Sans)
 
  \usetypescript[termes,heros]
 
  \setupbodyfont[termes,10pt]
 
\stopmode
 
 
 
 
 
%% Fonts for heads etc.
 
 
 
\definefont[TitlFont][Serif sa d] % \tfd
 
\definefont[SubjFont][Serif sa b] % \tfb
 
\definefont[NameFont][Serif sa a] % \tfa
 
\definefont[CovrFont][Serif sa a] % \tfa
 
 
 
\definefont[ChapFont][SansBold sa c]    % \ssbfc
 
\definefont[SecFont] [SansBold sa a]    % \ssbfa
 
\definefont[SectFont][SansBold]        % \ssbf
 
\definefont[SubsFont][SansBold]        % \ssbf
 
\definefont[SsubFont][SansBold]        % \ssbf
 
\definefont[ChapNumF][SerifItalic sa a] % \it
 
 
 
 
 
 
 
%%%% Headers
 
 
 
 
 
\def\Seitennummer{\setff{sc}\strut\userpagenumber}
 
 
 
\definetext[ChapterFoot][footer][\Seitennummer]
 
 
 
 
 
\setupframed
 
  [width=broad,
 
  depth=1pt, % -> boffset don't work, why?
 
  frame=off,
 
  bottomframe=on,
 
  framecolor=headcolor,
 
  offset=overlay]
 
 
 
\startsetups linke:Seite:Anfang % -> left page frontmatter-sectionblock
 
  \framed[align=right]{\Seitennummer \hskip3em {\itx \getmarking[chapter]}}
 
\stopsetups
 
 
 
\startsetups linke:Seite:Hauptteil % -> left page bodymatter-sectionblock
 
  \framed[align=right]{\Seitennummer \hskip3em {\itx
 
      {\setff{csc}\WORD{\Kapitel}\space\getmarking[chapternumber]}
 
      \emspace\getmarking[chapter]}}
 
\stopsetups
 
 
 
\startsetups rechte:Seite % -> right page in all sectionblocks
 
  \framed[align=left]{{\itx \getmarking[section]} \hskip3em \Seitennummer}
 
\stopsetups
 
 
 
 
 
 
 
%%%% Heads
 
 
 
 
 
\newsignal\SectionSignal % adds a very small space (use it as a tag)
 
 
 
\def\TestSpace% to reduce the vertical space between two consecutive heads
 
  {\relax\ifdim\lastskip=\SectionSignal \blank[nowhite]
 
  \else \blank \fi}
 
 
 
 
 
%% own head placement
 
 
 
\setupframed
 
  [depth=\zeropoint,
 
  bottomframe=off,
 
  top=\vfill,
 
  bottom=\vfill\vfill]
 
 
 
\def\MyChapCmd#1#2%
 
  {\framed[align=middle,height=6\lineheight]
 
  {{\ChapNumF\Kapitel\,~#1}\blank #2}}
 
 
 
\def\MySubsubsubsecCmd#1#2%
 
  {\framed[align=right]{#1#2}}
 
 
 
 
 
%% new heads in appendix
 
 
 
\definehead [appchapter] [chapter]
 
\definehead [appsection] [section]
 
 
 
\definepagebreak % empty pages without header and footer
 
  [mychapterpagebreak]
 
  [yes,header,footer,right]
 
 
 
 
 
\setupheads[align=right] % align={right,nothyphenated}
 
 
 
\setuphead % Level 1
 
 
   [chapter]
 
   [chapter]
   [header=empty,
+
   [command=\MyChapCMD]
  footer=ChapterFoot,
 
  page=mychapterpagebreak,
 
  grid=high,
 
  textstyle=\ChapFont,
 
  numberstyle=\ChapNumF,
 
  command=\MyChapCmd,
 
  color=headcolor]
 
 
 
\setuphead % Level 1
 
  [title]
 
  [header=empty,
 
  alternative=middle,
 
  before={\blank[force]},
 
  after={\blank[2*big]},
 
  color=headcolor,
 
  textstyle=\ChapFont,
 
  command=\normalplacehead]
 
 
 
\setuphead % Level 2
 
  [section,appsection]
 
  [grid=high,
 
  alternative=normal,
 
  after=\vskip\SectionSignal,
 
  style=\SecFont, % \setupinterlinespace[2.6ex] -> disturbs the grid
 
  color=headcolor]
 
 
 
\setuphead % Level 3
 
  [subsection,subsubject]
 
  [before=\TestSpace,
 
  style=\SectFont,
 
  color=headcolor]
 
 
 
\setuphead % Level 4
 
  [subsubsection,subsubsubject]
 
  [before=\blank,
 
  after=\vskip\SectionSignal,
 
  style=\SubsFont,
 
  color=headcolor]
 
 
 
\setuphead % Level 5
 
  [subsubsubsection,subsubsubsubject]
 
  [grid=high,
 
  % alternative=MySecPlacement,
 
  command=\MySubsubsubsecCmd,
 
  before=\TestSpace,
 
  after=\vskip\SectionSignal,
 
  color=subheadcolor,
 
  number=no]
 
 
 
 
 
 
 
%%%% Table of contents
 
 
 
 
 
\setupheadtext[de][content=Inhaltsverzeichnis] % default: Inhalt
 
 
 
\definecombinedlist
 
  [content]
 
  [chapter,section,subsection,subsubsection,subsubsubsection]
 
  [criterium=all,
 
  numberstyle=,
 
  pagestyle=]
 
 
 
\setupcombinedlist
 
  [content]
 
  [numberstyle=\setff{tnum}] 
 
 
\definecombinedlist
 
  [appendix-content]
 
  [appchapter,appsection]
 
  [level=appsection,criterium=all]
 
 
 
  
 
\setuplist
 
\setuplist
   [chapter,appchapter]
+
   [chapter]
   [style=\bf,
+
   [criterium=all,alternative=command,command=\MyChapListCMD]
  before={\blank[2*big]},
 
  after=\blank,
 
  pagenumber=yes,
 
  headnumber=no]
 
 
 
\setuplist
 
  [section,appsection]
 
  [alternative=c]
 
  
\setuplist
+
\definesorting[author][authors]
  [subsection,subsubsection]
+
\setupsorting [author][criterium=all,expansion=yes]
  [before={\blank[medium]},
 
  after={\blank[small]},
 
  width=3em,
 
  alternative=c]
 
  
\setuplist
+
\define[2]\MyChapCMD
  [subsubsubsection]
+
{#1\enspace #2
  [alternative=d,
+
  {\doifsomething
  align={right,hz},
+
      {\structureuservariable{author}}
  margin=3em,
+
      \expanded{\author
  style=\it,
+
        [\structureuservariable{name}] % -> sorted by "name"-variable
  pagestopper={~\subheadcolor\char"25A0}]
+
        {\bTABLE[width=broad]
 +
          \bTR
 +
            \bTD \structureuservariable{author} \eTD
 +
            \bTD \structureuservariable{city}   \eTD
 +
            \bTD \structureuservariable{date}  \eTD
 +
            \bTD \structureuservariable{email}  \eTD
 +
            \bTD \structureuservariable{note}  \eTD
 +
          \eTR
 +
        \eTABLE\nointerlineskip}%
 +
        \tfxx (\structureuservariable{author}, \structureuservariable{city})}}}
  
 +
\define[3]\MyChapListCMD
 +
  {#1 #2 (\structurelistuservariable{author})\hfill  #3\blank}
  
  
%%%% Citatations and footnotes
+
\starttext  \showframe[text]
  
 +
\starttitle[title=Contents]
 +
  \placelist[chapter]
 +
\stoptitle
  
\def\ellipsis{[] } % otherwise [] is seen as option (-> blockquote)
+
\starttitle[title=List of Authors in Alphabetical Order]
 +
  \placelistofauthors
 +
\stoptitle
  
% to avoid doubled reference-labels inside blockquote-environments
+
\startchapter
% with \getMyCite, redefine them (-> page-lin.mkiv)
+
  [title=Text by Ward]
\def\mystartlinereference#1{\mksomelinereference{#1}{lra:b:#1}{\mkshowstartlinereference{#1}}\ignorespaces}
+
  [name=ward,
\def\mystoplinereference #1{\removeunwantedspaces\mksomelinereference{#1}{lra:e:#1}{\mkshowstoplinereference{#1}}}
+
  author=Peter D. Ward,
 +
  city=Washington,
 +
  email=ward@sample.com]
  
\startsetups blockquote:setup
+
   \input ward
  \setupindenting[no]%
+
\stopchapter
  \let\mkstartlinereference\mystartlinereference
 
   \let\mkstoplinereference\mystoplinereference 
 
\stopsetups
 
  
\setupdelimitedtext
+
\startchapter
   [blockquote]  
+
   [title=Text by Zapf]
   [before=\setups{blockquote:setup},
+
   [name=zapf,
   leftmargin=1em,
+
   author=Hermann Zapf,
   rightmargin=0em,  
+
   city=Nürnberg,
   spaceafter=,]  
+
   date=8. November 1918,
 +
  email=zapf@sample.de]
  
\setupnote
+
   \input zapf
  [footnote]
+
\stopchapter
  [command=,   % -> numbercommand
 
  textstyle=, % -> textcommand
 
  location=lastcolumn,
 
  align={hz,hanging,stretch},
 
  margindistance=0.125em,
 
  numbercommand=\setff{sups}, % use superscript-figures
 
  textcommand=\setff{sups}]
 
  
 +
\startchapter
 +
  [title=Text by Bryson]
 +
  [name=bryson,
 +
  author=Bill Bryson,
 +
  city=Norfolk,
 +
  date={December 8, 1951},
 +
  note=best-selling American author]
  
 +
  \input Bryson
 +
\stopchapter
  
%%%% Miscellaneous
+
\startchapter
 +
  [title=Text by Tufte]
 +
  [name=tufte,
 +
  author=Edward R. Tufte,
 +
  city=Kansas City,
 +
  date=1942,
 +
  note=has criticized the way Microsoft PowerPoint is typically used]
  
 +
  \input tufte
 +
\stopchapter
  
%% smaller thinspace (-> \,)
+
\stoptext
\def\thinspace{\kern.5\interwordspace} % \let\,\thinspace
 
  
\def\Paraphe{} % initials
+
</texcode>
\def\Antwort{{\bf \Paraphe:}\ \ }
 
\def\Frage{{\bf I:}\ \ }
 
  
 
+
[[Category:Sample documents]]
%% Quote from appendix
 
 
 
\setuplinenumbering
 
  [color=subheadcolor,
 
  step=5,
 
  style={\setff{lf}\tfxx}] % use lining figures
 
 
 
\definestartstop
 
  [Linenumbering] % no indenting in line-numbered text
 
  [before={\startlinenumbering\setupindenting[no]},
 
  after=\stoplinenumbering]
 
 
 
 
 
\def\startMyCite[#1]% with help form Wolfgang Schuster
 
  {\def\stopMyCite
 
    {\startline[#1]\getbuffer[#1]\stopline[#1]\savebuffer[#1]}%
 
    \dostartbuffer[#1][startMyCite][stopMyCite]}
 
 
 
\def\getMyCite[#1]{%\doifmode{draft}{\inothermargin{{\darkred Zitat\blank #1}}}
 
  \ReadFile{\jobname-#1.tmp} (\at{S.\!}[lr:b:#1], \inline{Z.\!}[#1])}
 
 
 
 
 
 
 
%%%% Bibliography (not used)
 
 
 
 
 
\stopenvironment
 
 
 
%%% Local Variables:
 
%%% mode: context
 
%%% TeX-master: t
 
%%% End:
 
 
 
 
 
</texcode>
 

Latest revision as of 14:24, 8 June 2020

An example on how to generate a sorted list of all authors contributed to a conference proceeding.

\setuphead
  [title]
  [page=no,command=,]

\setuphead
  [chapter]
  [command=\MyChapCMD]

\setuplist
  [chapter]
  [criterium=all,alternative=command,command=\MyChapListCMD]

\definesorting[author][authors]
\setupsorting [author][criterium=all,expansion=yes]

\define[2]\MyChapCMD
 {#1\enspace #2
   {\doifsomething
      {\structureuservariable{author}}
      \expanded{\author
        [\structureuservariable{name}] % -> sorted by "name"-variable
        {\bTABLE[width=broad]
           \bTR
             \bTD \structureuservariable{author} \eTD
             \bTD \structureuservariable{city}   \eTD
             \bTD \structureuservariable{date}   \eTD
             \bTD \structureuservariable{email}  \eTD
             \bTD \structureuservariable{note}   \eTD
           \eTR
         \eTABLE\nointerlineskip}%
         \tfxx (\structureuservariable{author}, \structureuservariable{city})}}}

\define[3]\MyChapListCMD
  {#1 #2 (\structurelistuservariable{author})\hfill  #3\blank}


\starttext  \showframe[text]

\starttitle[title=Contents]
  \placelist[chapter]
\stoptitle

\starttitle[title=List of Authors in Alphabetical Order]
  \placelistofauthors
\stoptitle

\startchapter
  [title=Text by Ward]
  [name=ward,
   author=Peter D. Ward,
   city=Washington,
   email=ward@sample.com]

  \input ward
\stopchapter

\startchapter
  [title=Text by Zapf]
  [name=zapf,
   author=Hermann Zapf,
   city=Nürnberg,
   date=8. November 1918,
   email=zapf@sample.de]

  \input zapf
\stopchapter

\startchapter
  [title=Text by Bryson]
  [name=bryson,
   author=Bill Bryson,
   city=Norfolk,
   date={December 8, 1951},
   note=best-selling American author]

  \input Bryson
\stopchapter

\startchapter
  [title=Text by Tufte]
  [name=tufte,
   author=Edward R. Tufte,
   city=Kansas City,
   date=1942,
   note=has criticized the way Microsoft PowerPoint is typically used]

  \input tufte
\stopchapter

\stoptext