\startenvironment env_sample
\project project_sample

\enableregime		[il1] % input file encoding ISO 8859-1 (Latin1)
\mainlanguage		[de] % german hyphenation
\setupencoding		[default=texnansi] % preferred font encoding

% font definitions
\usetypescriptfile		[type-ubuch] % name of file with typescripts
\usetypescript		[fiee][ubuch] % name of typescript with type family definition
\setupbodyfont		[ubuch,rm,10pt] % defined font family, roman, size
\setupbodyfontenvironment[default][em=italic] % default is slanted

\setupindenting		[\bodyfontsize] % first line indent of paragraphs

\setupalign			[hanging] % hanging puctuation (doesn't work for me)

% hyphenation
\setuptolerance		[{horizontal, verytolerant},{vertical, verystrict}]
\clubpenalty=8000 % keine Schusterjungen
\widowpenalty=8000 % keine Hurenkinder
%\tolerance=1750 % Zeilenumbruch-Toleranz (ca. 500--3000)
%\emergencystretch=10 pt % zus"atzlich ver"anderbarer Raum pro Zeile

% titling hierarchy
\setupheads			[sectionnumber=no, align=right,
					page=no, style=\bf, tolerance=verytolerant]
\setuphead			[part]
					[style={\ss\bfc}, page=yes, number=yes,
					frame=off, placehead=yes, align=right,
					before={},
					after=\blank, header=empty]
\setuphead			[chapter]
					[style={\ss\bfb}, header=empty, page=no,
					before={\vfil\blank}, after={}, align=right]
\setuphead			[title][chapter]
\setuphead			[subject]
					[style={\ss\bf}, before=\blank, after=\blank]
%\setuphead		[subsubject]	[style=\bf]

% table of contents
\definelist			[part]
\setuplist				[part]
					[before=\blank, style={\ss\bf},
					partnumber=no, pagenumber=no,
					margin=0pt, width=0pt, distance=0pt]
\definelist			[chapter]
\setuplist				[chapter]
					[alternative=b, partnumber=no, criterium=all,
					margin=0pt, width=0pt, distance=0pt, limittext={}]
\definecombinedlist	[myToC]
					[part, chapter]
					[level=chapter, placehead=yes, criterium=all,
					style={\tfc\em}, alternative=b,
					offset=none]
\setupcombinedlist	[myToC]
					[partnumber=no,
					interaction=all]
\setupregister			[index]
					[partnumber=no, criterium=all,
					pagestyle={\tf}, 
					style={\WORD}, %indicator=no, 
					interaction=pagenumber,
					align=yes] %balance=no

% my own paper size, placed on A4 for correction
% use texexec with --mode=correction
\definepapersize		[UBuch]	[width=138mm, height=212mm]
\startmode[correction]
	\setuppapersize		[UBuch]	[A4] %,landscape]
\stopmode
\startnotmode[correction]
	\setuparranging		[2SIDE] % page imposition
	\setuppapersize		[UBuch]	[UBuch]
\stopnotmode

\setuplayout			[alternative=doublesided,
					location=middle,
					grid=yes, marking=on,
					backspace=13mm, width=105mm,
					leftmargindistance=0pt,
					topspace=13mm,
					header=15pt, headerdistance=12pt,
					footer=18pt,
					textheight=11.5mm]
% page header					
\setupheader		[text][state=stop] 
\setupheadertexts		[][chapter][part][]
\setupheader		[leftwidth=.8\hsize, rightwidth=.8\hsize]
\setupbackgrounds		[header][text][frame=off, bottomframe=on] % rule below header

\setuppagenumbering	[alternative=doublesided,
					partnumber=no, sectionnumber=no, way=bytext,
					location={text,footer,right}]
\setuppagenumber		[state=start]
\setupfootnotes		[way=bypage]%, location={footer}]

% some Hraban specials...
\def\dots{\thinspace.\thinspace.\thinspace.\thinspace} % normal ellipsis has too wide spacing
\def\FIEEvis{{\it fi\"e\'e visu\"elle}} % my "logo"
\def\Tindex#1{\index{#1}#1}	% word to index and text
\def\Person#1#2{\index{#2, #1}#1 #2}	% names to index and text
\def\Anleser#1{{\ss #1}} % logical markup -- I didn't knew how the publisher wanted introductions to look
\def\Autor#1{\blank[small] \hfill #1}	% author right aligned

% (the publisher wished other entries in header and ToC than the titles)
\def\NurLang#1{\nomarking{\nolist{#1}}}	% nicht in die Kopfzeile, nicht ins Inhaltsverzeichnis
\def\ExtraTOCline#1{\writebetweenlist[chapter]{\placeongrid{\noindent #1}}}
\def\Untertitel#1{\blank[3pt]{\ss\bf #1}\blank} % Subtitle
\def\Titel#1#2{{\nohyphens\chapter{#1}\Untertitel{#2}}} % combination of title and subtitle
\def\KomplexTitel#1#2#3{%
{\writetolist[chapter]{#3}{}%
\nohyphens\title{#1}%
\Untertitel{#2}}}

% Internet link that should show its address
\def\ILink#1{\goto{#1}[URL(http://#1)]}

\setupmarking	[chapter][limittext={}] % \nomarking without ellipsis (...)

% chaptermarks
\definestartstop	[Anmerkung]	[before={\vfill\startlinecorrection\vbox\bgroup\switchtobodyfont[ss,8pt]\noindent},
				after={\egroup\stoplinecorrection}]	% kleiner, am Fuß der Seite
% images
\setupfloats			[width=fit, align=right]
\setupexternalfigures	[directory={./img}] % path for images
\setupcaptions		[number=no, align=right,
					before={\blank[3pt]}, 
					after={\blank[small]}, style={\ss\tfx}]
\setupcombinations	[width=fit, align=right, style={\ss\tfx}] % combinations are several images together

\stopenvironment

