Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Allow any paper width and height to be specified in PAPER make variable

  • Loading branch information...
commit 4e8d7513ec4239043f7503f1e6a6ea0c580a9088 1 parent 51ea448
@jeteve jeteve authored
Showing with 19 additions and 3 deletions.
  1. +2 −1  README
  2. +11 −1 bin/book-to-latex
  3. +6 −1 lib/book.sty
View
3  README
@@ -41,7 +41,8 @@ dist/*.pdf using bin/* and lib/* files.
Just type 'make' on your command line, and the book should be built in
dist/UsingPerl6.a4.pdf, with an A4 paper size; to get U.S. letter
-size, type 'make PAPER=letter'.
+size, type 'make PAPER=letter'. To get any PAPER width and height type
+'make PAPER=6.125in,9.25in'; accepted length units are pt, in, cm and mm.
PDF versions of this book can be found at
http://puffin.ch/perl/6/ and http://github.com/perl6/book/downloads
View
12 bin/book-to-latex
@@ -12,7 +12,8 @@ sub main {
my $paper;
GetOptions(
- # Should be one of: a4, letter.
+ # Should be one of: a4, letter,
+ # Or a string of width_height like '666pt,909pt'
'paper:s' => \$paper,
) or die;
@@ -27,10 +28,19 @@ sub main {
my $tt = Template->new( { INCLUDE_PATH => 'lib', } );
+ # Parse paper if needed
+ my ($paper_width,$paper_height);
+ if( $paper =~ /^([0-9\.]+(?:in|cm|pt|mm)),([0-9\.]+(?:in|cm|pt|mm))$/ ){
+ ( $paper_width , $paper_height ) = ( $1, $2 );
+ $paper = undef;
+ }
+
print $tt->process(
'book.sty', {
content => $output,
paper => $paper,
+ paper_width => $paper_width,
+ paper_height => $paper_height
} );
} ## end sub main
View
7 lib/book.sty
@@ -1,5 +1,4 @@
\documentclass[
- [% paper %]paper,
DIV=10,
parskip=full,
headsepline=on,
@@ -12,6 +11,12 @@
BCOR=0
]{scrbook}
+\usepackage[[% IF paper -%]
+paper=[% paper %]paper
+[%- ELSE -%]
+paperwidth=[% paper_width %],paperheight=[% paper_height %]
+[% END %]]{geometry}
+
% For (r) and (c)
\usepackage{textcomp}
Please sign in to comment.
Something went wrong with that request. Please try again.