===== TeX =====
...is all about typesetting for pdf and svg outputs. It takes metapost symbols and cave data supplied by Therion and puts it all together on the 'page'.\\
[[https://en.wikibooks.org/wiki/TeX|WikiBooks TeX]] -- basic -- on the bottom of the page there are several links to documentation of TeX:\\
[[http://www.tug.org www.tug.org| TeX Users Group]]\\
[[http://ctan.tug.org/tex-archive/info/gentle/gentle.pdf| Michael Doob's guide to TeX]] and [[https://ksp.mff.cuni.cz/encyklopedie/jemny-uvod-do-TeXu.pdf| Czech version]]\\
[[http://mirrors.ctan.org/info/impatient/book.pdf| TeX for the Impatient]]\\
[[http://webpages.charter.net/davidlha/trm.html| TeX Primitive Control Sequences]] -- TeX Reference Manual\\
[[https://bitbucket.org/VictorEijkhout/tex-by-topic/downloads/TeXbyTopic.pdf|TeX by Topic]] -- Book by Victor Eijkhout that has been made freely available\\
[[https://en.wikibooks.org/wiki/LaTeX/Plain_TeX|WikiBooks LaTeX/Plain_TeX]] -- a bit too advanced
>>>>(include some generic tex links here)
**All macros and predefined boxes (like \scalebar) are described
in the `Page layout in the map mode' chapter of the recent thbook**\\
>>>>(Can we link directly to the chapter directly in the on-line thbook?
====How to get Therions TeX code (and Metapost code) ====
[[metapost#how_to_get_therions_metapost_code_and_tex_code|How to get Therions TeX Code]]
-----
-----
====Changing the look or layout of a map output====
**How can I insert the logo of my speleo club in map? (Martin Budaj)**
Currently it's possible using the following in the layout:
code tex-map
\def\loadpicture#1{\pdfximage{#1}\pdfrefximage\pdflastximage}
\def\maplayout{
\legendbox{0}{100}{NE}{\the\legendcontent}
\legendbox{100}{100}{NW}{\loadpicture{/absolute/path/to/file.png}} %%% pdf, png, jpg supported
}
The first three arguments of \legendbox macro are the same as of map-header command.
Note: If you use an absolute path then your therion file may not be portable to other users. Instead of the absolute path in your therion file you can use just the 'file.png" and set the absolute path in the TEXINPUTS env variable.
export TEXINPUTS=.:/absolute/path/to/folder//:
The first dot means the current directory will be searched first.
At the end the %%//%% means that TeX programs will search recursively in that folder.
The final trailing colon means "append the standard value of TEXINPUTS".
At least now you can tell another user to set the TEXINPUTS and not edit your therion file. ( On Linux you can put the logo under a directory images/ and do: ''"export TEXINPUTS=.:`pwd`%%//%%:"'' )
-----
**Example of modification of header of map (Martin Budaj)**
code tex-map
\def\maplayout{
\legendbox{0}{100}{NW}{\northarrow\scalebar}
\legendbox{100}{100}{NW}{\scalebar}
}
it produces two headers for one map (one in the upper-left, second in the
upper-right corner) -- one arrow and two scale-bars -- just for an
illustration. You may use any number of \legendbox'es inside of \maplayout
definition.
-----
**Width of Header (Andrew Atkinson from email by Martin Budaj)**
The standard Header can be controlled by
legend-width 20 cm
or
code tex-map
\legendwith=20 cm
The value of \legendwith is evaluated only in the predefined macro
\legendcontent which prints the complete legend. With
\legendbox customisation you need to set the width of the \legendbox with \hsize
\legendbox{60}{10}{nw}{
\hsize=\legendwidth %% or directly e.g. \hsize=5 cm
\northarrow
\bigskip
\scalebar
\bigskip
\bigskip
\the\comment
}
\hsize default is the width of map without margins.
-----
**To separate out legend, scale bar and north arrow (Andrey Kozhenkov)**
This Tex code separates out legend, north arrow and scale bar and can place them in specified position.
Please note that invoking custom legend will cause map-image to fail. Instead of that \loadpicture command with full path to image can be used as shown below.
code tex-map
}
\legendbox{85}{95}{NW}{ % set legend position
\legendwidth 25 cm % set width of the legend
\legendtextsize={\size[18]} % set font size
\hsize=\legendwidth
\input th_legend
}
\legendbox{15}{95}{NW}{\northarrow} % set north arrow position
\legendbox{50}{5}{NW}{\scalebar} % set scale bar position
\legendbox{5}{95}{NW} {\loadpicture{/full/path/to/image.png}} % insert image. default map image command will not work.
}
endcode
-----
**To change the size of font for name of cave (Martin Budaj)**
code tex-map
\legendcontent={%
\hsize=\legendwidth
\ifnortharrow\vbox to 0pt{\line{\hfil\northarrow}\vss}\fi
\edef\tmp{\the\cavename} \ifx\tmp\empty \else
{\size[26]\the\cavename} \vskip1cm
\fi
\ifscalebar\scalebar\vskip1cm\fi
{\rightskip=0pt plus 3em\parskip=3bp
\edef\tmp{\the\comment} \ifx\tmp\empty \else
{\size[12]\the\comment} \par\medskip
\fi
\everypar{\hangindent=2em\hangafter=1}
\edef\tmp{\the\cavelength} \ifx\tmp\empty \else
{\size[12]\si\the\cavelengthtitle: \ss\the\cavelength\par}
\fi
\edef\tmp{\the\cavedepth} \ifx\tmp\empty \else
{\size[12]\si\the\cavedepthtitle: \ss\the\cavedepth\par}
\fi
\edef\tmp{\the\exploteam} \ifx\tmp\empty \else
{\size[12]\si\the\explotitle:
\ss\the\exploteam\quad\si\the\explodate\par}
\fi
\edef\tmp{\the\topoteam} \ifx\tmp\empty \else
{\size[12]\si\the\topotitle: \ss\the\topoteam\quad\si\the\topodate\par}
\fi
\edef\tmp{\the\cartoteam} \ifx\tmp\empty \else
{\size[12]\si\the\cartotitle:
\ss\the\cartoteam\quad\si\the\cartodate\par}
\fi
\edef\tmp{\the\copyrights} \ifx\tmp\empty \else
{\size[12]\ss\the\copyrights\par}
\fi
}
\formattedlegend
}
where default *\size[26]* before *\the\cavename* change to another size.
-----
**Add thedegree symbol (°) to the map-comment (Stacho Mudrak)**
code tex-map
\comment={\vbox{\halign{#\hfil\cr\thfa Coordinates: $30\,^{\circ}$ \cr
Line 2 of map comment.\cr}}{}}
endcode
Stacho \\
On my system this produces...
цООРДИНАТЕС 30 ◦ \\
Line 2 of map comment.
So I'm guessing that the tex code is supposed to make some kind of box on the top line, then maybe a change of language?, then $30\,^{\circ}$ produces 30 ◦, then a new line.
Seems there is more to explain here wrt the language...
Bruce
-----
**Map Border (Bruce Mutton)** Feb 2010 versions 5.2 to 5.3...
The description in the Therion Book was too abbreviated for me for the first two years!
Here is how to add the map border tex code to your layout.
#CODE TO PUT BORDER AROUND MAP
#-----------------------------
layout LayoutMapBorder
code tex-map
\framethickness=0.5mm
endlayout LayoutMapBorder
-----
-----
====Overriding Data Supplied by Therion (Map Headers)====
**Modifications of header on map** (Stacho Mudrak)
code tex-map
\cavename={Terikan River Cave}
\topotitle={Surveyed by}
\cartotitle={Drawn by}
\explotitle={Explored by}
endcode
-----
**Changing the value for \cavelength or \cavedepth** (Stacho Mudrak)
code tex-map
\topoteam{Your team.}
\cavelength{1000\thinspace{}ft}
\cavedepth{300\thinspace{}m}
endcode
... and if you want to use the value calculated by therion but modify it somehow, (Bruce Mutton Feb 2010 versions 5.2.14 to 5.3...)
code tex-map
\edef\histlength{\the\cavelength} %save existing calculated cavelength to variable
\cavelength={Here it is... \histlength\ from historic surveys \histlength\ you get the idea} %redefine cavelength value
endcode
This produces...
"Here it is... 1728m from historic surveys 1728m you get the idea"
after the Length: title in the map header box.
**Suppress the display of cave length and cave depth in the map header** (Bruce Mutton May2012)\\
Theron's layout statements allow you to suppress the printing of north arrow, scale bar, explorers, surveyors, cartographers and copyright, but not cave length and depth. The following code in your layout will suppress length and depth.
code tex-map
\cavelength={} %empty
\cavedepth={} %empty
endcode
-----
**Output Map Title Override** (Bruce Mutton) Feb 2010 versions 5.3
code tex-map
% Output map title as determined by Therion 5.3 is stored in cavename.
% It will be empty if there are multiple maps selected for any one projection
% AND there are multiple source surveys identified in the thconfig file
% ie Therion can not infer a unique title from the input data given.
% This code allows you to define an output map title {cavename} if it happens to be empty
\edef\temp{\the\cavename} % cavename from Therion
\edef\nostring{} % empty string
\ifx\temp\nostring % test if cavename is empty
% if empty reassign cavename to describe selected maps as a group
\cavename={Caves of the Entire Flora Region}
\else % if not empty keep the value set by therion, or assign an override cavename here
\fi
endcode
You can achieve a similar effect (but better, and with less effort) by using Therion's built in -map-level feature, assuming, as above, that you have a hierarchy of maps defined.
In your thconfig file include...
select MiddleEarthPlanMap -map-level 1 # or 2, 3, basic etc
In your layout you might also include...
colour-legend on # display of legend that identifies , ,