TransWikia.com

Define various Trim size through a .sty file

TeX - LaTeX Asked on April 17, 2021

I’m trying to write a package, which can supports various Trim sizes through option in TeX application file, and my tags are follows:

Definition in my .sty file

newififsixbynine  
newififsevenbynine
newififeightbynine

NeedsTeXFormat{LaTeX2e}

usepackage[a4,center,cam,info]{crop}

usepackage{lipsum}

ifsixbynine
setlength{paperheight}{9truein}%
setlength{paperwidth}{6truein}%
fi

ifsevenbynine
setlength{paperheight}{9truein}%
setlength{paperwidth}{7truein}%
fi

ifeightbynine
setlength{paperheight}{9truein}%
setlength{paperwidth}{8truein}%
fi


addtolengthtopmargin{-1in}

setlengthtextwidth{26pc}

setlengthtextheight{39pc}

setlengthoddsidemargin{5pc}
addtolengthoddsidemargin{-1in}    % subtract out the 1 inch driver margin
setlength@tempdima{paperwidth}
addtolength@tempdima{-textwidth}
addtolength@tempdima{-5pc}
setlengthevensidemargin{@tempdima}
addtolengthevensidemargin{-1in}

DeclareOption{6x9}{globalsixbyninetrue}
DeclareOption{7x9}{globalsevenbyninetrue}
DeclareOption{8x9}{globaleightbyninetrue}

ProcessOptions

endinput

Content of my .tex file

documentclass{book}
usepackage[6x9]{test}

begin{document}

lipsum[1-9]

end{document}

But the output doesn’t come what I expected. Can you help me what I did wrong in my definitions…

One Answer

The problem is that you are declaring your options and calling the ProcessOptions macro at the end of the package file. Depending on the provided options, this macro sets the appropriate flags (sixbynine and others), so it needs to be called before the flags are used.

Correct answer by TonioElGringo on April 17, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP