\ebresizewidth{} is for table and figure. \ebresizewidthsw{} is for sidewaystable. \ebresizeverb{}{} is for code snippets. 1st argument specifies shrink ratio. These macro affect the ebook-size build (perfbook-er.pdf) only. See subsequent changes for usage examples. Also do minor cosmetic changes: o Adjust position of commit/tag watermark closer to the bottom. o Select onesided build for ebook readers. By this change, chapters can start from both odd and even pages. Signed-off-by: Akira Yokosawa <akiyks@xxxxxxxxx> --- perfbook-lt.tex | 42 +++++++++++++++++++++++++++++++++++------- 1 file changed, 35 insertions(+), 7 deletions(-) diff --git a/perfbook-lt.tex b/perfbook-lt.tex index a884011a..dc4da264 100644 --- a/perfbook-lt.tex +++ b/perfbook-lt.tex @@ -35,6 +35,7 @@ \captionsetup[listing]{font=small,labelsep=colon} \captionsetup[subfloat]{font=small} % \usepackage{breakurl} +\usepackage{varwidth} \usepackage{graphicx} \usepackage{rotating} \usepackage{setspace} @@ -176,11 +177,12 @@ \IfTwoColumn{}{ \setboolean{colorlinks}{true} - \renewcommand\footnotelayout{% - \advance\leftskip 0.0in - \advance\rightskip 0.7in - } -} + \IfEbookSize{}{ + \renewcommand\footnotelayout{% + \advance\leftskip 0.0in + \advance\rightskip 0.7in + } +}} \IfColorLinks{ \hypersetup{colorlinks=true,allcolors=MediumBlue} @@ -202,7 +204,11 @@ \renewcommand*\ttdefault{lmtt} %msfontstub -\newcommand{\OneColumnHSpace}[1]{\IfTwoColumn{}{\hspace*{#1}}} +\IfEbookSize{ + \newcommand{\OneColumnHSpace}[1]{} +}{ + \newcommand{\OneColumnHSpace}[1]{\IfTwoColumn{}{\hspace*{#1}}} +} \IfSansSerif{ \renewcommand{\familydefault}{\sfdefault} @@ -325,8 +331,9 @@ \setlength{\twocolumnwidth}{3.125in} \IfEbookSize { % From https://tex.stackexchange.com/questions/16735/latex-options-for-kindle - \usepackage[papersize={4.5in,6.3in},margin=0.2in,onecolumn]{geometry} + \usepackage[papersize={4.5in,6.3in},margin=0.2in,onecolumn,twoside=false]{geometry} \sloppy + \setlength{\onecolumntextwidth}{4.1in} %\pagestyle{empty} %\usepackage[scaled]{helvet} %\renewcommand{\familydefault}{\sfdefault} @@ -366,6 +373,27 @@ \SetWatermarkVerCenter{.95\paperheight} }{} +\IfEbookSize{ +\SetWatermarkHorCenter{.8\paperwidth} +\SetWatermarkVerCenter{.99\paperheight} +\newsavebox\ebbox +\newcommand{\ebresizewidth}[1]{\resizebox{\textwidth}{!}{#1}} +\newcommand{\ebresizewidthsw}[1]{\resizebox{.95\textheight}{!}{#1}} +\newcommand{\ebresizeverb}[2]{% + \begin{lrbox}{\ebbox}% + \begin{varwidth}{\textwidth}% + {#2}% + \end{varwidth}% + \end{lrbox}% + \resizebox{#1\textwidth}{!}{\usebox{\ebbox}}% +} +}{ +\newcommand{\ebresizewidth}[1]{#1} +\newcommand{\ebresizewidthsw}[1]{#1} +\newcommand{\ebresizeverb}[2]{#2} +} + + \begin{document} %%HTMLSKIP -- 2.17.1