summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/extsizes/autopagewidth.sty
blob: cd90eb781873f4856320a1931f70bb3f081bbb59 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
\ProvidesPackage{autopagewidth}
%This is a package which attempts to set the text width according to the
%font size.  I'm not sure this is a good idea, and I'm not sure if this
%a good implementation of this idea.  But you are free to play with this
%package as you like.  Comments are welcomed.
\PackageWarningNoLine{AutoPageWidth}{This is an experimental style^^J
 It is provided for evaluation only.}
\def\APW@text{\normalfont A rule of thumb is that no line should contain 
              more than 70 characters} %this is a text containing 70 char's
%In cmr10 it is 311pt long. Which compares to a default textwith of 345pt
%Thus the effect of this package is to widen the margins still further
%(to the chagrin of the MSword crowd no doubt)
  \setlength\@tempdima{\paperwidth}
  \addtolength\@tempdima{-2in}
  \settowidth\@tempdimb{\APW@text}
  \if@twocolumn
    \ifdim\@tempdima>2\@tempdimb\relax
      \setlength\textwidth{2\@tempdimb}
    \else
      \setlength\textwidth{\@tempdima}
    \fi
  \else
    \ifdim\@tempdima>\@tempdimb\relax
      \setlength\textwidth{\@tempdimb}
    \else
      \setlength\textwidth{\@tempdima}
    \fi
  \fi
  \@settopoint\textwidth
  \if@twoside
    \setlength\@tempdima        {\paperwidth}
    \addtolength\@tempdima      {-\textwidth}
    \setlength\oddsidemargin    {.4\@tempdima}
    \addtolength\oddsidemargin  {-1in}
    \setlength\marginparwidth   {.6\@tempdima}
    \addtolength\marginparwidth {-\marginparsep}
    \addtolength\marginparwidth {-0.4in}
  \else
    \setlength\@tempdima        {\paperwidth}
    \addtolength\@tempdima      {-\textwidth}
    \setlength\oddsidemargin    {.5\@tempdima}
    \addtolength\oddsidemargin  {-1in}
    \setlength\marginparwidth   {.5\@tempdima}
    \addtolength\marginparwidth {-\marginparsep}
    \addtolength\marginparwidth {-0.4in}
    \addtolength\marginparwidth {-.4in}
  \fi
  \ifdim \marginparwidth >2in
     \setlength\marginparwidth{2in}
  \fi
  \@settopoint\oddsidemargin
  \@settopoint\marginparwidth
  \setlength\evensidemargin  {\paperwidth}
  \addtolength\evensidemargin{-2in}
  \addtolength\evensidemargin{-\textwidth}
  \addtolength\evensidemargin{-\oddsidemargin}
  \@settopoint\evensidemargin