Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

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
Jerome Eteve 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
3  README
View
@@ -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
12 bin/book-to-latex
View
@@ -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
7 lib/book.sty
View
@@ -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.