Page MenuHomec4science

multipub.tex
No OneTemporary

File Metadata

Created
Fri, Mar 14, 22:24

multipub.tex

%% multi-target publication. Cannot define this as a .sty file because
%% by default LateXML does not include styles for which it doesn't have
%% bindings.
%
%% This file defines the following mutually exclusive environments:
%%
%% PRINT : used for PDF compilation
%% KINDLE : used for PDF compilation that works on Kindle paperwhite
%% HTML : used for XHTML compilation
%% EPUB : used for EPUB3 compilation (packaged HTML)
%%
\usepackage{graphicx}
\usepackage{comment}
\includecomment{PRINT}
\excludecomment{KINDLE}
\excludecomment{HTML}
\excludecomment{EPUB}
\def\pstfbody{\pstfprint}
\def\pstfwidth{0.9\textwidth}
\def\locpath{.}
\def\multipubbegin{}
\def\mps{}
%% version environments:
\def\multipub#1{%
% \gdef\locpath{.}
% \gdef\multipubbegin{}
% \gdef\mps{}
\def\printopt{PRINT}
\def\kindleopt{KINDLE}
\def\htmlopt{HTML}
\def\epubopt{EPUB}
\def\o{#1}
%
\ifx\printopt\o{%
\typeout{MULTIPUB: compiling using the PRINT format}%
%
}\fi
%
\ifx\kindleopt\o{%
\typeout{MULTIPUB: compiling using the KINDLE format}%
\gdef\mps{
\excludecomment{PRINT}%
\includecomment{KINDLE}
\kindlefmtA}%
\gdef\multipubbegin{\kindlefmtB}%
}\fi
%
\ifx\htmlopt\o{%
\typeout{MULTIPUB: compiling using the HTML format}%
\gdef\mps{%
\excludecomment{PRINT}%
\includecomment{HTML}%
% see the definition of \pstf below as to why we have to do this
\gdef\pstfbody{\pstfepub}%
\gdef\pstfwidth{15cm}}%
}\fi
%
\ifx\epubopt\o{%
\typeout{MULTIPUB: compiling using the EPUB format}%
\gdef\mps{%
\excludecomment{PRINT}%
\includecomment{EPUB}%
\gdef\pstfbody{\pstfepub}%
\gdef\pstfwidth{13cm}}%
}\fi
%
\mps
}
%% Page definition for the Kindle format; we need to split this into
%% two sections because the font packages conflict with some amsmath
%% packages that may be included after the multipub declaration
\def\kindlefmtA{%
\let\small\relax
\let\footnotesize\relax
\let\scriptsize\relax
\let\tiny\relax
\let\large\relax
\let\Large\relax
\let\LARGE\relax
\let\huge\relax
\let\Huge\relax
\makeatletter
\input{size10.clo}
\makeatother
\sloppy
\usepackage[papersize={85mm,114mm},margin=1mm]{geometry}
\pagestyle{empty}
}
\def\kindlefmtB{%
\usepackage{epigrafica}
\usepackage[LGR,OT1]{fontenc}
\DeclareMathSizes{10}{8.4}{5.6}{4.2}
\usepackage[parfill]{parskip}
}
%% use this macro to include chapter files in subfolders
%% The macro defines the \localpath macro which you can use in each chapter
%% to include pictures or files relative to the chapter's path
%% (eg. \includegraphics{\localpath{figs/picture.eps}})
%
% #1: chapter's folder name
% #2: chapter's file name
%
\def\includefile#1#2{%
\gdef\locpath{#1}%
\input{./#1/#2}}
%% This macro prepends the path to a file name
\def\localpath#1{\locpath/#1}
%% PSTricks figures
%%
\newcommand{\pstf}[2][\pstfwidth]{\pstfbody{#1}{#2}}
%%
%% in PRINT mode, pstricks figures can be compiled on the go if needed
\def\pstfprint#1#2{
\IfFileExists{\locpath/ps/rendered/#2.eps}%
{\includegraphics[width=#1]{\locpath/ps/rendered/#2}}%
{\input{\locpath/ps/#2.tex}}}
%%
%% Unfortunately \IfFileExists does not work in LateXML if the argument is
%% itself a macro so we cannot test for the presence of the rendered figure. Rely on input error
%% when rendered is not available
%
% Originally:
%\def\pstricksfigure#1{%
% \IfFileExists{\renderedfile{#1}}%
% {\includegraphics{\renderedfile{#1}}}%
% {\PackageError{PSTrickFigure}{figure \pstricksfile{#1} must be pre-rendered to EPS for this layout}%
% {please run the appropriate Python script to pre-render all PSTricks-based figures in the manuscript.}}}
%
\gdef\pstfepub#1#2{%
\includegraphics[width=#1]{\locpath/ps/rendered/#2}}

Event Timeline