diff --git a/hledger-api/hledger-api.info b/hledger-api/hledger-api.info
index 61682c085..ee65a103f 100644
--- a/hledger-api/hledger-api.info
+++ b/hledger-api/hledger-api.info
@@ -1,4 +1,4 @@
-This is hledger-api.info, produced by makeinfo version 6.0 from stdin.
+This is hledger-api.info, produced by makeinfo version 6.5 from stdin.
 
 
 File: hledger-api.info,  Node: Top,  Next: OPTIONS,  Up: (dir)
diff --git a/hledger-lib/hledger_csv.info b/hledger-lib/hledger_csv.info
index 8bd1f0da7..62f6ef556 100644
--- a/hledger-lib/hledger_csv.info
+++ b/hledger-lib/hledger_csv.info
@@ -1,4 +1,4 @@
-This is hledger_csv.info, produced by makeinfo version 6.0 from stdin.
+This is hledger_csv.info, produced by makeinfo version 6.5 from stdin.
 
 
 File: hledger_csv.info,  Node: Top,  Next: CSV RULES,  Up: (dir)
diff --git a/hledger-lib/hledger_journal.5 b/hledger-lib/hledger_journal.5
index f05a33286..f8f4de932 100644
--- a/hledger-lib/hledger_journal.5
+++ b/hledger-lib/hledger_journal.5
@@ -274,7 +274,7 @@ Here's one suggestion:
 .PP
 .TS
 tab(@);
-lw(10.5n) lw(59.5n).
+lw(9.9n) lw(60.1n).
 T{
 status
 T}@T{
@@ -1103,6 +1103,68 @@ Glob patterns (\f[C]*\f[]) are not currently supported.
 .PP
 The \f[C]include\f[] directive can only be used in journal files.
 It can include journal, timeclock or timedot files, but not CSV files.
+.SH Periodic transactions
+.PP
+A periodic transaction starts with a tilde `~' in place of a date
+followed by a period expression:
+.IP
+.nf
+\f[C]
+~\ weekly
+\ \ assets:bank:checking\ \ \ $400\ ;\ paycheck
+\ \ income:acme\ inc
+\f[]
+.fi
+.PP
+Periodic transactions are used for budgeting and forecasting only, they
+have no effect without the \f[C]\-\-forecast\f[] or \f[C]\-\-budget\f[]
+option specified.
+For examples and details, see Budgeting and Forecasting.
+.SH Automated posting rules
+.PP
+Autopated posting rule starts with an equal sign `=' in place of a date,
+followed by a query:
+.IP
+.nf
+\f[C]
+=\ expenses:gifts
+\ \ \ \ budget:gifts\ \ *\-1
+\ \ \ \ assets:budget\ \ *1
+\f[]
+.fi
+.PP
+When \f[C]\-\-auto\f[] option is specified on the command line,
+automated posting rule will add its postings to all transactions that
+match the query.
+.PP
+If amount in the automated posting rule includes commodity name, new
+posting will be made in the given commodity, otherwise commodity of the
+matched transaction will be used.
+.PP
+When amount in the automated posting rule begins with the '*', amount
+will be treated as a multiplier that is applied to the amount of the
+first posting in the matched transaction.
+.PP
+In example above, every transaction in \f[C]expenses:gifts\f[] account
+will have two additional postings added to it: amount of the original
+gift will be debited from \f[C]budget:gifts\f[] and credited into
+\f[C]assets:budget\f[]:
+.IP
+.nf
+\f[C]
+;\ Original\ transaction
+2017\-12\-14
+\ \ expenses:gifts\ \ $20
+\ \ assets
+
+;\ With\ automated\ postings\ applied
+2017/12/14
+\ \ \ \ expenses:gifts\ \ \ \ \ \ \ \ \ \ \ \ \ $20
+\ \ \ \ assets
+\ \ \ \ budget:gifts\ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-20
+\ \ \ \ assets:budget\ \ \ \ \ \ \ \ \ \ \ \ \ \ $20
+\f[]
+.fi
 .SH EDITOR SUPPORT
 .PP
 Add\-on modes exist for various text editors, to make working with
@@ -1116,7 +1178,7 @@ files:
 .PP
 .TS
 tab(@);
-lw(16.5n) lw(51.5n).
+lw(16.5n) lw(53.5n).
 T{
 Emacs
 T}@T{
diff --git a/hledger-lib/hledger_journal.info b/hledger-lib/hledger_journal.info
index 07f2ca7ec..d35404cb2 100644
--- a/hledger-lib/hledger_journal.info
+++ b/hledger-lib/hledger_journal.info
@@ -1,4 +1,4 @@
-This is hledger_journal.info, produced by makeinfo version 6.0 from
+This is hledger_journal.info, produced by makeinfo version 6.5 from
 stdin.
 
 
@@ -57,10 +57,12 @@ assisted by the helper modes for emacs or vim.
 * Menu:
 
 * FILE FORMAT::
+* Periodic transactions::
+* Automated posting rules::
 * EDITOR SUPPORT::
 
 
-File: hledger_journal.info,  Node: FILE FORMAT,  Next: EDITOR SUPPORT,  Prev: Top,  Up: Top
+File: hledger_journal.info,  Node: FILE FORMAT,  Next: Periodic transactions,  Prev: Top,  Up: Top
 
 1 FILE FORMAT
 *************
@@ -270,13 +272,13 @@ toggle transaction status with C-c C-e, or posting status with C-c C-c.
    What "uncleared", "pending", and "cleared" actually mean is up to
 you.  Here's one suggestion:
 
-status      meaning
+status     meaning
 --------------------------------------------------------------------------
-uncleared   recorded but not yet reconciled; needs review
-pending     tentatively reconciled (if needed, eg during a big
-            reconciliation)
-cleared     complete, reconciled as far as possible, and considered
-            correct
+uncleared  recorded but not yet reconciled; needs review
+pending    tentatively reconciled (if needed, eg during a big
+           reconciliation)
+cleared    complete, reconciled as far as possible, and considered
+           correct
 
    With this scheme, you would use '-PC' to see the current balance at
 your bank, '-U' to see things which will probably hit your bank soon
@@ -568,7 +570,7 @@ equals sign; instead it is calculated automatically so as to satisfy the
 assertion.  This can be a convenience during data entry, eg when setting
 opening balances:
 
-; starting a new journal, set asset account balances
+; starting a new journal, set asset account balances 
 2016/1/1 opening balances
   assets:checking            = $409.32
   assets:savings             = $735.24
@@ -1054,9 +1056,67 @@ current file.  Glob patterns ('*') are not currently supported.
 include journal, timeclock or timedot files, but not CSV files.
 
 
-File: hledger_journal.info,  Node: EDITOR SUPPORT,  Prev: FILE FORMAT,  Up: Top
+File: hledger_journal.info,  Node: Periodic transactions,  Next: Automated posting rules,  Prev: FILE FORMAT,  Up: Top
 
-2 EDITOR SUPPORT
+2 Periodic transactions
+***********************
+
+A periodic transaction starts with a tilde '~' in place of a date
+followed by a period expression:
+
+~ weekly
+  assets:bank:checking   $400 ; paycheck
+  income:acme inc
+
+   Periodic transactions are used for budgeting and forecasting only,
+they have no effect without the '--forecast' or '--budget' option
+specified.  For examples and details, see Budgeting and Forecasting.
+
+
+File: hledger_journal.info,  Node: Automated posting rules,  Next: EDITOR SUPPORT,  Prev: Periodic transactions,  Up: Top
+
+3 Automated posting rules
+*************************
+
+Autopated posting rule starts with an equal sign '=' in place of a date,
+followed by a query:
+
+= expenses:gifts
+    budget:gifts  *-1
+    assets:budget  *1
+
+   When '--auto' option is specified on the command line, automated
+posting rule will add its postings to all transactions that match the
+query.
+
+   If amount in the automated posting rule includes commodity name, new
+posting will be made in the given commodity, otherwise commodity of the
+matched transaction will be used.
+
+   When amount in the automated posting rule begins with the '*', amount
+will be treated as a multiplier that is applied to the amount of the
+first posting in the matched transaction.
+
+   In example above, every transaction in 'expenses:gifts' account will
+have two additional postings added to it: amount of the original gift
+will be debited from 'budget:gifts' and credited into 'assets:budget':
+
+; Original transaction
+2017-12-14
+  expenses:gifts  $20
+  assets
+
+; With automated postings applied
+2017/12/14
+    expenses:gifts             $20
+    assets
+    budget:gifts              $-20
+    assets:budget              $20
+
+
+File: hledger_journal.info,  Node: EDITOR SUPPORT,  Prev: Automated posting rules,  Up: Top
+
+4 EDITOR SUPPORT
 ****************
 
 Add-on modes exist for various text editors, to make working with
@@ -1078,85 +1138,89 @@ Code
 
 Tag Table:
 Node: Top76
-Node: FILE FORMAT2370
-Ref: #file-format2494
-Node: Transactions2717
-Ref: #transactions2838
-Node: Postings3522
-Ref: #postings3649
-Node: Dates4644
-Ref: #dates4759
-Node: Simple dates4824
-Ref: #simple-dates4950
-Node: Secondary dates5316
-Ref: #secondary-dates5470
-Node: Posting dates7033
-Ref: #posting-dates7162
-Node: Status8536
-Ref: #status8656
-Node: Description10370
-Ref: #description10508
-Node: Payee and note10827
-Ref: #payee-and-note10941
-Node: Account names11183
-Ref: #account-names11326
-Node: Amounts11813
-Ref: #amounts11949
-Node: Virtual Postings14540
-Ref: #virtual-postings14699
-Node: Balance Assertions15919
-Ref: #balance-assertions16094
-Node: Assertions and ordering16990
-Ref: #assertions-and-ordering17176
-Node: Assertions and included files17876
-Ref: #assertions-and-included-files18117
-Node: Assertions and multiple -f options18450
-Ref: #assertions-and-multiple--f-options18704
-Node: Assertions and commodities18836
-Ref: #assertions-and-commodities19071
-Node: Assertions and subaccounts19767
-Ref: #assertions-and-subaccounts19999
-Node: Assertions and virtual postings20520
-Ref: #assertions-and-virtual-postings20727
-Node: Balance Assignments20869
-Ref: #balance-assignments21038
-Node: Prices22157
-Ref: #prices22290
-Node: Transaction prices22341
-Ref: #transaction-prices22486
-Node: Market prices24642
-Ref: #market-prices24777
-Node: Comments25737
-Ref: #comments25859
-Node: Tags27101
-Ref: #tags27219
-Node: Directives28621
-Ref: #directives28734
-Node: Account aliases28927
-Ref: #account-aliases29071
-Node: Basic aliases29675
-Ref: #basic-aliases29818
-Node: Regex aliases30508
-Ref: #regex-aliases30676
-Node: Multiple aliases31394
-Ref: #multiple-aliases31566
-Node: end aliases32064
-Ref: #end-aliases32204
-Node: account directive32305
-Ref: #account-directive32485
-Node: apply account directive32781
-Ref: #apply-account-directive32977
-Node: Multi-line comments33636
-Ref: #multi-line-comments33826
-Node: commodity directive33954
-Ref: #commodity-directive34138
-Node: Default commodity35010
-Ref: #default-commodity35183
-Node: Default year35720
-Ref: #default-year35885
-Node: Including other files36308
-Ref: #including-other-files36465
-Node: EDITOR SUPPORT36862
-Ref: #editor-support36980
+Node: FILE FORMAT2424
+Ref: #file-format2555
+Node: Transactions2778
+Ref: #transactions2899
+Node: Postings3583
+Ref: #postings3710
+Node: Dates4705
+Ref: #dates4820
+Node: Simple dates4885
+Ref: #simple-dates5011
+Node: Secondary dates5377
+Ref: #secondary-dates5531
+Node: Posting dates7094
+Ref: #posting-dates7223
+Node: Status8597
+Ref: #status8717
+Node: Description10425
+Ref: #description10563
+Node: Payee and note10882
+Ref: #payee-and-note10996
+Node: Account names11238
+Ref: #account-names11381
+Node: Amounts11868
+Ref: #amounts12004
+Node: Virtual Postings14595
+Ref: #virtual-postings14754
+Node: Balance Assertions15974
+Ref: #balance-assertions16149
+Node: Assertions and ordering17045
+Ref: #assertions-and-ordering17231
+Node: Assertions and included files17931
+Ref: #assertions-and-included-files18172
+Node: Assertions and multiple -f options18505
+Ref: #assertions-and-multiple--f-options18759
+Node: Assertions and commodities18891
+Ref: #assertions-and-commodities19126
+Node: Assertions and subaccounts19822
+Ref: #assertions-and-subaccounts20054
+Node: Assertions and virtual postings20575
+Ref: #assertions-and-virtual-postings20782
+Node: Balance Assignments20924
+Ref: #balance-assignments21093
+Node: Prices22213
+Ref: #prices22346
+Node: Transaction prices22397
+Ref: #transaction-prices22542
+Node: Market prices24698
+Ref: #market-prices24833
+Node: Comments25793
+Ref: #comments25915
+Node: Tags27157
+Ref: #tags27275
+Node: Directives28677
+Ref: #directives28790
+Node: Account aliases28983
+Ref: #account-aliases29127
+Node: Basic aliases29731
+Ref: #basic-aliases29874
+Node: Regex aliases30564
+Ref: #regex-aliases30732
+Node: Multiple aliases31450
+Ref: #multiple-aliases31622
+Node: end aliases32120
+Ref: #end-aliases32260
+Node: account directive32361
+Ref: #account-directive32541
+Node: apply account directive32837
+Ref: #apply-account-directive33033
+Node: Multi-line comments33692
+Ref: #multi-line-comments33882
+Node: commodity directive34010
+Ref: #commodity-directive34194
+Node: Default commodity35066
+Ref: #default-commodity35239
+Node: Default year35776
+Ref: #default-year35941
+Node: Including other files36364
+Ref: #including-other-files36521
+Node: Periodic transactions36918
+Ref: #periodic-transactions37089
+Node: Automated posting rules37464
+Ref: #automated-posting-rules37642
+Node: EDITOR SUPPORT38751
+Ref: #editor-support38881
 
 End Tag Table
diff --git a/hledger-lib/hledger_journal.txt b/hledger-lib/hledger_journal.txt
index f902ff2d4..7181e06b1 100644
--- a/hledger-lib/hledger_journal.txt
+++ b/hledger-lib/hledger_journal.txt
@@ -211,10 +211,10 @@ FILE FORMAT
        status       meaning
        --------------------------------------------------------------------------
        uncleared    recorded but not yet reconciled; needs review
-       pending      tentatively reconciled (if needed, eg during a  big  recon-
-                    ciliation)
-       cleared      complete,  reconciled  as  far  as possible, and considered
-                    correct
+       pending      tentatively reconciled (if needed, eg during a big reconcil-
+                    iation)
+       cleared      complete, reconciled as far as possible, and considered cor-
+                    rect
 
        With this scheme, you would use -PC to see the current balance at  your
        bank,  -U  to  see  things which will probably hit your bank soon (like
@@ -811,32 +811,79 @@ FILE FORMAT
        The include directive can only  be  used  in  journal  files.   It  can
        include journal, timeclock or timedot files, but not CSV files.
 
+Periodic transactions
+       A  periodic transaction starts with a tilde `~' in place of a date fol-
+       lowed by a period expression:
+
+              ~ weekly
+                assets:bank:checking   $400 ; paycheck
+                income:acme inc
+
+       Periodic transactions are used for budgeting and forecasting only, they
+       have  no  effect  without  the --forecast or --budget option specified.
+       For examples and details, see Budgeting and Forecasting.
+
+Automated posting rules
+       Autopated posting rule starts with an equal sign  `='  in  place  of  a
+       date, followed by a query:
+
+              = expenses:gifts
+                  budget:gifts  *-1
+                  assets:budget  *1
+
+       When  --auto option is specified on the command line, automated posting
+       rule will add its postings to all transactions that match the query.
+
+       If amount in the automated posting rule includes  commodity  name,  new
+       posting will be made in the given commodity, otherwise commodity of the
+       matched transaction will be used.
+
+       When amount in the automated posting rule begins with the  '*',  amount
+       will  be  treated  as a multiplier that is applied to the amount of the
+       first posting in the matched transaction.
+
+       In example above, every transaction in expenses:gifts account will have
+       two  additional  postings added to it: amount of the original gift will
+       be debited from budget:gifts and credited into assets:budget:
+
+              ; Original transaction
+              2017-12-14
+                expenses:gifts  $20
+                assets
+
+              ; With automated postings applied
+              2017/12/14
+                  expenses:gifts             $20
+                  assets
+                  budget:gifts              $-20
+                  assets:budget              $20
+
 EDITOR SUPPORT
        Add-on modes exist for various text editors, to make working with jour-
-       nal files easier.  They add colour, navigation aids  and  helpful  com-
-       mands.   For  hledger  users  who  edit  the journal file directly (the
+       nal  files  easier.   They add colour, navigation aids and helpful com-
+       mands.  For hledger users who  edit  the  journal  file  directly  (the
        majority), using one of these modes is quite recommended.
 
-       These were written with Ledger in mind,  but  also  work  with  hledger
+       These  were  written  with  Ledger  in mind, but also work with hledger
        files:
 
 
        Emacs              http://www.ledger-cli.org/3.0/doc/ledger-mode.html
-       Vim                https://github.com/ledger/ledger/wiki/Get-
-                          ting-started
+       Vim                https://github.com/ledger/ledger/wiki/Getting-started
        Sublime Text       https://github.com/ledger/ledger/wiki/Using-Sub-
                           lime-Text
        Textmate           https://github.com/ledger/ledger/wiki/Using-Text-
                           Mate-2
        Text Wrangler      https://github.com/ledger/ledger/wiki/Edit-
                           ing-Ledger-files-with-TextWrangler
+
        Visual    Studio   https://marketplace.visualstudio.com/items?item-
        Code               Name=mark-hansen.hledger-vscode
 
 
 
 REPORTING BUGS
-       Report  bugs at http://bugs.hledger.org (or on the #hledger IRC channel
+       Report bugs at http://bugs.hledger.org (or on the #hledger IRC  channel
        or hledger mail list)
 
 
@@ -850,7 +897,7 @@ COPYRIGHT
 
 
 SEE ALSO
-       hledger(1),     hledger-ui(1),     hledger-web(1),      hledger-api(1),
+       hledger(1),      hledger-ui(1),     hledger-web(1),     hledger-api(1),
        hledger_csv(5), hledger_journal(5), hledger_timeclock(5), hledger_time-
        dot(5), ledger(1)
 
diff --git a/hledger-lib/hledger_timeclock.info b/hledger-lib/hledger_timeclock.info
index dd3b0f80a..4dae5ee9e 100644
--- a/hledger-lib/hledger_timeclock.info
+++ b/hledger-lib/hledger_timeclock.info
@@ -1,4 +1,4 @@
-This is hledger_timeclock.info, produced by makeinfo version 6.0 from
+This is hledger_timeclock.info, produced by makeinfo version 6.5 from
 stdin.
 
 
diff --git a/hledger-lib/hledger_timedot.info b/hledger-lib/hledger_timedot.info
index aff215245..cce6b11cc 100644
--- a/hledger-lib/hledger_timedot.info
+++ b/hledger-lib/hledger_timedot.info
@@ -1,4 +1,4 @@
-This is hledger_timedot.info, produced by makeinfo version 6.0 from
+This is hledger_timedot.info, produced by makeinfo version 6.5 from
 stdin.
 
 
@@ -53,7 +53,7 @@ example:
 # on this day, 6h was spent on client work, 1.5h on haskell FOSS work, etc.
 2016/2/1
 inc:client1   .... .... .... .... .... ....
-fos:haskell   .... ..
+fos:haskell   .... .. 
 biz:research  .
 
 2016/2/2
@@ -79,17 +79,17 @@ $ hledger -f t.timedot print date:2016/2/2
 $ hledger -f t.timedot bal --daily --tree
 Balance changes in 2016/02/01-2016/02/03:
 
-            ||  2016/02/01d  2016/02/02d  2016/02/03d
+            ||  2016/02/01d  2016/02/02d  2016/02/03d 
 ============++========================================
- biz        ||         0.25         0.25         1.00
-   research ||         0.25         0.25         1.00
- fos        ||         1.50            0         3.00
-   haskell  ||         1.50            0            0
-   hledger  ||            0            0         3.00
- inc        ||         6.00         2.00         4.00
-   client1  ||         6.00         2.00         4.00
+ biz        ||         0.25         0.25         1.00 
+   research ||         0.25         0.25         1.00 
+ fos        ||         1.50            0         3.00 
+   haskell  ||         1.50            0            0 
+   hledger  ||            0            0         3.00 
+ inc        ||         6.00         2.00         4.00 
+   client1  ||         6.00         2.00         4.00 
 ------------++----------------------------------------
-            ||         7.75         2.25         8.00
+            ||         7.75         2.25         8.00 
 
    I prefer to use period for separating account components.  We can
 make this work with an account alias:
diff --git a/hledger-ui/hledger-ui.1 b/hledger-ui/hledger-ui.1
index 4b4178a53..b1fb3a626 100644
--- a/hledger-ui/hledger-ui.1
+++ b/hledger-ui/hledger-ui.1
@@ -136,8 +136,8 @@ multiperiod/multicolumn report by year
 .RE
 .TP
 .B \f[C]\-p\ \-\-period=PERIODEXP\f[]
-set start date, end date, and/or reporting interval all at once
-(overrides the flags above)
+set start date, end date, and/or reporting interval all at once using
+period expressions syntax (overrides the flags above)
 .RS
 .RE
 .TP
@@ -187,6 +187,21 @@ convert amounts to their market value on the report end date (using the
 most recent applicable market price, if any)
 .RS
 .RE
+.TP
+.B \f[C]\-\-forecast\f[]
+generate forecast transactions from [periodic
+transaction]((journal.html#periodic\-transactions) rules.
+Each periodic transaction rule will generate forecast transactions,
+beginning the day after the last recorded journal transaction, and
+ending 6 months from today, or at the specified report end date.
+.RS
+.RE
+.TP
+.B \f[C]\-\-auto\f[]
+apply automated posting rules to modify transactions where applicable
+(can combine with \[en]forecast).
+.RS
+.RE
 .PP
 When a reporting option appears more than once in the command line, the
 last one takes precedence.
diff --git a/hledger-ui/hledger-ui.info b/hledger-ui/hledger-ui.info
index 8d7cfd1a8..49f51e34d 100644
--- a/hledger-ui/hledger-ui.info
+++ b/hledger-ui/hledger-ui.info
@@ -1,4 +1,4 @@
-This is hledger-ui.info, produced by makeinfo version 6.0 from stdin.
+This is hledger-ui.info, produced by makeinfo version 6.5 from stdin.
 
 
 File: hledger-ui.info,  Node: Top,  Next: OPTIONS,  Up: (dir)
@@ -100,7 +100,7 @@ the data.
 '-p --period=PERIODEXP'
 
      set start date, end date, and/or reporting interval all at once
-     (overrides the flags above)
+     using period expressions syntax (overrides the flags above)
 '--date2'
 
      match the secondary date instead (see command help for other
@@ -131,6 +131,17 @@ the data.
 
      convert amounts to their market value on the report end date (using
      the most recent applicable market price, if any)
+'--forecast'
+
+     generate forecast transactions from [periodic
+     transaction]((journal.html#periodic-transactions) rules.  Each
+     periodic transaction rule will generate forecast transactions,
+     beginning the day after the last recorded journal transaction, and
+     ending 6 months from today, or at the specified report end date.
+'--auto'
+
+     apply automated posting rules to modify transactions where
+     applicable (can combine with -forecast).
 
    When a reporting option appears more than once in the command line,
 the last one takes precedence.
@@ -371,17 +382,17 @@ Tag Table:
 Node: Top71
 Node: OPTIONS821
 Ref: #options918
-Node: KEYS3855
-Ref: #keys3950
-Node: SCREENS6909
-Ref: #screens6994
-Node: Accounts screen7084
-Ref: #accounts-screen7212
-Node: Register screen9442
-Ref: #register-screen9597
-Node: Transaction screen11671
-Ref: #transaction-screen11829
-Node: Error screen12699
-Ref: #error-screen12821
+Node: KEYS4350
+Ref: #keys4445
+Node: SCREENS7404
+Ref: #screens7489
+Node: Accounts screen7579
+Ref: #accounts-screen7707
+Node: Register screen9937
+Ref: #register-screen10092
+Node: Transaction screen12166
+Ref: #transaction-screen12324
+Node: Error screen13194
+Ref: #error-screen13316
 
 End Tag Table
diff --git a/hledger-ui/hledger-ui.txt b/hledger-ui/hledger-ui.txt
index 9c454fc34..758d87893 100644
--- a/hledger-ui/hledger-ui.txt
+++ b/hledger-ui/hledger-ui.txt
@@ -96,7 +96,7 @@ OPTIONS
 
        -p --period=PERIODEXP
               set  start date, end date, and/or reporting interval all at once
-              (overrides the flags above)
+              using period expressions syntax (overrides the flags above)
 
        --date2
               match the secondary date instead (see  command  help  for  other
@@ -128,6 +128,16 @@ OPTIONS
               convert amounts to their market value on  the  report  end  date
               (using the most recent applicable market price, if any)
 
+       --forecast
+              generate   forecast   transactions   from   [periodic   transac-
+              tion]((journal.html#periodic-transactions) rules.  Each periodic
+              transaction  rule will generate forecast transactions, beginning
+              the day after the last recorded journal transaction, and  ending
+              6 months from today, or at the specified report end date.
+
+       --auto apply  automated  posting  rules  to  modify  transactions where
+              applicable (can combine with -forecast).
+
        When a reporting option appears more than once in the command line, the
        last one takes precedence.
 
@@ -145,64 +155,64 @@ OPTIONS
               show debug output (levels 1-9, default: 1)
 
        A @FILE argument will be expanded to the contents of FILE, which should
-       contain  one  command line option/argument per line.  (To prevent this,
+       contain one command line option/argument per line.  (To  prevent  this,
        insert a -- argument before.)
 
 KEYS
-       ? shows a help dialog listing all keys.  (Some of these also appear  in
+       ?  shows a help dialog listing all keys.  (Some of these also appear in
        the quick help at the bottom of each screen.) Press ? again (or ESCAPE,
        or LEFT) to close it.  The following keys work on most screens:
 
        The cursor keys navigate: right (or enter) goes deeper, left returns to
-       the  previous  screen,  up/down/page up/page down/home/end  move up and
-       down   through   lists.     Vi-style    (h/j/k/l)    and    Emacs-style
+       the previous screen,  up/down/page up/page down/home/end  move  up  and
+       down    through    lists.     Vi-style    (h/j/k/l)   and   Emacs-style
        (CTRL-p/CTRL-n/CTRL-f/CTRL-b) movement keys are also supported.  A tip:
-       movement speed is limited by your keyboard repeat rate, to move  faster
-       you  may  want to adjust it.  (If you're on a mac, the Karabiner app is
+       movement  speed is limited by your keyboard repeat rate, to move faster
+       you may want to adjust it.  (If you're on a mac, the Karabiner  app  is
        one way to do that.)
 
-       With shift pressed, the cursor keys adjust the report period,  limiting
-       the   transactions   to   be   shown   (by  default,  all  are  shown).
-       shift-down/up steps downward and upward through these  standard  report
+       With  shift pressed, the cursor keys adjust the report period, limiting
+       the  transactions  to  be  shown   (by   default,   all   are   shown).
+       shift-down/up  steps  downward and upward through these standard report
        period   durations:   year,   quarter,   month,   week,   day.    Then,
-       shift-left/right moves to the previous/next period.  t sets the  report
-       period  to  today.   With  the --watch option, when viewing a "current"
-       period (the current day, week, month, quarter,  or  year),  the  period
-       will  move automatically to track the current date.  To set a non-stan-
+       shift-left/right  moves to the previous/next period.  t sets the report
+       period to today.  With the --watch option,  when  viewing  a  "current"
+       period  (the  current  day,  week, month, quarter, or year), the period
+       will move automatically to track the current date.  To set a  non-stan-
        dard period, you can use / and a date: query.
 
-       / lets you set a general filter query limiting the  data  shown,  using
-       the  same query terms as in hledger and hledger-web.  While editing the
-       query, you can use CTRL-a/e/d/k, BS, cursor keys; press  ENTER  to  set
+       /  lets  you  set a general filter query limiting the data shown, using
+       the same query terms as in hledger and hledger-web.  While editing  the
+       query,  you  can  use CTRL-a/e/d/k, BS, cursor keys; press ENTER to set
        it, or ESCAPEto cancel.  There are also keys for quickly adjusting some
-       common filters like account depth and transaction status  (see  below).
+       common  filters  like account depth and transaction status (see below).
        BACKSPACE or DELETE removes all filters, showing all transactions.
 
-       ESCAPE  removes  all  filters and jumps back to the top screen.  Or, it
+       ESCAPE removes all filters and jumps back to the top  screen.   Or,  it
        cancels a minibuffer edit or help dialog in progress.
 
        CTRL-l redraws the screen and centers the selection if possible (selec-
-       tions  near  the top won't be centered, since we don't scroll above the
+       tions near the top won't be centered, since we don't scroll  above  the
        top).
 
-       g reloads from the data file(s) and updates the current screen and  any
-       previous  screens.   (With  large  files, this could cause a noticeable
+       g  reloads from the data file(s) and updates the current screen and any
+       previous screens.  (With large files, this  could  cause  a  noticeable
        pause.)
 
-       I toggles balance assertion  checking.   Disabling  balance  assertions
+       I  toggles  balance  assertion  checking.  Disabling balance assertions
        temporarily can be useful for troubleshooting.
 
-       a  runs  command-line  hledger's  add  command, and reloads the updated
+       a runs command-line hledger's add  command,  and  reloads  the  updated
        file.  This allows some basic data entry.
 
-       A is  like  a,  but  runs  the  hledger-iadd  tool,  which  provides  a
-       curses-style  interface.  This key will be available if hledger-iadd is
+       A  is  like  a,  but  runs  the  hledger-iadd  tool,  which  provides a
+       curses-style interface.  This key will be available if hledger-iadd  is
        installed in $PATH.
 
-       E  runs  $HLEDGER_UI_EDITOR,  or   $EDITOR,   or   a   default   (emac-
+       E   runs   $HLEDGER_UI_EDITOR,   or   $EDITOR,   or  a  default  (emac-
        sclient -a "" -nw) on the journal file.  With some editors (emacs, vi),
-       the cursor will be positioned at the current transaction  when  invoked
-       from  the  register  and transaction screens, and at the error location
+       the  cursor  will be positioned at the current transaction when invoked
+       from the register and transaction screens, and at  the  error  location
        (if possible) when invoked from the error screen.
 
        q quits the application.
@@ -211,44 +221,44 @@ KEYS
 
 SCREENS
    Accounts screen
-       This is normally the first screen displayed.   It  lists  accounts  and
-       their  balances,  like hledger's balance command.  By default, it shows
-       all accounts and their latest ending balances (including  the  balances
-       of  subaccounts).  if you specify a query on the command line, it shows
+       This  is  normally  the  first screen displayed.  It lists accounts and
+       their balances, like hledger's balance command.  By default,  it  shows
+       all  accounts  and their latest ending balances (including the balances
+       of subaccounts).  if you specify a query on the command line, it  shows
        just the matched accounts and the balances from matched transactions.
 
-       Account names are normally indented to show the hierarchy (tree  mode).
+       Account  names are normally indented to show the hierarchy (tree mode).
        To see less detail, set a depth limit by pressing a number key, 1 to 9.
        0 shows even less detail, collapsing all accounts to a single total.  -
-       and  +  (or  =)  decrease  and increase the depth limit.  To remove the
-       depth limit, set it higher than the maximum  account  depth,  or  press
+       and + (or =) decrease and increase the  depth  limit.   To  remove  the
+       depth  limit,  set  it  higher than the maximum account depth, or press
        ESCAPE.
 
-       F  toggles  flat mode, in which accounts are shown as a flat list, with
-       their full names.  In this mode, account balances exclude  subaccounts,
-       except  for accounts at the depth limit (as with hledger's balance com-
+       F toggles flat mode, in which accounts are shown as a flat  list,  with
+       their  full names.  In this mode, account balances exclude subaccounts,
+       except for accounts at the depth limit (as with hledger's balance  com-
        mand).
 
        H toggles between showing historical balances or period balances.  His-
-       torical  balances  (the  default) are ending balances at the end of the
-       report period, taking into account all transactions  before  that  date
-       (filtered  by  the  filter query if any), including transactions before
-       the start of the report period.  In other  words,  historical  balances
-       are  what  you  would  see on a bank statement for that account (unless
-       disturbed by a filter  query).   Period  balances  ignore  transactions
+       torical balances (the default) are ending balances at the  end  of  the
+       report  period,  taking  into account all transactions before that date
+       (filtered by the filter query if any),  including  transactions  before
+       the  start  of  the report period.  In other words, historical balances
+       are what you would see on a bank statement  for  that  account  (unless
+       disturbed  by  a  filter  query).   Period balances ignore transactions
        before the report start date, so they show the change in balance during
        the report period.  They are more useful eg when viewing a time log.
 
        U toggles filtering by unmarked status, including or excluding unmarked
        postings in the balances.  Similarly, P toggles pending postings, and C
-       toggles cleared postings.  (By default, balances include all  postings;
-       if  you  activate  one  or  two status filters, only those postings are
+       toggles  cleared postings.  (By default, balances include all postings;
+       if you activate one or two status  filters,  only  those  postings  are
        included; and if you activate all three, the filter is removed.)
 
        R toggles real mode, in which virtual postings are ignored.
 
-       Z toggles nonzero mode, in which only accounts  with  nonzero  balances
-       are  shown (hledger-ui shows zero items by default, unlike command-line
+       Z  toggles  nonzero  mode, in which only accounts with nonzero balances
+       are shown (hledger-ui shows zero items by default, unlike  command-line
        hledger).
 
        Press right or enter to view an account's transactions register.
@@ -257,65 +267,65 @@ SCREENS
        This screen shows the transactions affecting a particular account, like
        a check register.  Each line represents one transaction and shows:
 
-       o the  other  account(s)  involved, in abbreviated form.  (If there are
-         both real and virtual postings, it shows only the  accounts  affected
+       o the other account(s) involved, in abbreviated form.   (If  there  are
+         both  real  and virtual postings, it shows only the accounts affected
          by real postings.)
 
-       o the  overall change to the current account's balance; positive for an
+       o the overall change to the current account's balance; positive for  an
          inflow to this account, negative for an outflow.
 
        o the running historical total or period total for the current account,
-         after  the  transaction.  This can be toggled with H.  Similar to the
-         accounts screen, the historical total  is  affected  by  transactions
-         (filtered  by  the  filter query) before the report start date, while
+         after the transaction.  This can be toggled with H.  Similar  to  the
+         accounts  screen,  the  historical  total is affected by transactions
+         (filtered by the filter query) before the report  start  date,  while
          the period total is not.  If the historical total is not disturbed by
-         a  filter  query, it will be the running historical balance you would
+         a filter query, it will be the running historical balance  you  would
          see on a bank register for the current account.
 
-       If the accounts screen was in  tree  mode,  the  register  screen  will
+       If  the  accounts  screen  was  in  tree mode, the register screen will
        include transactions from both the current account and its subaccounts.
-       If the accounts screen  was  in  flat  mode,  and  a  non-depth-clipped
-       account  was  selected,  the  register screen will exclude transactions
+       If  the  accounts  screen  was  in  flat  mode, and a non-depth-clipped
+       account was selected, the register  screen  will  exclude  transactions
        from subaccounts.  In other words, the register always shows the trans-
-       actions  responsible  for  the  period  balance  shown  on the accounts
+       actions responsible for  the  period  balance  shown  on  the  accounts
        screen.  As on the accounts screen, this can be toggled with F.
 
-       U toggles filtering by unmarked  status,  showing  or  hiding  unmarked
+       U  toggles  filtering  by  unmarked  status, showing or hiding unmarked
        transactions.  Similarly, P toggles pending transactions, and C toggles
-       cleared transactions.  (By default, transactions with all statuses  are
-       shown;  if  you activate one or two status filters, only those transac-
-       tions are  shown;  and  if  you  activate  all  three,  the  filter  is
+       cleared  transactions.  (By default, transactions with all statuses are
+       shown; if you activate one or two status filters, only  those  transac-
+       tions  are  shown;  and  if  you  activate  all  three,  the  filter is
        removed.)q
 
        R toggles real mode, in which virtual postings are ignored.
 
-       Z  toggles  nonzero  mode, in which only transactions posting a nonzero
-       change are shown (hledger-ui shows zero items by default,  unlike  com-
+       Z toggles nonzero mode, in which only transactions  posting  a  nonzero
+       change  are  shown (hledger-ui shows zero items by default, unlike com-
        mand-line hledger).
 
        Press right (or enter) to view the selected transaction in detail.
 
    Transaction screen
-       This  screen  shows  a  single transaction, as a general journal entry,
-       similar to hledger's print command and  journal  format  (hledger_jour-
+       This screen shows a single transaction, as  a  general  journal  entry,
+       similar  to  hledger's  print command and journal format (hledger_jour-
        nal(5)).
 
-       The  transaction's  date(s)  and  any  cleared  flag, transaction code,
-       description, comments, along with  all  of  its  account  postings  are
-       shown.   Simple  transactions  have two postings, but there can be more
+       The transaction's date(s)  and  any  cleared  flag,  transaction  code,
+       description,  comments,  along  with  all  of  its account postings are
+       shown.  Simple transactions have two postings, but there  can  be  more
        (or in certain cases, fewer).
 
-       up and down will step through all transactions listed in  the  previous
-       account  register screen.  In the title bar, the numbers in parentheses
-       show your position  within  that  account  register.   They  will  vary
+       up  and  down will step through all transactions listed in the previous
+       account register screen.  In the title bar, the numbers in  parentheses
+       show  your  position  within  that  account  register.   They will vary
        depending on which account register you came from (remember most trans-
        actions appear in multiple account registers).  The #N number preceding
        them is the transaction's position within the complete unfiltered jour-
        nal, which is a more stable id (at least until the next reload).
 
    Error screen
-       This screen will appear if there is a problem, such as a  parse  error,
-       when  you  press g to reload.  Once you have fixed the problem, press g
+       This  screen  will appear if there is a problem, such as a parse error,
+       when you press g to reload.  Once you have fixed the problem,  press  g
        again to reload and resume normal operation.  (Or, you can press escape
        to cancel the reload attempt.)
 
@@ -323,17 +333,17 @@ ENVIRONMENT
        COLUMNS The screen width to use.  Default: the full terminal width.
 
        LEDGER_FILE The journal file path when not specified with -f.  Default:
-       ~/.hledger.journal (on  windows,  perhaps  C:/Users/USER/.hledger.jour-
+       ~/.hledger.journal  (on  windows,  perhaps C:/Users/USER/.hledger.jour-
        nal).
 
 FILES
-       Reads  data from one or more files in hledger journal, timeclock, time-
-       dot,  or  CSV  format  specified   with   -f,   or   $LEDGER_FILE,   or
-       $HOME/.hledger.journal           (on          windows,          perhaps
+       Reads data from one or more files in hledger journal, timeclock,  time-
+       dot,   or   CSV   format   specified   with  -f,  or  $LEDGER_FILE,  or
+       $HOME/.hledger.journal          (on          windows,           perhaps
        C:/Users/USER/.hledger.journal).
 
 BUGS
-       The need to precede options with -- when invoked from hledger  is  awk-
+       The  need  to precede options with -- when invoked from hledger is awk-
        ward.
 
        -f- doesn't work (hledger-ui can't read from stdin).
@@ -341,13 +351,13 @@ BUGS
        -V affects only the accounts screen.
 
        When you press g, the current and all previous screens are regenerated,
-       which may cause a noticeable pause with large files.  Also there is  no
+       which  may cause a noticeable pause with large files.  Also there is no
        visual indication that this is in progress.
 
-       --watch  is  not yet fully robust.  It works well for normal usage, but
-       many file changes in a short time (eg  saving  the  file  thousands  of
-       times  with an editor macro) can cause problems at least on OSX.  Symp-
-       toms include: unresponsive UI, periodic resetting of the  cursor  posi-
+       --watch is not yet fully robust.  It works well for normal  usage,  but
+       many  file  changes  in  a  short time (eg saving the file thousands of
+       times with an editor macro) can cause problems at least on OSX.   Symp-
+       toms  include:  unresponsive UI, periodic resetting of the cursor posi-
        tion, momentary display of parse errors, high CPU usage eventually sub-
        siding, and possibly a small but persistent build-up of CPU usage until
        the program is restarted.
@@ -355,7 +365,7 @@ BUGS
 
 
 REPORTING BUGS
-       Report  bugs at http://bugs.hledger.org (or on the #hledger IRC channel
+       Report bugs at http://bugs.hledger.org (or on the #hledger IRC  channel
        or hledger mail list)
 
 
@@ -369,7 +379,7 @@ COPYRIGHT
 
 
 SEE ALSO
-       hledger(1),     hledger-ui(1),     hledger-web(1),      hledger-api(1),
+       hledger(1),      hledger-ui(1),     hledger-web(1),     hledger-api(1),
        hledger_csv(5), hledger_journal(5), hledger_timeclock(5), hledger_time-
        dot(5), ledger(1)
 
diff --git a/hledger-web/hledger-web.1 b/hledger-web/hledger-web.1
index 9eda166ff..0ccf42681 100644
--- a/hledger-web/hledger-web.1
+++ b/hledger-web/hledger-web.1
@@ -191,8 +191,8 @@ multiperiod/multicolumn report by year
 .RE
 .TP
 .B \f[C]\-p\ \-\-period=PERIODEXP\f[]
-set start date, end date, and/or reporting interval all at once
-(overrides the flags above)
+set start date, end date, and/or reporting interval all at once using
+period expressions syntax (overrides the flags above)
 .RS
 .RE
 .TP
@@ -242,6 +242,21 @@ convert amounts to their market value on the report end date (using the
 most recent applicable market price, if any)
 .RS
 .RE
+.TP
+.B \f[C]\-\-forecast\f[]
+generate forecast transactions from [periodic
+transaction]((journal.html#periodic\-transactions) rules.
+Each periodic transaction rule will generate forecast transactions,
+beginning the day after the last recorded journal transaction, and
+ending 6 months from today, or at the specified report end date.
+.RS
+.RE
+.TP
+.B \f[C]\-\-auto\f[]
+apply automated posting rules to modify transactions where applicable
+(can combine with \[en]forecast).
+.RS
+.RE
 .PP
 When a reporting option appears more than once in the command line, the
 last one takes precedence.
diff --git a/hledger-web/hledger-web.info b/hledger-web/hledger-web.info
index 8491130d5..eedefbed0 100644
--- a/hledger-web/hledger-web.info
+++ b/hledger-web/hledger-web.info
@@ -1,4 +1,4 @@
-This is hledger-web.info, produced by makeinfo version 6.0 from stdin.
+This is hledger-web.info, produced by makeinfo version 6.5 from stdin.
 
 
 File: hledger-web.info,  Node: Top,  Next: OPTIONS,  Up: (dir)
@@ -145,7 +145,7 @@ options as shown above.
 '-p --period=PERIODEXP'
 
      set start date, end date, and/or reporting interval all at once
-     (overrides the flags above)
+     using period expressions syntax (overrides the flags above)
 '--date2'
 
      match the secondary date instead (see command help for other
@@ -176,6 +176,17 @@ options as shown above.
 
      convert amounts to their market value on the report end date (using
      the most recent applicable market price, if any)
+'--forecast'
+
+     generate forecast transactions from [periodic
+     transaction]((journal.html#periodic-transactions) rules.  Each
+     periodic transaction rule will generate forecast transactions,
+     beginning the day after the last recorded journal transaction, and
+     ending 6 months from today, or at the specified report end date.
+'--auto'
+
+     apply automated posting rules to modify transactions where
+     applicable (can combine with -forecast).
 
    When a reporting option appears more than once in the command line,
 the last one takes precedence.
diff --git a/hledger-web/hledger-web.txt b/hledger-web/hledger-web.txt
index 3f0d19a5c..c18a71694 100644
--- a/hledger-web/hledger-web.txt
+++ b/hledger-web/hledger-web.txt
@@ -141,7 +141,7 @@ OPTIONS
 
        -p --period=PERIODEXP
               set start date, end date, and/or reporting interval all at  once
-              (overrides the flags above)
+              using period expressions syntax (overrides the flags above)
 
        --date2
               match  the  secondary  date  instead (see command help for other
@@ -173,6 +173,16 @@ OPTIONS
               convert  amounts  to  their  market value on the report end date
               (using the most recent applicable market price, if any)
 
+       --forecast
+              generate   forecast   transactions   from   [periodic   transac-
+              tion]((journal.html#periodic-transactions) rules.  Each periodic
+              transaction rule will generate forecast transactions,  beginning
+              the  day after the last recorded journal transaction, and ending
+              6 months from today, or at the specified report end date.
+
+       --auto apply automated  posting  rules  to  modify  transactions  where
+              applicable (can combine with -forecast).
+
        When a reporting option appears more than once in the command line, the
        last one takes precedence.
 
@@ -190,22 +200,22 @@ OPTIONS
               show debug output (levels 1-9, default: 1)
 
        A @FILE argument will be expanded to the contents of FILE, which should
-       contain one command line option/argument per line.  (To  prevent  this,
+       contain  one  command line option/argument per line.  (To prevent this,
        insert a -- argument before.)
 
 ENVIRONMENT
        LEDGER_FILE The journal file path when not specified with -f.  Default:
-       ~/.hledger.journal (on  windows,  perhaps  C:/Users/USER/.hledger.jour-
+       ~/.hledger.journal  (on  windows,  perhaps C:/Users/USER/.hledger.jour-
        nal).
 
 FILES
-       Reads  data from one or more files in hledger journal, timeclock, time-
-       dot,  or  CSV  format  specified   with   -f,   or   $LEDGER_FILE,   or
-       $HOME/.hledger.journal           (on          windows,          perhaps
+       Reads data from one or more files in hledger journal, timeclock,  time-
+       dot,   or   CSV   format   specified   with  -f,  or  $LEDGER_FILE,  or
+       $HOME/.hledger.journal          (on          windows,           perhaps
        C:/Users/USER/.hledger.journal).
 
 BUGS
-       The need to precede options with -- when invoked from hledger  is  awk-
+       The  need  to precede options with -- when invoked from hledger is awk-
        ward.
 
        -f- doesn't work (hledger-web can't read from stdin).
@@ -219,7 +229,7 @@ BUGS
 
 
 REPORTING BUGS
-       Report  bugs at http://bugs.hledger.org (or on the #hledger IRC channel
+       Report bugs at http://bugs.hledger.org (or on the #hledger IRC  channel
        or hledger mail list)
 
 
@@ -233,7 +243,7 @@ COPYRIGHT
 
 
 SEE ALSO
-       hledger(1),     hledger-ui(1),     hledger-web(1),      hledger-api(1),
+       hledger(1),      hledger-ui(1),     hledger-web(1),     hledger-api(1),
        hledger_csv(5), hledger_journal(5), hledger_timeclock(5), hledger_time-
        dot(5), ledger(1)
 
diff --git a/hledger/hledger.1 b/hledger/hledger.1
index a2e61dea7..28440aa84 100644
--- a/hledger/hledger.1
+++ b/hledger/hledger.1
@@ -246,8 +246,8 @@ multiperiod/multicolumn report by year
 .RE
 .TP
 .B \f[C]\-p\ \-\-period=PERIODEXP\f[]
-set start date, end date, and/or reporting interval all at once
-(overrides the flags above)
+set start date, end date, and/or reporting interval all at once using
+period expressions syntax (overrides the flags above)
 .RS
 .RE
 .TP
@@ -297,6 +297,21 @@ convert amounts to their market value on the report end date (using the
 most recent applicable market price, if any)
 .RS
 .RE
+.TP
+.B \f[C]\-\-forecast\f[]
+generate forecast transactions from [periodic
+transaction]((journal.html#periodic\-transactions) rules.
+Each periodic transaction rule will generate forecast transactions,
+beginning the day after the last recorded journal transaction, and
+ending 6 months from today, or at the specified report end date.
+.RS
+.RE
+.TP
+.B \f[C]\-\-auto\f[]
+apply automated posting rules to modify transactions where applicable
+(can combine with \[en]forecast).
+.RS
+.RE
 .PP
 When a reporting option appears more than once in the command line, the
 last one takes precedence.
@@ -407,7 +422,7 @@ turn:
 .PP
 .TS
 tab(@);
-lw(10.7n) lw(33.2n) lw(26.1n).
+lw(10.3n) lw(33.5n) lw(26.2n).
 T{
 Reader:
 T}@T{
@@ -1433,6 +1448,19 @@ Sort by amount (total row amount, or by average if that is displayed),
 instead of account name (in flat mode)
 .RS
 .RE
+.TP
+.B \f[C]\-\-budget\f[]
+Treat periodic transaction as definition of a budget.
+Compare real balances to budget balances and show percentage of budget
+consumed.
+.RS
+.RE
+.TP
+.B \f[C]\-\-show\-unbudgeted\f[]
+When \[en]budget is used, display accounts that do not have budget
+defined
+.RS
+.RE
 .PP
 The balance command displays accounts and balances.
 It is hledger's most featureful and versatile command.
@@ -1641,6 +1669,108 @@ Balance\ changes\ in\ 2008:
 #\ Average\ is\ rounded\ to\ the\ dollar\ here\ since\ all\ journal\ amounts\ are
 \f[]
 .fi
+.SS Budgets
+.PP
+The \f[C]\-\-budget\f[] flag will treat all [periodic
+transaction]((journal.html#periodic\-transactions) in your journal as
+definition of the budget and allow you to compare real balances versus
+budgeted amounts.
+.PP
+For example, you can take average monthly expenses in the common expense
+categories to construct a minimal monthly budget:
+.IP
+.nf
+\f[C]
+;;\ Budget
+~\ monthly
+\ \ income\ \ $2000
+\ \ expenses:food\ \ \ \ $400
+\ \ expenses:bus\ \ \ \ \ $50
+\ \ expenses:movies\ \ $30
+\ \ assets:bank:checking
+
+;;\ Two\ months\ worth\ of\ expenses
+2017\-11\-01
+\ \ income\ \ $1950
+\ \ expenses:food\ \ \ \ $396
+\ \ expenses:bus\ \ \ \ \ $49
+\ \ expenses:movies\ \ $30
+\ \ expenses:supplies\ \ $20
+\ \ assets:bank:checking
+
+2017\-12\-01
+\ \ income\ \ $2100
+\ \ expenses:food\ \ \ \ $412
+\ \ expenses:bus\ \ \ \ \ $53
+\ \ expenses:gifts\ \ \ $100
+\ \ assets:bank:checking
+\f[]
+.fi
+.PP
+You can now compare real balances with budget:
+.IP
+.nf
+\f[C]
+$\ hledge\ balance\ \-M\ \-\-budget
+Balance\ changes\ in\ 2017/11/01\-2017/12/31:
+
+\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ||\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 2017/11\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 2017/12\ 
+=======================++=================================================
+\ <unbudgeted>:expenses\ ||\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $20\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $100\ 
+\ assets:bank:checking\ \ ||\ $\-2445\ [99%\ of\ $\-2480]\ \ $\-2665\ [107%\ of\ $\-2480]\ 
+\ expenses:bus\ \ \ \ \ \ \ \ \ \ ||\ \ \ \ \ \ \ $49\ [98%\ of\ $50]\ \ \ \ \ \ \ \ $53\ [106%\ of\ $50]\ 
+\ expenses:food\ \ \ \ \ \ \ \ \ ||\ \ \ \ \ $396\ [99%\ of\ $400]\ \ \ \ \ \ $412\ [103%\ of\ $400]\ 
+\ expenses:movies\ \ \ \ \ \ \ ||\ \ \ \ \ \ $30\ [100%\ of\ $30]\ \ \ \ \ \ \ \ \ \ \ \ 0\ [0%\ of\ $30]\ 
+\ income\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ||\ \ \ $1950\ [98%\ of\ $2000]\ \ \ \ $2100\ [105%\ of\ $2000]\ 
+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-++\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
+\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ||\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 0\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 0\ 
+\f[]
+.fi
+.PP
+You can roll over unspent budgets to next period with
+\f[C]\-\-cumulative\f[]:
+.IP
+.nf
+\f[C]
+$\ hledger\ balance\ \-M\ \-\-budget\ \-\-cumulative
+Ending\ balances\ (cumulative)\ in\ 2017/11/01\-2017/12/31:
+
+\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ||\ \ \ \ \ \ \ \ \ \ \ \ \ 2017/11/30\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 2017/12/31\ 
+=======================++=================================================
+\ <unbudgeted>:expenses\ ||\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $20\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $120\ 
+\ assets:bank:checking\ \ ||\ $\-2445\ [99%\ of\ $\-2480]\ \ $\-5110\ [103%\ of\ $\-4960]\ 
+\ expenses:bus\ \ \ \ \ \ \ \ \ \ ||\ \ \ \ \ \ \ $49\ [98%\ of\ $50]\ \ \ \ \ \ $102\ [102%\ of\ $100]\ 
+\ expenses:food\ \ \ \ \ \ \ \ \ ||\ \ \ \ \ $396\ [99%\ of\ $400]\ \ \ \ \ \ $808\ [101%\ of\ $800]\ 
+\ expenses:movies\ \ \ \ \ \ \ ||\ \ \ \ \ \ $30\ [100%\ of\ $30]\ \ \ \ \ \ \ \ \ $30\ [50%\ of\ $60]\ 
+\ income\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ||\ \ \ $1950\ [98%\ of\ $2000]\ \ \ \ $4050\ [101%\ of\ $4000]\ 
+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-++\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
+\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ||\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 0\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 0
+\f[]
+.fi
+.PP
+Adding \f[C]\-\-show\-unbudgeted\f[] will allow you to see all the
+accounts for which budgets:
+.IP
+.nf
+\f[C]
+$\ hledger\ balance\ \-\-budget\ \-\-show\-unbudgeted
+Balance\ changes\ in\ 2017/11/01\-2017/12/31:
+
+\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ||\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 2017/11\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 2017/12\ 
+======================++=================================================
+\ assets:bank:checking\ ||\ $\-2445\ [99%\ of\ $\-2480]\ \ $\-2665\ [107%\ of\ $\-2480]\ 
+\ expenses:bus\ \ \ \ \ \ \ \ \ ||\ \ \ \ \ \ \ $49\ [98%\ of\ $50]\ \ \ \ \ \ \ \ $53\ [106%\ of\ $50]\ 
+\ expenses:food\ \ \ \ \ \ \ \ ||\ \ \ \ \ $396\ [99%\ of\ $400]\ \ \ \ \ \ $412\ [103%\ of\ $400]\ 
+\ expenses:gifts\ \ \ \ \ \ \ ||\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 0\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $100\ 
+\ expenses:movies\ \ \ \ \ \ ||\ \ \ \ \ \ $30\ [100%\ of\ $30]\ \ \ \ \ \ \ \ \ \ \ \ 0\ [0%\ of\ $30]\ 
+\ expenses:supplies\ \ \ \ ||\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $20\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 0\ 
+\ income\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ||\ \ \ $1950\ [98%\ of\ $2000]\ \ \ \ $2100\ [105%\ of\ $2000]\ 
+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-++\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
+\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ||\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 0\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 0\ 
+\f[]
+.fi
+.PP
+For more examples and details, see Budgeting and Forecasting.
 .SS Custom balance output
 .PP
 In simple (non\-multi\-column) balance reports, you can customise the
diff --git a/hledger/hledger.info b/hledger/hledger.info
index 72d7ca26a..a8ba671c1 100644
--- a/hledger/hledger.info
+++ b/hledger/hledger.info
@@ -1,4 +1,4 @@
-This is hledger.info, produced by makeinfo version 6.0 from stdin.
+This is hledger.info, produced by makeinfo version 6.5 from stdin.
 
 
 File: hledger.info,  Node: Top,  Next: EXAMPLES,  Up: (dir)
@@ -201,7 +201,7 @@ by most hledger commands, run 'hledger -h'.
 '-p --period=PERIODEXP'
 
      set start date, end date, and/or reporting interval all at once
-     (overrides the flags above)
+     using period expressions syntax (overrides the flags above)
 '--date2'
 
      match the secondary date instead (see command help for other
@@ -232,6 +232,17 @@ by most hledger commands, run 'hledger -h'.
 
      convert amounts to their market value on the report end date (using
      the most recent applicable market price, if any)
+'--forecast'
+
+     generate forecast transactions from [periodic
+     transaction]((journal.html#periodic-transactions) rules.  Each
+     periodic transaction rule will generate forecast transactions,
+     beginning the day after the last recorded journal transaction, and
+     ending 6 months from today, or at the specified report end date.
+'--auto'
+
+     apply automated posting rules to modify transactions where
+     applicable (can combine with -forecast).
 
    When a reporting option appears more than once in the command line,
 the last one takes precedence.
@@ -339,15 +350,15 @@ be one of several other formats, listed below.  hledger detects the
 format automatically based on the file extension, or if that is not
 recognised, by trying each built-in "reader" in turn:
 
-Reader:     Reads:                             Used for file extensions:
----------------------------------------------------------------------------
-'journal'   hledger's journal format, also     '.journal' '.j'
-            some Ledger journals               '.hledger' '.ledger'
-'timeclock' timeclock files (precise time      '.timeclock'
+Reader:     Reads:                              Used for file extensions:
+----------------------------------------------------------------------------
+'journal'   hledger's journal format, also      '.journal' '.j'
+            some Ledger journals                '.hledger' '.ledger'
+'timeclock' timeclock files (precise time       '.timeclock'
             logging)
-'timedot'   timedot files (approximate time    '.timedot'
+'timedot'   timedot files (approximate time     '.timedot'
             logging)
-'csv'       comma-separated values (data       '.csv'
+'csv'       comma-separated values (data        '.csv'
             interchange)
 
    If needed (eg to ensure correct error messages when a file has the
@@ -950,7 +961,7 @@ default).  With query arguments, it counts only matched transactions.
 $ hledger activity --quarterly
 2008-01-01 **
 2008-04-01 *******
-2008-07-01
+2008-07-01 
 2008-10-01 **
 
 
@@ -1007,18 +1018,18 @@ An optional ; COMMENT may follow descriptions or amounts.
 If you make a mistake, enter < at any prompt to restart the transaction.
 To end a transaction, enter . when prompted.
 To quit, enter . at a date prompt or press control-d or control-c.
-Date [2015/05/22]:
+Date [2015/05/22]: 
 Description: supermarket
 Account 1: expenses:food
 Amount  1: $10
 Account 2: assets:checking
-Amount  2 [$-10.0]:
+Amount  2 [$-10.0]: 
 Account 3 (or . or enter to finish this transaction): .
 2015/05/22 supermarket
     expenses:food             $10
     assets:checking        $-10.0
 
-Save this transaction to the journal ? [y]:
+Save this transaction to the journal ? [y]: 
 Saved.
 Starting the next transaction (. or ctrl-D/ctrl-C to quit)
 Date [2015/05/22]: <CTRL-D> $
@@ -1082,6 +1093,14 @@ Show accounts and their balances.  Aliases: b, bal.
 
      Sort by amount (total row amount, or by average if that is
      displayed), instead of account name (in flat mode)
+'--budget'
+
+     Treat periodic transaction as definition of a budget.  Compare real
+     balances to budget balances and show percentage of budget consumed.
+'--show-unbudgeted'
+
+     When -budget is used, display accounts that do not have budget
+     defined
 
    The balance command displays accounts and balances.  It is hledger's
 most featureful and versatile command.
@@ -1131,6 +1150,7 @@ $ hledger balance -p 2008/6 expenses --no-total
 * Flat mode::
 * Depth limited balance reports::
 * Multicolumn balance reports::
+* Budgets::
 * Custom balance output::
 * Colour support::
 * Output destination::
@@ -1170,7 +1190,7 @@ $ hledger balance -N --depth 1
                   $1  liabilities
 
 
-File: hledger.info,  Node: Multicolumn balance reports,  Next: Custom balance output,  Prev: Depth limited balance reports,  Up: balance
+File: hledger.info,  Node: Multicolumn balance reports,  Next: Budgets,  Prev: Depth limited balance reports,  Up: balance
 
 4.4.3 Multicolumn balance reports
 ---------------------------------
@@ -1185,15 +1205,15 @@ report, showing different information:
 
      $ hledger balance --quarterly income expenses -E
      Balance changes in 2008:
-
-                        ||  2008q1  2008q2  2008q3  2008q4
+     
+                        ||  2008q1  2008q2  2008q3  2008q4 
      ===================++=================================
-      expenses:food     ||       0      $1       0       0
-      expenses:supplies ||       0      $1       0       0
-      income:gifts      ||       0     $-1       0       0
-      income:salary     ||     $-1       0       0       0
+      expenses:food     ||       0      $1       0       0 
+      expenses:supplies ||       0      $1       0       0 
+      income:gifts      ||       0     $-1       0       0 
+      income:salary     ||     $-1       0       0       0 
      -------------------++---------------------------------
-                        ||     $-1      $1       0       0
+                        ||     $-1      $1       0       0 
 
   2. With '--cumulative': each column shows the ending balance for that
      period, accumulating the changes across periods, starting from 0 at
@@ -1201,15 +1221,15 @@ report, showing different information:
 
      $ hledger balance --quarterly income expenses -E --cumulative
      Ending balances (cumulative) in 2008:
-
-                        ||  2008/03/31  2008/06/30  2008/09/30  2008/12/31
+     
+                        ||  2008/03/31  2008/06/30  2008/09/30  2008/12/31 
      ===================++=================================================
-      expenses:food     ||           0          $1          $1          $1
-      expenses:supplies ||           0          $1          $1          $1
-      income:gifts      ||           0         $-1         $-1         $-1
-      income:salary     ||         $-1         $-1         $-1         $-1
+      expenses:food     ||           0          $1          $1          $1 
+      expenses:supplies ||           0          $1          $1          $1 
+      income:gifts      ||           0         $-1         $-1         $-1 
+      income:salary     ||         $-1         $-1         $-1         $-1 
      -------------------++-------------------------------------------------
-                        ||         $-1           0           0           0
+                        ||         $-1           0           0           0 
 
   3. With '--historical/-H': each column shows the actual historical
      ending balance for that period, accumulating the changes across
@@ -1219,15 +1239,15 @@ report, showing different information:
 
      $ hledger balance ^assets ^liabilities --quarterly --historical --begin 2008/4/1
      Ending balances (historical) in 2008/04/01-2008/12/31:
-
-                           ||  2008/06/30  2008/09/30  2008/12/31
+     
+                           ||  2008/06/30  2008/09/30  2008/12/31 
      ======================++=====================================
-      assets:bank:checking ||          $1          $1           0
-      assets:bank:saving   ||          $1          $1          $1
-      assets:cash          ||         $-2         $-2         $-2
-      liabilities:debts    ||           0           0          $1
+      assets:bank:checking ||          $1          $1           0 
+      assets:bank:saving   ||          $1          $1          $1 
+      assets:cash          ||         $-2         $-2         $-2 
+      liabilities:debts    ||           0           0          $1 
      ----------------------++-------------------------------------
-                           ||           0           0           0
+                           ||           0           0           0 
 
    Multi-column balance reports display accounts in flat mode by
 default; to see the hierarchy, use '--tree'.
@@ -1256,23 +1276,113 @@ each row.
 $ hledger balance -Q income expenses --tree -ETA
 Balance changes in 2008:
 
-            ||  2008q1  2008q2  2008q3  2008q4    Total  Average
+            ||  2008q1  2008q2  2008q3  2008q4    Total  Average 
 ============++===================================================
- expenses   ||       0      $2       0       0       $2       $1
-   food     ||       0      $1       0       0       $1        0
-   supplies ||       0      $1       0       0       $1        0
- income     ||     $-1     $-1       0       0      $-2      $-1
-   gifts    ||       0     $-1       0       0      $-1        0
-   salary   ||     $-1       0       0       0      $-1        0
+ expenses   ||       0      $2       0       0       $2       $1 
+   food     ||       0      $1       0       0       $1        0 
+   supplies ||       0      $1       0       0       $1        0 
+ income     ||     $-1     $-1       0       0      $-2      $-1 
+   gifts    ||       0     $-1       0       0      $-1        0 
+   salary   ||     $-1       0       0       0      $-1        0 
 ------------++---------------------------------------------------
-            ||     $-1      $1       0       0        0        0
+            ||     $-1      $1       0       0        0        0 
 
 # Average is rounded to the dollar here since all journal amounts are
 
 
-File: hledger.info,  Node: Custom balance output,  Next: Colour support,  Prev: Multicolumn balance reports,  Up: balance
+File: hledger.info,  Node: Budgets,  Next: Custom balance output,  Prev: Multicolumn balance reports,  Up: balance
 
-4.4.4 Custom balance output
+4.4.4 Budgets
+-------------
+
+The '--budget' flag will treat all [periodic
+transaction]((journal.html#periodic-transactions) in your journal as
+definition of the budget and allow you to compare real balances versus
+budgeted amounts.
+
+   For example, you can take average monthly expenses in the common
+expense categories to construct a minimal monthly budget:
+
+;; Budget
+~ monthly
+  income  $2000
+  expenses:food    $400
+  expenses:bus     $50
+  expenses:movies  $30
+  assets:bank:checking
+
+;; Two months worth of expenses
+2017-11-01
+  income  $1950
+  expenses:food    $396
+  expenses:bus     $49
+  expenses:movies  $30
+  expenses:supplies  $20
+  assets:bank:checking
+
+2017-12-01
+  income  $2100
+  expenses:food    $412
+  expenses:bus     $53
+  expenses:gifts   $100
+  assets:bank:checking
+
+   You can now compare real balances with budget:
+
+$ hledge balance -M --budget
+Balance changes in 2017/11/01-2017/12/31:
+
+                       ||                2017/11                  2017/12 
+=======================++=================================================
+ <unbudgeted>:expenses ||                    $20                     $100 
+ assets:bank:checking  || $-2445 [99% of $-2480]  $-2665 [107% of $-2480] 
+ expenses:bus          ||       $49 [98% of $50]        $53 [106% of $50] 
+ expenses:food         ||     $396 [99% of $400]      $412 [103% of $400] 
+ expenses:movies       ||      $30 [100% of $30]            0 [0% of $30] 
+ income                ||   $1950 [98% of $2000]    $2100 [105% of $2000] 
+-----------------------++-------------------------------------------------
+                       ||                      0                        0 
+
+   You can roll over unspent budgets to next period with '--cumulative':
+
+$ hledger balance -M --budget --cumulative
+Ending balances (cumulative) in 2017/11/01-2017/12/31:
+
+                       ||             2017/11/30               2017/12/31 
+=======================++=================================================
+ <unbudgeted>:expenses ||                    $20                     $120 
+ assets:bank:checking  || $-2445 [99% of $-2480]  $-5110 [103% of $-4960] 
+ expenses:bus          ||       $49 [98% of $50]      $102 [102% of $100] 
+ expenses:food         ||     $396 [99% of $400]      $808 [101% of $800] 
+ expenses:movies       ||      $30 [100% of $30]         $30 [50% of $60] 
+ income                ||   $1950 [98% of $2000]    $4050 [101% of $4000] 
+-----------------------++-------------------------------------------------
+                       ||                      0                        0
+
+   Adding '--show-unbudgeted' will allow you to see all the accounts for
+which budgets:
+
+$ hledger balance --budget --show-unbudgeted
+Balance changes in 2017/11/01-2017/12/31:
+
+                      ||                2017/11                  2017/12 
+======================++=================================================
+ assets:bank:checking || $-2445 [99% of $-2480]  $-2665 [107% of $-2480] 
+ expenses:bus         ||       $49 [98% of $50]        $53 [106% of $50] 
+ expenses:food        ||     $396 [99% of $400]      $412 [103% of $400] 
+ expenses:gifts       ||                      0                     $100 
+ expenses:movies      ||      $30 [100% of $30]            0 [0% of $30] 
+ expenses:supplies    ||                    $20                        0 
+ income               ||   $1950 [98% of $2000]    $2100 [105% of $2000] 
+----------------------++-------------------------------------------------
+                      ||                      0                        0 
+
+   For more examples and details, see Budgeting and Forecasting.
+
+
+File: hledger.info,  Node: Custom balance output,  Next: Colour support,  Prev: Budgets,  Up: balance
+
+4.4.5 Custom balance output
 ---------------------------
 
 In simple (non-multi-column) balance reports, you can customise the
@@ -1332,7 +1442,7 @@ may be needed to get pleasing results.
 
 File: hledger.info,  Node: Colour support,  Next: Output destination,  Prev: Custom balance output,  Up: balance
 
-4.4.5 Colour support
+4.4.6 Colour support
 --------------------
 
 The balance command shows negative amounts in red, if:
@@ -1343,7 +1453,7 @@ The balance command shows negative amounts in red, if:
 
 File: hledger.info,  Node: Output destination,  Next: CSV output,  Prev: Colour support,  Up: balance
 
-4.4.6 Output destination
+4.4.7 Output destination
 ------------------------
 
 The balance, print, register and stats commands can write their output
@@ -1356,7 +1466,7 @@ $ hledger balance -o FILE  # write to FILE
 
 File: hledger.info,  Node: CSV output,  Prev: Output destination,  Up: balance
 
-4.4.7 CSV output
+4.4.8 CSV output
 ----------------
 
 The balance, print and register commands can write their output as CSV.
@@ -2033,7 +2143,7 @@ Show some journal statistics.
 
 $ hledger stats
 Main journal file        : /src/hledger/examples/sample.journal
-Included journal files   :
+Included journal files   : 
 Transactions span        : 2008-01-01 to 2009-01-01 (366 days)
 Last transaction         : 2008-12-31 (2333 days ago)
 Transactions             : 5 (0.0 per day)
@@ -2264,129 +2374,131 @@ Node: OPTIONS3628
 Ref: #options3730
 Node: General options4046
 Ref: #general-options4171
-Node: Command options6490
-Ref: #command-options6641
-Node: Command arguments7039
-Ref: #command-arguments7193
-Node: Argument files7314
-Ref: #argument-files7465
-Node: Special characters7731
-Ref: #special-characters7884
-Node: Input files9303
-Ref: #input-files9439
-Node: Smart dates11402
-Ref: #smart-dates11543
-Node: Report start & end date12522
-Ref: #report-start-end-date12692
-Node: Report intervals13757
-Ref: #report-intervals13920
-Node: Period expressions14321
-Ref: #period-expressions14478
-Node: For example16523
-Ref: #for-example16666
-Node: Depth limiting18590
-Ref: #depth-limiting18727
-Node: Pivoting19069
-Ref: #pivoting19187
-Node: Cost20863
-Ref: #cost20971
-Node: Market value21089
-Ref: #market-value21224
-Node: Regular expressions22524
-Ref: #regular-expressions22660
-Node: QUERIES24021
-Ref: #queries24123
-Node: COMMANDS28090
-Ref: #commands28202
-Node: accounts29185
-Ref: #accounts29283
-Node: activity30276
-Ref: #activity30386
-Node: add30745
-Ref: #add30844
-Node: balance33502
-Ref: #balance33613
-Node: Flat mode36770
-Ref: #flat-mode36895
-Node: Depth limited balance reports37315
-Ref: #depth-limited-balance-reports37516
-Node: Multicolumn balance reports37936
-Ref: #multicolumn-balance-reports38145
-Node: Custom balance output42793
-Ref: #custom-balance-output42975
-Node: Colour support45068
-Ref: #colour-support45227
-Node: Output destination45400
-Ref: #output-destination45556
-Node: CSV output45826
-Ref: #csv-output45943
-Node: balancesheet46340
-Ref: #balancesheet46476
-Node: balancesheetequity48444
-Ref: #balancesheetequity48593
-Node: cashflow49382
-Ref: #cashflow49510
-Node: check-dates51422
-Ref: #check-dates51549
-Node: check-dupes51666
-Ref: #check-dupes51791
-Node: equity51928
-Ref: #equity52038
-Node: help52201
-Ref: #help52302
-Node: import53376
-Ref: #import53490
-Node: incomestatement54220
-Ref: #incomestatement54354
-Node: prices56307
-Ref: #prices56422
-Node: print56465
-Ref: #print56575
-Node: print-unique61421
-Ref: #print-unique61547
-Node: register61615
-Ref: #register61742
-Node: Custom register output66243
-Ref: #custom-register-output66372
-Node: register-match67669
-Ref: #register-match67803
-Node: rewrite67986
-Ref: #rewrite68103
-Node: stats68172
-Ref: #stats68275
-Node: tags69156
-Ref: #tags69254
-Node: test69490
-Ref: #test69574
-Node: ADD-ON COMMANDS69942
-Ref: #add-on-commands70052
-Node: Official add-ons71339
-Ref: #official-add-ons71479
-Node: api71566
-Ref: #api71655
-Node: ui71707
-Ref: #ui71806
-Node: web71864
-Ref: #web71953
-Node: Third party add-ons71999
-Ref: #third-party-add-ons72174
-Node: diff72309
-Ref: #diff72406
-Node: iadd72505
-Ref: #iadd72619
-Node: interest72702
-Ref: #interest72823
-Node: irr72918
-Ref: #irr73016
-Node: Experimental add-ons73094
-Ref: #experimental-add-ons73246
-Node: autosync73537
-Ref: #autosync73649
-Node: budget73888
-Ref: #budget74010
-Node: chart74076
-Ref: #chart74193
-Node: check74264
-Ref: #check74366
+Node: Command options6985
+Ref: #command-options7136
+Node: Command arguments7534
+Ref: #command-arguments7688
+Node: Argument files7809
+Ref: #argument-files7960
+Node: Special characters8226
+Ref: #special-characters8379
+Node: Input files9798
+Ref: #input-files9934
+Node: Smart dates11904
+Ref: #smart-dates12045
+Node: Report start & end date13024
+Ref: #report-start-end-date13194
+Node: Report intervals14259
+Ref: #report-intervals14422
+Node: Period expressions14823
+Ref: #period-expressions14980
+Node: For example17025
+Ref: #for-example17168
+Node: Depth limiting19092
+Ref: #depth-limiting19229
+Node: Pivoting19571
+Ref: #pivoting19689
+Node: Cost21365
+Ref: #cost21473
+Node: Market value21591
+Ref: #market-value21726
+Node: Regular expressions23026
+Ref: #regular-expressions23162
+Node: QUERIES24523
+Ref: #queries24625
+Node: COMMANDS28592
+Ref: #commands28704
+Node: accounts29687
+Ref: #accounts29785
+Node: activity30778
+Ref: #activity30888
+Node: add31248
+Ref: #add31347
+Node: balance34008
+Ref: #balance34119
+Node: Flat mode37548
+Ref: #flat-mode37673
+Node: Depth limited balance reports38093
+Ref: #depth-limited-balance-reports38294
+Node: Multicolumn balance reports38714
+Ref: #multicolumn-balance-reports38909
+Node: Budgets43598
+Ref: #budgets43745
+Node: Custom balance output47361
+Ref: #custom-balance-output47523
+Node: Colour support49616
+Ref: #colour-support49775
+Node: Output destination49948
+Ref: #output-destination50104
+Node: CSV output50374
+Ref: #csv-output50491
+Node: balancesheet50888
+Ref: #balancesheet51024
+Node: balancesheetequity52992
+Ref: #balancesheetequity53141
+Node: cashflow53930
+Ref: #cashflow54058
+Node: check-dates55970
+Ref: #check-dates56097
+Node: check-dupes56214
+Ref: #check-dupes56339
+Node: equity56476
+Ref: #equity56586
+Node: help56749
+Ref: #help56850
+Node: import57924
+Ref: #import58038
+Node: incomestatement58768
+Ref: #incomestatement58902
+Node: prices60855
+Ref: #prices60970
+Node: print61013
+Ref: #print61123
+Node: print-unique65969
+Ref: #print-unique66095
+Node: register66163
+Ref: #register66290
+Node: Custom register output70791
+Ref: #custom-register-output70920
+Node: register-match72217
+Ref: #register-match72351
+Node: rewrite72534
+Ref: #rewrite72651
+Node: stats72720
+Ref: #stats72823
+Node: tags73705
+Ref: #tags73803
+Node: test74039
+Ref: #test74123
+Node: ADD-ON COMMANDS74491
+Ref: #add-on-commands74601
+Node: Official add-ons75888
+Ref: #official-add-ons76028
+Node: api76115
+Ref: #api76204
+Node: ui76256
+Ref: #ui76355
+Node: web76413
+Ref: #web76502
+Node: Third party add-ons76548
+Ref: #third-party-add-ons76723
+Node: diff76858
+Ref: #diff76955
+Node: iadd77054
+Ref: #iadd77168
+Node: interest77251
+Ref: #interest77372
+Node: irr77467
+Ref: #irr77565
+Node: Experimental add-ons77643
+Ref: #experimental-add-ons77795
+Node: autosync78086
+Ref: #autosync78198
+Node: budget78437
+Ref: #budget78559
+Node: chart78625
+Ref: #chart78742
+Node: check78813
+Ref: #check78915
 
 End Tag Table
diff --git a/hledger/hledger.txt b/hledger/hledger.txt
index 7b8d0aa67..f646f8ea0 100644
--- a/hledger/hledger.txt
+++ b/hledger/hledger.txt
@@ -170,7 +170,7 @@ OPTIONS
 
        -p --period=PERIODEXP
               set  start date, end date, and/or reporting interval all at once
-              (overrides the flags above)
+              using period expressions syntax (overrides the flags above)
 
        --date2
               match the secondary date instead (see  command  help  for  other
@@ -202,54 +202,64 @@ OPTIONS
               convert amounts to their market value on  the  report  end  date
               (using the most recent applicable market price, if any)
 
+       --forecast
+              generate   forecast   transactions   from   [periodic   transac-
+              tion]((journal.html#periodic-transactions) rules.  Each periodic
+              transaction  rule will generate forecast transactions, beginning
+              the day after the last recorded journal transaction, and  ending
+              6 months from today, or at the specified report end date.
+
+       --auto apply  automated  posting  rules  to  modify  transactions where
+              applicable (can combine with -forecast).
+
        When a reporting option appears more than once in the command line, the
        last one takes precedence.
 
        Some reporting options can also be written as query arguments.
 
    Command options
-       To see options for a  particular  command,  including  command-specific
+       To  see  options  for  a particular command, including command-specific
        options, run: hledger COMMAND -h.
 
-       Command-specific  options  must  be written after the command name, eg:
+       Command-specific options must be written after the  command  name,  eg:
        hledger print -x.
 
-       Additionally, if the command is an addon,  you  may  need  to  put  its
-       options  after a double-hyphen, eg: hledger ui -- --watch.  Or, you can
+       Additionally,  if  the  command  is  an  addon, you may need to put its
+       options after a double-hyphen, eg: hledger ui -- --watch.  Or, you  can
        run the addon executable directly: hledger-ui --watch.
 
    Command arguments
-       Most hledger commands accept arguments after the  command  name,  which
+       Most  hledger  commands  accept arguments after the command name, which
        are often a query, filtering the data in some way.
 
    Argument files
        You can save a set of command line options/arguments in a file, one per
-       line, and then reuse them by writing @FILENAME in a command  line.   To
+       line,  and  then reuse them by writing @FILENAME in a command line.  To
        prevent this expansion of @-arguments, precede them with a -- argument.
        For more, see Save frequently used options.
 
    Special characters
-       Option and argument values which contain problematic characters  should
-       be  escaped  with  double quotes, backslashes, or (best) single quotes.
+       Option  and argument values which contain problematic characters should
+       be escaped with double quotes, backslashes, or  (best)  single  quotes.
        Problematic characters means spaces, and also characters which are sig-
-       nificant  to  your  command shell, such as less-than/greater-than.  Eg:
+       nificant to your command shell, such  as  less-than/greater-than.   Eg:
        hledger register -p 'last year' "accounts receivable (receiv-
        able|payable)" amt:\>100.
 
-       Characters  which  are  significant  both  to  the shell and in regular
-       expressions sometimes need to be double-escaped.  These include  paren-
-       theses,  the  pipe symbol and the dollar sign.  Eg, to match the dollar
-       symbol, bash users should do: hledger balance cur:'\$' or  hledger bal-
+       Characters which are significant both  to  the  shell  and  in  regular
+       expressions  sometimes need to be double-escaped.  These include paren-
+       theses, the pipe symbol and the dollar sign.  Eg, to match  the  dollar
+       symbol,  bash users should do: hledger balance cur:'\$' or hledger bal-
        ance cur:\\$.
 
        When hledger is invoking an addon executable (like hledger-ui), options
        and arguments get de-escaped once more, so you might need triple-escap-
-       ing.   Eg:  hledger ui cur:'\\$' or hledger ui cur:\\\\$ in bash.  (The
-       number of backslashes in fish shell is left  as  an  exercise  for  the
+       ing.  Eg: hledger ui cur:'\\$' or hledger ui cur:\\\\$ in  bash.   (The
+       number  of  backslashes  in  fish  shell is left as an exercise for the
        reader.)
 
-       Inside  a  file used for argument expansion, one less level of escaping
-       is enough.  (And in this case, backslashes seem  to  work  better  than
+       Inside a file used for argument expansion, one less level  of  escaping
+       is  enough.   (And  in  this case, backslashes seem to work better than
        quotes.  Eg: cur:\$).
 
        If in doubt, keep things simple:
@@ -267,7 +277,7 @@ OPTIONS
    Input files
        hledger reads transactions from a data file (and the add command writes
        to it).  By default this file is $HOME/.hledger.journal (or on Windows,
-       something  like C:/Users/USER/.hledger.journal).  You can override this
+       something like C:/Users/USER/.hledger.journal).  You can override  this
        with the $LEDGER_FILE environment variable:
 
               $ setenv LEDGER_FILE ~/finance/2016.journal
@@ -281,25 +291,25 @@ OPTIONS
 
               $ cat some.journal | hledger -f-
 
-       Usually the data file is in hledger's journal format, but it  can  also
-       be  one  of  several  other formats, listed below.  hledger detects the
-       format automatically based on the file extension, or  if  that  is  not
+       Usually  the  data file is in hledger's journal format, but it can also
+       be one of several other formats, listed  below.   hledger  detects  the
+       format  automatically  based  on  the file extension, or if that is not
        recognised, by trying each built-in "reader" in turn:
 
 
-       Reader:       Reads:                              Used for file extensions:
+       Reader:      Reads:                               Used for file extensions:
        -----------------------------------------------------------------------------
-       journal       hledger's  journal  format,  also   .journal    .j    .hledger
-                     some Ledger journals                .ledger
-       timeclock     timeclock   files  (precise  time   .timeclock
-                     logging)
-       timedot       timedot files  (approximate  time   .timedot
-                     logging)
-       csv           comma-separated    values   (data   .csv
-                     interchange)
+       journal      hledger's  journal  format,  also    .journal    .j    .hledger
+                    some Ledger journals                 .ledger
+       timeclock    timeclock  files  (precise   time    .timeclock
+                    logging)
+       timedot      timedot  files  (approximate time    .timedot
+                    logging)
+       csv          comma-separated   values    (data    .csv
+                    interchange)
 
-       If needed (eg to ensure correct error messages  when  a  file  has  the
-       "wrong"  extension), you can force a specific reader/format by prepend-
+       If  needed  (eg  to  ensure  correct error messages when a file has the
+       "wrong" extension), you can force a specific reader/format by  prepend-
        ing it to the file path with a colon.  Examples:
 
               $ hledger -f csv:/some/csv-file.dat stats
@@ -310,7 +320,7 @@ OPTIONS
 
        o directives in one file will not affect the other files
 
-       o balance  assertions  will  not see any account balances from previous
+       o balance assertions will not see any account  balances  from  previous
          files
 
        If you need those, either use the include directive, or concatenate the
@@ -318,8 +328,8 @@ OPTIONS
 
    Smart dates
        hledger's user interfaces accept a flexible "smart date" syntax (unlike
-       dates in the journal file).  Smart dates allow some english words,  can
-       be  relative  to today's date, and can have less-significant date parts
+       dates  in the journal file).  Smart dates allow some english words, can
+       be relative to today's date, and can have less-significant  date  parts
        omitted (defaulting to 1).
 
        Examples:
@@ -327,12 +337,10 @@ OPTIONS
 
        2009/1/1,      2009/01/01,   simple dates, several sep-
        2009-1-1, 2009.1.1           arators allowed
-       2009/1, 2009                 same as above - a  missing
+       2009/1, 2009                 same  as above - a missing
                                     day or month defaults to 1
-
-
-       1/1,     january,     jan,   relative   dates,  meaning
-       this year                    january 1 of  the  current
+       1/1,     january,     jan,   relative  dates,   meaning
+       this year                    january  1  of the current
                                     year
        next year                    january 1 of next year
        this month                   the  1st  of  the  current
@@ -344,16 +352,16 @@ OPTIONS
        today, yesterday, tomorrow
 
    Report start & end date
-       Most hledger reports show the full span  of  time  represented  by  the
+       Most  hledger  reports  show  the  full span of time represented by the
        journal data, by default.  So, the effective report start and end dates
-       will be the earliest and latest transaction or posting dates  found  in
+       will  be  the earliest and latest transaction or posting dates found in
        the journal.
 
-       Often  you  will  want  to see a shorter time span, such as the current
-       month.  You can specify a  start  and/or  end  date  using  -b/--begin,
+       Often you will want to see a shorter time span,  such  as  the  current
+       month.   You  can  specify  a  start  and/or end date using -b/--begin,
        -e/--end, -p/--period or a date: query (described below).  All of these
-       accept the smart date syntax.  One important thing to be aware of  when
-       specifying  end  dates:  as  in Ledger, end dates are exclusive, so you
+       accept  the smart date syntax.  One important thing to be aware of when
+       specifying end dates: as in Ledger, end dates  are  exclusive,  so  you
        need to write the date after the last day you want to include.
 
        Examples:
@@ -363,10 +371,10 @@ OPTIONS
                          2016
        -e 12/1           end at the start of decem-
                          ber  1st  of  the  current
-                         year  (11/30  will  be the
+                         year (11/30  will  be  the
                          last date included)
-       -b thismonth      all  transactions  on   or
-                         after  the 1st of the cur-
+       -b thismonth      all   transactions  on  or
+                         after the 1st of the  cur-
                          rent month
        -p thismonth      all  transactions  in  the
                          current month
@@ -378,24 +386,24 @@ OPTIONS
 
    Report intervals
        A report interval can be specified so that commands like register, bal-
-       ance  and  activity will divide their reports into multiple subperiods.
-       The  basic  intervals  can  be  selected  with   one   of   -D/--daily,
-       -W/--weekly,  -M/--monthly,  -Q/--quarterly, or -Y/--yearly.  More com-
-       plex intervals may be  specified  with  a  period  expression.   Report
+       ance and activity will divide their reports into  multiple  subperiods.
+       The   basic   intervals   can  be  selected  with  one  of  -D/--daily,
+       -W/--weekly, -M/--monthly, -Q/--quarterly, or -Y/--yearly.   More  com-
+       plex  intervals  may  be  specified  with  a period expression.  Report
        intervals can not be specified with a query, currently.
 
    Period expressions
-       The  -p/--period  option accepts period expressions, a shorthand way of
-       expressing a start date, end date, and/or report interval all at  once.
+       The -p/--period option accepts period expressions, a shorthand  way  of
+       expressing  a start date, end date, and/or report interval all at once.
 
-       Here's  a basic period expression specifying the first quarter of 2009.
-       Note, hledger always treats start dates as inclusive and end  dates  as
+       Here's a basic period expression specifying the first quarter of  2009.
+       Note,  hledger  always treats start dates as inclusive and end dates as
        exclusive:
 
        -p "from 2009/1/1 to 2009/4/1"
 
-       Keywords  like  "from" and "to" are optional, and so are the spaces, as
-       long as you don't run two dates together.  "to" can also be written  as
+       Keywords like "from" and "to" are optional, and so are the  spaces,  as
+       long  as you don't run two dates together.  "to" can also be written as
        "-".  These are equivalent to the above:
 
 
@@ -403,7 +411,7 @@ OPTIONS
        -p2009/1/1to2009/4/1
        -p2009/1/1-2009/4/1
 
-       Dates  are  smart  dates, so if the current year is 2009, the above can
+       Dates are smart dates, so if the current year is 2009,  the  above  can
        also be written as:
 
 
@@ -419,25 +427,25 @@ OPTIONS
                             1, 2009
        -p "from 2009/1"     the same
        -p "from 2009"       the same
-       -p "to 2009"         everything before  january
+       -p "to 2009"         everything  before january
                             1, 2009
 
-       A  single  date  with  no "from" or "to" defines both the start and end
+       A single date with no "from" or "to" defines both  the  start  and  end
        date like so:
 
 
-       -p "2009"       the year 2009;  equivalent
+       -p "2009"       the  year 2009; equivalent
                        to "2009/1/1 to 2010/1/1"
-       -p "2009/1"     the  month of jan; equiva-
+       -p "2009/1"     the month of jan;  equiva-
                        lent   to   "2009/1/1   to
                        2009/2/1"
-       -p "2009/1/1"   just  that day; equivalent
+       -p "2009/1/1"   just that day;  equivalent
                        to "2009/1/1 to 2009/1/2"
 
-       The argument of -p can also  begin  with,  or  be,  a  report  interval
-       expression.   The  basic  report  intervals are daily, weekly, monthly,
+       The  argument  of  -p  can  also  begin  with, or be, a report interval
+       expression.  The basic report intervals  are  daily,  weekly,  monthly,
        quarterly, or yearly, which have the same effect as the -D,-W,-M,-Q, or
-       -Y  flags.   Between  report interval and start/end dates (if any), the
+       -Y flags.  Between report interval and start/end dates  (if  any),  the
        word in is optional.  Examples:
 
 
@@ -445,24 +453,24 @@ OPTIONS
        -p "monthly in 2008"
        -p "quarterly"
 
-       Note that weekly, monthly, quarterly and yearly intervals  will  always
+       Note  that  weekly, monthly, quarterly and yearly intervals will always
        start on the first day on week, month, quarter or year accordingly, and
-       will end on the last day of same  period,  even  if  associated  period
+       will  end  on  the  last  day of same period, even if associated period
        expression specifies different explicit start and end date.
 
    For example:
-       -p "weekly from 2009/1/1 to 2009/4/1"  -  starts on 2008/12/29, closest
+       -p "weekly from 2009/1/1 to 2009/4/1" - starts on  2008/12/29,  closest
        preceeding Monday -p "monthly in 2008/11/25" - starts on 2018/11/01
-       -p "quarterly from 2009-05-05 to 2009-06-01" -  starts  on  2009/04/01,
+       -p "quarterly from 2009-05-05 to 2009-06-01"  -  starts  on 2009/04/01,
        ends  on  2009/06/30,  which  are  first  and  last  days  of  Q2  2009
-       -p "yearly from 2009-12-29" - starts on 2009/01/01, first day  of  2009
+       -p "yearly from 2009-12-29"  -  starts on 2009/01/01, first day of 2009
        ----------------------------
 
        The  following  more  complex  report  intervals  are  also  supported:
        biweekly,         bimonthly,         every day|week|month|quarter|year,
        every N days|weeks|months|quarters|years.
 
-       All  of  these  will start on the first day of the requested period and
+       All of these will start on the first day of the  requested  period  and
        end on the last one, as described above.
 
        Examples:
@@ -471,13 +479,13 @@ OPTIONS
        -p "bimonthly from 2008" - periods will
        have    boundaries    on    2008/01/01,
        2008/03/01, ...
-       -p "every 2 weeks" - starts on  closest
+       -p "every 2 weeks"  - starts on closest
        preceeding Monday
        -p "every 5 month from 2009/03" - peri-
        ods will have boundaries on 2009/03/01,
        2009/08/01, ...
 
-       If  you want intervals that start on arbitrary day of your choosing and
+       If you want intervals that start on arbitrary day of your choosing  and
        span a week, month or year, you need to use any of the following:
 
        every Nth day of week,    every <weekday>,    every Nth day [of month],
@@ -487,47 +495,47 @@ OPTIONS
        Examples:
 
 
-       -p "every 2nd day of week"  -   periods
+       -p "every 2nd day of week"   -  periods
        will go from Tue to Tue
        -p "every Tue" - same
        -p "every 15th day" - period boundaries
        will be on 15th of each month
-       -p "every 2nd Monday" -  period  bound-
-       aries  will be on second Monday of each
+       -p "every 2nd Monday"  -  period bound-
+       aries will be on second Monday of  each
        month
-       -p "every 11/05" - yearly periods  with
+       -p "every 11/05"  - yearly periods with
        boundaries on 5th of Nov
        -p "every 5th Nov" - same
        -p "every Nov 5th" - same
 
-       Show  historical balances at end of 15th each month (N is exclusive end
+       Show historical balances at end of 15th each month (N is exclusive  end
        date):
 
        hledger balance -H -p "every 16th day"
 
-       Group postings from start of wednesday to end of  next  tuesday  (N  is
+       Group  postings  from  start  of wednesday to end of next tuesday (N is
        start date and exclusive end date):
 
        hledger register checking -p "every 3rd day of week"
 
    Depth limiting
        With the --depth N option (short form: -N), commands like account, bal-
-       ance and register will show only the uppermost accounts in the  account
-       tree,  down  to  level  N.   Use this when you want a summary with less
-       detail.  This flag has the same effect as a depth: query  argument  (so
+       ance  and register will show only the uppermost accounts in the account
+       tree, down to level N.  Use this when you  want  a  summary  with  less
+       detail.   This  flag has the same effect as a depth: query argument (so
        -2, --depth=2 or depth:2 are basically equivalent).
 
    Pivoting
        Normally hledger sums amounts, and organizes them in a hierarchy, based
-       on account name.  The --pivot FIELD option causes it to sum  and  orga-
-       nize  hierarchy  based on the value of some other field instead.  FIELD
+       on  account  name.  The --pivot FIELD option causes it to sum and orga-
+       nize hierarchy based on the value of some other field  instead.   FIELD
        can be: code, description, payee, note, or the full name (case insensi-
        tive) of any tag.  As with account names, values containing colon:sepa-
        rated:parts will be displayed hierarchically in reports.
 
-       --pivot is a general option affecting all reports;  you  can  think  of
+       --pivot  is  a  general  option affecting all reports; you can think of
        hledger transforming the journal before any other processing, replacing
-       every posting's account name with the value of the specified  field  on
+       every  posting's  account name with the value of the specified field on
        that posting, inheriting it from the transaction or using a blank value
        if it's not present.
 
@@ -553,7 +561,7 @@ OPTIONS
               --------------------
                                  0
 
-       One way to show only amounts with  a  member:  value  (using  a  query,
+       One  way  to  show  only  amounts  with a member: value (using a query,
        described below):
 
               $ hledger balance --pivot member tag:member=.
@@ -561,7 +569,7 @@ OPTIONS
               --------------------
                             -2 EUR
 
-       Another  way  (the  acct:  query  matches  against the pivoted "account
+       Another way (the acct:  query  matches  against  the  pivoted  "account
        name"):
 
               $ hledger balance --pivot member acct:.
@@ -570,16 +578,16 @@ OPTIONS
                             -2 EUR
 
    Cost
-       The -B/--cost flag converts amounts to their cost at transaction  time,
+       The  -B/--cost flag converts amounts to their cost at transaction time,
        if they have a transaction price specified.
 
    Market value
        The -V/--value flag converts the reported amounts to their market value
        on the report end date, using the most recent applicable market prices,
-       when  known.   Specifically, when there is a market price (P directive)
+       when known.  Specifically, when there is a market price  (P  directive)
        for the amount's commodity, dated on or before the report end date (see
-       hledger  ->  Report  start & end date), the amount will be converted to
-       the price's commodity.  If multiple applicable prices are defined,  the
+       hledger -> Report start & end date), the amount will  be  converted  to
+       the  price's commodity.  If multiple applicable prices are defined, the
        latest-dated one is used (and if dates are equal, the one last parsed).
 
        For example:
@@ -611,7 +619,7 @@ OPTIONS
               $ hledger -f t.j bal euros -V -e 2016/12/21
                            $103.00  assets:euros
 
-       Currently,  hledger's -V only uses market prices recorded with P direc-
+       Currently, hledger's -V only uses market prices recorded with P  direc-
        tives, not transaction prices (unlike Ledger).
 
        Using -B and -V together is allowed.
@@ -619,56 +627,56 @@ OPTIONS
    Regular expressions
        hledger uses regular expressions in a number of places:
 
-       o query terms, on the command line and in the hledger-web search  form:
+       o query  terms, on the command line and in the hledger-web search form:
          REGEX, desc:REGEX, cur:REGEX, tag:...=REGEX
 
        o CSV rules conditional blocks: if REGEX ...
 
-       o account  alias  directives  and options: alias /REGEX/ = REPLACEMENT,
+       o account alias directives  and  options:  alias /REGEX/ = REPLACEMENT,
          --alias /REGEX/=REPLACEMENT
 
-       hledger's regular expressions come from  the  regex-tdfa  library.   In
+       hledger's  regular  expressions  come  from the regex-tdfa library.  In
        general they:
 
        o are case insensitive
 
-       o are  infix  matching  (do  not  need  to match the entire thing being
+       o are infix matching (do not need  to  match  the  entire  thing  being
          matched)
 
        o are POSIX extended regular expressions
 
        o also support GNU word boundaries (\<, \>, \b, \B)
 
-       o and parenthesised capturing  groups  and  numeric  backreferences  in
+       o and  parenthesised  capturing  groups  and  numeric backreferences in
          replacement strings
 
        o do not support mode modifiers like (?s)
 
        Some things to note:
 
-       o In  the  alias directive and --alias option, regular expressions must
-         be enclosed in forward  slashes  (/REGEX/).   Elsewhere  in  hledger,
+       o In the alias directive and --alias option, regular  expressions  must
+         be  enclosed  in  forward  slashes  (/REGEX/).  Elsewhere in hledger,
          these are not required.
 
-       o In  queries,  to match a regular expression metacharacter like $ as a
-         literal character, prepend a backslash.  Eg  to  search  for  amounts
+       o In queries, to match a regular expression metacharacter like $  as  a
+         literal  character,  prepend  a  backslash.  Eg to search for amounts
          with the dollar sign in hledger-web, write cur:\$.
 
-       o On  the command line, some metacharacters like $ have a special mean-
+       o On the command line, some metacharacters like $ have a special  mean-
          ing to the shell and so must be escaped at least once more.  See Spe-
          cial characters.
 
 QUERIES
-       One  of  hledger's strengths is being able to quickly report on precise
-       subsets of your data.  Most commands accept an optional  query  expres-
-       sion,  written  as arguments after the command name, to filter the data
-       by date, account name or other criteria.  The syntax is  similar  to  a
+       One of hledger's strengths is being able to quickly report  on  precise
+       subsets  of  your data.  Most commands accept an optional query expres-
+       sion, written as arguments after the command name, to filter  the  data
+       by  date,  account  name or other criteria.  The syntax is similar to a
        web search: one or more space-separated search terms, quotes to enclose
-       whitespace, prefixes to match specific fields, a not: prefix to  negate
+       whitespace,  prefixes to match specific fields, a not: prefix to negate
        the match.
 
-       We  do  not yet support arbitrary boolean combinations of search terms;
-       instead most commands show transactions/postings/accounts  which  match
+       We do not yet support arbitrary boolean combinations of  search  terms;
+       instead  most  commands show transactions/postings/accounts which match
        (or negatively match):
 
        o any of the description terms AND
@@ -689,32 +697,32 @@ QUERIES
 
        o match all the other terms.
 
-       The  following  kinds  of search terms can be used.  Remember these can
+       The following kinds of search terms can be used.   Remember  these  can
        also be prefixed with not:, eg to exclude a particular subaccount.
 
-       REGEX  match account names by this regular expression.  (No  prefix  is
+       REGEX  match  account  names by this regular expression.  (No prefix is
               equivalent to acct:).
 
        acct:REGEX
               same as above
 
        amt:N, amt:<N, amt:<=N, amt:>N, amt:>=N
-              match  postings with a single-commodity amount that is equal to,
-              less than, or greater than N.  (Multi-commodity amounts are  not
+              match postings with a single-commodity amount that is equal  to,
+              less  than, or greater than N.  (Multi-commodity amounts are not
               tested, and will always match.) The comparison has two modes: if
               N is preceded by a + or - sign (or is 0), the two signed numbers
-              are  compared.  Otherwise, the absolute magnitudes are compared,
+              are compared.  Otherwise, the absolute magnitudes are  compared,
               ignoring sign.
 
        code:REGEX
               match by transaction code (eg check number)
 
        cur:REGEX
-              match postings or transactions including any amounts whose  cur-
-              rency/commodity  symbol  is fully matched by REGEX.  (For a par-
+              match  postings or transactions including any amounts whose cur-
+              rency/commodity symbol is fully matched by REGEX.  (For  a  par-
               tial match, use .*REGEX.*).  Note, to match characters which are
               regex-significant, like the dollar sign ($), you need to prepend
-              \.  And when using the command line you need  to  add  one  more
+              \.   And  when  using  the command line you need to add one more
               level  of  quoting  to  hide  it  from  the  shell,  so  eg  do:
               hledger print cur:'\$' or hledger print cur:\\$.
 
@@ -723,20 +731,20 @@ QUERIES
 
        date:PERIODEXPR
               match dates within the specified period.  PERIODEXPR is a period
-              expression  (with  no  report  interval).   Examples: date:2016,
-              date:thismonth,  date:2000/2/1-2/15,  date:lastweek-.   If   the
-              --date2  command  line  flag  is present, this matches secondary
+              expression (with  no  report  interval).   Examples:  date:2016,
+              date:thismonth,   date:2000/2/1-2/15,  date:lastweek-.   If  the
+              --date2 command line flag is  present,  this  matches  secondary
               dates instead.
 
        date2:PERIODEXPR
               match secondary dates within the specified period.
 
        depth:N
-              match (or display, depending on command) accounts  at  or  above
+              match  (or  display,  depending on command) accounts at or above
               this depth
 
        note:REGEX
-              match  transaction  notes  (part  of  description right of |, or
+              match transaction notes (part of  description  right  of  |,  or
               whole description when there's no |)
 
        payee:REGEX
@@ -750,38 +758,38 @@ QUERIES
               match unmarked, pending, or cleared transactions respectively
 
        tag:REGEX[=REGEX]
-              match  by  tag  name,  and optionally also by tag value.  Note a
-              tag: query is considered to match a transaction  if  it  matches
-              any  of  the  postings.  Also remember that postings inherit the
+              match by tag name, and optionally also by  tag  value.   Note  a
+              tag:  query  is  considered to match a transaction if it matches
+              any of the postings.  Also remember that  postings  inherit  the
               tags of their parent transaction.
 
        The following special search term is used automatically in hledger-web,
        only:
 
        inacct:ACCTNAME
-              tells  hledger-web  to  show  the  transaction register for this
+              tells hledger-web to show  the  transaction  register  for  this
               account.  Can be filtered further with acct etc.
 
        Some of these can also be expressed as command-line options (eg depth:2
-       is  equivalent  to --depth 2).  Generally you can mix options and query
-       arguments, and the resulting query will be their intersection  (perhaps
+       is equivalent to --depth 2).  Generally you can mix options  and  query
+       arguments,  and the resulting query will be their intersection (perhaps
        excluding the -p/--period option).
 
 COMMANDS
-       hledger  provides  a  number  of subcommands; hledger with no arguments
+       hledger provides a number of subcommands;  hledger  with  no  arguments
        shows a list.
 
        If you install additional hledger-* packages, or if you put programs or
-       scripts  named  hledger-NAME in your PATH, these will also be listed as
+       scripts named hledger-NAME in your PATH, these will also be  listed  as
        subcommands.
 
-       Run  a  subcommand  by  writing  its  name  as   first   argument   (eg
+       Run   a   subcommand   by  writing  its  name  as  first  argument  (eg
        hledger incomestatement).  You can also write one of the standard short
-       aliases displayed in parentheses in the command  list  (hledger b),  or
+       aliases  displayed  in  parentheses in the command list (hledger b), or
        any any unambiguous prefix of a command name (hledger inc).
 
-       Here  are  all  the  builtin  commands in alphabetical order.  See also
-       hledger for a more  organised  command  list,  and  hledger CMD -h  for
+       Here are all the builtin commands  in  alphabetical  order.   See  also
+       hledger  for  a  more  organised  command  list, and hledger CMD -h for
        detailed command help.
 
    accounts
@@ -794,14 +802,14 @@ COMMANDS
        --drop=N
               in flat mode: omit N leading account name parts
 
-       This  command  lists  all  account  names  that are in use (ie, all the
-       accounts which have at least one transaction posting  to  them).   With
+       This command lists all account names that  are  in  use  (ie,  all  the
+       accounts  which  have  at least one transaction posting to them).  With
        query arguments, only matched account names are shown.
 
-       It  shows  a flat list by default.  With --tree, it uses indentation to
+       It shows a flat list by default.  With --tree, it uses  indentation  to
        show the account hierarchy.
 
-       In flat mode you can add --drop N to omit the first  few  account  name
+       In  flat  mode  you can add --drop N to omit the first few account name
        components.
 
        Examples:
@@ -844,8 +852,8 @@ COMMANDS
    activity
        Show an ascii barchart of posting counts per interval.
 
-       The  activity  command  displays an ascii histogram showing transaction
-       counts by day, week, month or other reporting interval (by day  is  the
+       The activity command displays an ascii  histogram  showing  transaction
+       counts  by  day, week, month or other reporting interval (by day is the
        default).  With query arguments, it counts only matched transactions.
 
               $ hledger activity --quarterly
@@ -858,24 +866,24 @@ COMMANDS
        Prompt for transactions and add them to the journal.
 
        --no-new-accounts
-              don't  allow  creating  new  accounts;  helps prevent typos when
+              don't allow creating new  accounts;  helps  prevent  typos  when
               entering account names
 
-       Many hledger users edit their journals directly with a text editor,  or
-       generate  them from CSV.  For more interactive data entry, there is the
-       add command, which prompts interactively on the console for new  trans-
-       actions,  and  appends  them to the journal file (if there are multiple
+       Many  hledger users edit their journals directly with a text editor, or
+       generate them from CSV.  For more interactive data entry, there is  the
+       add  command, which prompts interactively on the console for new trans-
+       actions, and appends them to the journal file (if  there  are  multiple
        -f FILE options, the first file is used.) Existing transactions are not
-       changed.   This  is the only hledger command that writes to the journal
+       changed.  This is the only hledger command that writes to  the  journal
        file.
 
        To use it, just run hledger add and follow the prompts.  You can add as
-       many  transactions as you like; when you are finished, enter . or press
+       many transactions as you like; when you are finished, enter . or  press
        control-d or control-c to exit.
 
        Features:
 
-       o add tries to provide useful defaults, using the most  similar  recent
+       o add  tries  to provide useful defaults, using the most similar recent
          transaction (by description) as a template.
 
        o You can also set the initial defaults with command line arguments.
@@ -883,20 +891,20 @@ COMMANDS
        o Readline-style edit keys can be used during data entry.
 
        o The tab key will auto-complete whenever possible - accounts, descrip-
-         tions, dates (yesterday, today, tomorrow).   If  the  input  area  is
+         tions,  dates  (yesterday,  today,  tomorrow).   If the input area is
          empty, it will insert the default value.
 
-       o If  the  journal defines a default commodity, it will be added to any
+       o If the journal defines a default commodity, it will be added  to  any
          bare numbers entered.
 
        o A parenthesised transaction code may be entered following a date.
 
        o Comments and tags may be entered following a description or amount.
 
-       o If you make a mistake, enter < at any prompt to restart the  transac-
+       o If  you make a mistake, enter < at any prompt to restart the transac-
          tion.
 
-       o Input  prompts  are displayed in a different colour when the terminal
+       o Input prompts are displayed in a different colour when  the  terminal
          supports it.
 
        Example (see the tutorial for a detailed explanation):
@@ -933,7 +941,7 @@ COMMANDS
               show balance change in each period (default)
 
        --cumulative
-              show balance change accumulated across periods  (in  multicolumn
+              show  balance  change accumulated across periods (in multicolumn
               reports)
 
        -H --historical
@@ -968,16 +976,25 @@ COMMANDS
               select the output format.  Supported formats: txt, csv.
 
        -o FILE --output-file=FILE
-              write output to FILE.  A file  extension  matching  one  of  the
+              write  output  to  FILE.   A  file extension matching one of the
               above formats selects that format.
 
        --pretty-tables
               Use unicode to display prettier tables.
 
        --sort-amount
-              Sort  by amount (total row amount, or by average if that is dis-
+              Sort by amount (total row amount, or by average if that is  dis-
               played), instead of account name (in flat mode)
 
+       --budget
+              Treat  periodic  transaction as definition of a budget.  Compare
+              real balances to budget balances and show percentage  of  budget
+              consumed.
+
+       --show-unbudgeted
+              When  -budget  is used, display accounts that do not have budget
+              defined
+
        The balance command displays accounts and balances.   It  is  hledger's
        most featureful and versatile command.
 
@@ -1139,8 +1156,92 @@ COMMANDS
 
               # Average is rounded to the dollar here since all journal amounts are
 
+   Budgets
+       The   --budget   flag  will  treat  all  [periodic  transaction]((jour-
+       nal.html#periodic-transactions) in your journal as  definition  of  the
+       budget  and allow you to compare real balances versus budgeted amounts.
+
+       For example, you can  take  average  monthly  expenses  in  the  common
+       expense categories to construct a minimal monthly budget:
+
+              ;; Budget
+              ~ monthly
+                income  $2000
+                expenses:food    $400
+                expenses:bus     $50
+                expenses:movies  $30
+                assets:bank:checking
+
+              ;; Two months worth of expenses
+              2017-11-01
+                income  $1950
+                expenses:food    $396
+                expenses:bus     $49
+                expenses:movies  $30
+                expenses:supplies  $20
+                assets:bank:checking
+
+              2017-12-01
+                income  $2100
+                expenses:food    $412
+                expenses:bus     $53
+                expenses:gifts   $100
+                assets:bank:checking
+
+       You can now compare real balances with budget:
+
+              $ hledge balance -M --budget
+              Balance changes in 2017/11/01-2017/12/31:
+
+                                     ||                2017/11                  2017/12
+              =======================++=================================================
+               <unbudgeted>:expenses ||                    $20                     $100
+               assets:bank:checking  || $-2445 [99% of $-2480]  $-2665 [107% of $-2480]
+               expenses:bus          ||       $49 [98% of $50]        $53 [106% of $50]
+               expenses:food         ||     $396 [99% of $400]      $412 [103% of $400]
+               expenses:movies       ||      $30 [100% of $30]            0 [0% of $30]
+               income                ||   $1950 [98% of $2000]    $2100 [105% of $2000]
+              -----------------------++-------------------------------------------------
+                                     ||                      0                        0
+
+       You can roll over unspent budgets to next period with --cumulative:
+
+              $ hledger balance -M --budget --cumulative
+              Ending balances (cumulative) in 2017/11/01-2017/12/31:
+
+                                     ||             2017/11/30               2017/12/31
+              =======================++=================================================
+               <unbudgeted>:expenses ||                    $20                     $120
+               assets:bank:checking  || $-2445 [99% of $-2480]  $-5110 [103% of $-4960]
+               expenses:bus          ||       $49 [98% of $50]      $102 [102% of $100]
+               expenses:food         ||     $396 [99% of $400]      $808 [101% of $800]
+               expenses:movies       ||      $30 [100% of $30]         $30 [50% of $60]
+               income                ||   $1950 [98% of $2000]    $4050 [101% of $4000]
+              -----------------------++-------------------------------------------------
+                                     ||                      0                        0
+
+       Adding  --show-unbudgeted  will  allow  you to see all the accounts for
+       which budgets:
+
+              $ hledger balance --budget --show-unbudgeted
+              Balance changes in 2017/11/01-2017/12/31:
+
+                                    ||                2017/11                  2017/12
+              ======================++=================================================
+               assets:bank:checking || $-2445 [99% of $-2480]  $-2665 [107% of $-2480]
+               expenses:bus         ||       $49 [98% of $50]        $53 [106% of $50]
+               expenses:food        ||     $396 [99% of $400]      $412 [103% of $400]
+               expenses:gifts       ||                      0                     $100
+               expenses:movies      ||      $30 [100% of $30]            0 [0% of $30]
+               expenses:supplies    ||                    $20                        0
+               income               ||   $1950 [98% of $2000]    $2100 [105% of $2000]
+              ----------------------++-------------------------------------------------
+                                    ||                      0                        0
+
+       For more examples and details, see Budgeting and Forecasting.
+
    Custom balance output
-       In  simple  (non-multi-column)  balance  reports, you can customise the
+       In simple (non-multi-column) balance reports,  you  can  customise  the
        output with --format FMT:
 
               $ hledger balance --format "%20(account) %12(total)"
@@ -1158,7 +1259,7 @@ COMMANDS
                                               0
 
        The FMT format string (plus a newline) specifies the formatting applied
-       to  each  account/balance pair.  It may contain any suitable text, with
+       to each account/balance pair.  It may contain any suitable  text,  with
        data fields interpolated like so:
 
        %[MIN][.MAX](FIELDNAME)
@@ -1169,14 +1270,14 @@ COMMANDS
 
        o FIELDNAME must be enclosed in parentheses, and can be one of:
 
-         o depth_spacer - a number of spaces equal to the account's depth,  or
+         o depth_spacer  - a number of spaces equal to the account's depth, or
            if MIN is specified, MIN * depth spaces.
 
          o account - the account's name
 
          o total - the account's balance/posted total, right justified
 
-       Also,  FMT  can begin with an optional prefix to control how multi-com-
+       Also, FMT can begin with an optional prefix to control  how  multi-com-
        modity amounts are rendered:
 
        o %_ - render on multiple lines, bottom-aligned (the default)
@@ -1185,7 +1286,7 @@ COMMANDS
 
        o %, - render on one line, comma-separated
 
-       There are some quirks.  Eg in one-line  mode,  %(depth_spacer)  has  no
+       There  are  some  quirks.   Eg in one-line mode, %(depth_spacer) has no
        effect, instead %(account) has indentation built in.
         Experimentation may be needed to get pleasing results.
 
@@ -1193,14 +1294,14 @@ COMMANDS
 
        o %(total) - the account's total
 
-       o %-20.20(account)  -  the account's name, left justified, padded to 20
+       o %-20.20(account) - the account's name, left justified, padded  to  20
          characters and clipped at 20 characters
 
-       o %,%-50(account)  %25(total) - account name padded to  50  characters,
-         total  padded to 20 characters, with multiple commodities rendered on
+       o %,%-50(account)  %25(total)  -  account name padded to 50 characters,
+         total padded to 20 characters, with multiple commodities rendered  on
          one line
 
-       o %20(total)  %2(depth_spacer)%-(account) - the default format for  the
+       o %20(total)  %2(depth_spacer)%-(account)  - the default format for the
          single-column balance report
 
    Colour support
@@ -1211,8 +1312,8 @@ COMMANDS
        o the output is not being redirected or piped anywhere
 
    Output destination
-       The  balance, print, register and stats commands can write their output
-       to a destination other than the console.  This  is  controlled  by  the
+       The balance, print, register and stats commands can write their  output
+       to  a  destination  other  than the console.  This is controlled by the
        -o/--output-file option.
 
               $ hledger balance -o -     # write to stdout (the default)
@@ -1220,8 +1321,8 @@ COMMANDS
 
    CSV output
        The balance, print and register commands can write their output as CSV.
-       This is useful for exporting data to other  applications,  eg  to  make
-       charts  in a spreadsheet.  This is controlled by the -O/--output-format
+       This  is  useful  for  exporting data to other applications, eg to make
+       charts in a spreadsheet.  This is controlled by the  -O/--output-format
        option, or by specifying a .csv file extension with -o/--output-file.
 
               $ hledger balance -O csv       # write CSV to stdout
@@ -1235,7 +1336,7 @@ COMMANDS
               balances
 
        --cumulative
-              show  balance  change accumulated across periods (in multicolumn
+              show balance change accumulated across periods  (in  multicolumn
               reports), instead of historical ending balances
 
        -H --historical
@@ -1269,8 +1370,8 @@ COMMANDS
        --sort-amount
               sort by amount instead of account name
 
-       This  command  displays  a  simple balance sheet.  It currently assumes
-       that you have top-level accounts  named  asset  and  liability  (plural
+       This command displays a simple balance  sheet.   It  currently  assumes
+       that  you  have  top-level  accounts  named asset and liability (plural
        forms also allowed.)
 
               $ hledger balancesheet
@@ -1293,19 +1394,19 @@ COMMANDS
                                  0
 
        With a reporting interval, multiple columns will be shown, one for each
-       report period.  As with multicolumn balance reports, you can alter  the
-       report  mode  with  --change/--cumulative/--historical.   Normally bal-
-       ancesheet shows historical ending balances, which is what you need  for
+       report  period.  As with multicolumn balance reports, you can alter the
+       report mode  with  --change/--cumulative/--historical.   Normally  bal-
+       ancesheet  shows historical ending balances, which is what you need for
        a balance sheet; note this means it ignores report begin dates.
 
    balancesheetequity
        Show a balance sheet including equity.  Alias: bse.
 
-       Other  than  showing  the  equity accounts, this command is exactly the
+       Other than showing the equity accounts, this  command  is  exactly  the
        same as the command balancesheet.  Please refer to it for the available
        options.
 
-       This  command  displays  a balancesheet.  It currently assumes that you
+       This command displays a balancesheet.  It currently  assumes  that  you
        have top-level accounts named asset, liability and equity (plural forms
        also allowed.)
 
@@ -1340,7 +1441,7 @@ COMMANDS
               show balance change in each period (default)
 
        --cumulative
-              show  balance  change accumulated across periods (in multicolumn
+              show balance change accumulated across periods  (in  multicolumn
               reports), instead of changes during periods
 
        -H --historical
@@ -1374,9 +1475,9 @@ COMMANDS
        --sort-amount
               sort by amount instead of account name
 
-       This command displays a simple cashflow statement It shows  the  change
-       in  all  "cash"  (ie,  liquid assets) accounts for the period.  It cur-
-       rently assumes that cash accounts are under a top-level  account  named
+       This  command  displays a simple cashflow statement It shows the change
+       in all "cash" (ie, liquid assets) accounts for  the  period.   It  cur-
+       rently  assumes  that cash accounts are under a top-level account named
        asset and do not contain receivable, :A/R or :fixed.
 
               $ hledger cashflow
@@ -1394,33 +1495,33 @@ COMMANDS
                                $-1
 
        With a reporting interval, multiple columns will be shown, one for each
-       report period.  Normally cashflow shows changes in assets  per  period,
-       though  as  with  multicolumn  balance reports you can alter the report
+       report  period.   Normally cashflow shows changes in assets per period,
+       though as with multicolumn balance reports you  can  alter  the  report
        mode with --change/--cumulative/--historical.
 
    check-dates
-       Check that transactions are sorted by increasing date.  With  a  query,
+       Check  that  transactions are sorted by increasing date.  With a query,
        only matched transactions' dates are checked.
 
    check-dupes
-       Report  account  names having the same leaf but different prefixes.  An
+       Report account names having the same leaf but different  prefixes.   An
        example: http://stefanorodighiero.net/software/hledger-dupes.html
 
    equity
-       Print closing/opening transactions that bring some or all account  bal-
-       ances  to  zero  and back.  Can be useful for bringing account balances
+       Print  closing/opening transactions that bring some or all account bal-
+       ances to zero and back.  Can be useful for  bringing  account  balances
        across file boundaries.
 
    help
        Show any of the hledger manuals.
 
-       The help command displays any of the main hledger manuals,  in  one  of
-       several  ways.  Run it with no argument to list the manuals, or provide
+       The  help  command  displays any of the main hledger manuals, in one of
+       several ways.  Run it with no argument to list the manuals, or  provide
        a full or partial manual name to select one.
 
-       hledger manuals are available in several formats.   hledger  help  will
-       use  the  first  of  these  display  methods  that it finds: info, man,
-       $PAGER, less, stdout (or when non-interactive, just stdout).   You  can
+       hledger  manuals  are  available in several formats.  hledger help will
+       use the first of these  display  methods  that  it  finds:  info,  man,
+       $PAGER,  less,  stdout (or when non-interactive, just stdout).  You can
        force a particular viewer with the --info, --man, --pager, --cat flags.
 
               $ hledger help
@@ -1444,7 +1545,7 @@ COMMANDS
               ...
 
    import
-       Read new transactions added to each FILE since last run, and  add  them
+       Read  new  transactions added to each FILE since last run, and add them
        to the main journal file.
 
        --dry-run
@@ -1454,11 +1555,11 @@ COMMANDS
        each one.  So eg to add new transactions from all CSV files to the main
        journal, it's just: hledger import *.csv
 
-       New  transactions are detected in the same way as print -new: by assum-
+       New transactions are detected in the same way as print -new: by  assum-
        ing transactions are always added to the input files in increasing date
        order, and by saving .latest.FILE state files.
 
-       The  -dry-run  output is in journal format, so you can filter it, eg to
+       The -dry-run output is in journal format, so you can filter it,  eg  to
        see only uncategorised transactions:
 
               $ hledger import --dry ... | hledger -f- print unknown --ignore-assertions
@@ -1470,7 +1571,7 @@ COMMANDS
               show balance change in each period (default)
 
        --cumulative
-              show balance change accumulated across periods  (in  multicolumn
+              show  balance  change accumulated across periods (in multicolumn
               reports), instead of changes during periods
 
        -H --historical
@@ -1504,8 +1605,8 @@ COMMANDS
        --sort-amount
               sort by amount instead of account name
 
-       This  command displays a simple income statement.  It currently assumes
-       that you have top-level accounts named income (or revenue) and  expense
+       This command displays a simple income statement.  It currently  assumes
+       that  you have top-level accounts named income (or revenue) and expense
        (plural forms also allowed.)
 
               $ hledger incomestatement
@@ -1530,8 +1631,8 @@ COMMANDS
                                  0
 
        With a reporting interval, multiple columns will be shown, one for each
-       report period.  Normally incomestatement  shows  revenues/expenses  per
-       period,  though  as  with multicolumn balance reports you can alter the
+       report  period.   Normally  incomestatement shows revenues/expenses per
+       period, though as with multicolumn balance reports you  can  alter  the
        report mode with --change/--cumulative/--historical.
 
    prices
@@ -1541,7 +1642,7 @@ COMMANDS
        Show transactions from the journal.  Aliases: p, txns.
 
        -m STR --match=STR
-              show the transaction whose description is most similar  to  STR,
+              show  the  transaction whose description is most similar to STR,
               and is most recent
 
        --new  show only newer-dated transactions added in each file since last
@@ -1554,7 +1655,7 @@ COMMANDS
               select the output format.  Supported formats: txt, csv.
 
        -o FILE --output-file=FILE
-              write output to FILE.  A file  extension  matching  one  of  the
+              write  output  to  FILE.   A  file extension matching one of the
               above formats selects that format.
 
               $ hledger print
@@ -1585,39 +1686,39 @@ COMMANDS
        it does not preserve directives or inter-transaction comments
 
        Normally, the journal entry's explicit or implicit amount style is pre-
-       served.   Ie when an amount is omitted in the journal, it will be omit-
-       ted in the output.  You can use the  -x/--explicit  flag  to  make  all
+       served.  Ie when an amount is omitted in the journal, it will be  omit-
+       ted  in  the  output.   You  can use the -x/--explicit flag to make all
        amounts explicit, which can be useful for troubleshooting or for making
        your journal more readable and robust against data entry errors.  Note,
-       -x  will  cause postings with a multi-commodity amount (these can arise
-       when a multi-commodity transaction has  an  implicit  amount)  will  be
-       split  into  multiple single-commodity postings, for valid journal out-
+       -x will cause postings with a multi-commodity amount (these  can  arise
+       when  a  multi-commodity  transaction  has  an implicit amount) will be
+       split into multiple single-commodity postings, for valid  journal  out-
        put.
 
-       With -B/--cost, amounts with transaction prices are converted  to  cost
+       With  -B/--cost,  amounts with transaction prices are converted to cost
        using that price.
 
-       With  -m/--match and a STR argument, print will show at most one trans-
-       action: the one one whose description is most similar to  STR,  and  is
-       most  recent.  STR should contain at least two characters.  If there is
+       With -m/--match and a STR argument, print will show at most one  trans-
+       action:  the  one  one whose description is most similar to STR, and is
+       most recent.  STR should contain at least two characters.  If there  is
        no similar-enough match, no transaction will be shown.
 
        With --new, for each FILE being read, hledger reads (and writes) a spe-
-       cial  state  file  (.latest.FILE in the same directory), containing the
-       latest transaction date(s) that were seen  last  time  FILE  was  read.
-       When  this  file  is found, only transactions with newer dates (and new
-       transactions on the latest date)  are  printed.   This  is  useful  for
-       ignoring  already-seen  entries  in import data, such as downloaded CSV
+       cial state file (.latest.FILE in the same  directory),  containing  the
+       latest  transaction  date(s)  that  were  seen last time FILE was read.
+       When this file is found, only transactions with newer  dates  (and  new
+       transactions  on  the  latest  date)  are  printed.  This is useful for
+       ignoring already-seen entries in import data, such  as  downloaded  CSV
        files.  Eg:
 
               $ hledger -f bank1.csv print --new
               # shows transactions added since last print --new on this file
 
-       This assumes that transactions  added  to  FILE  always  have  same  or
-       increasing  dates,  and  that  transactions  on the same day do not get
+       This  assumes  that  transactions  added  to  FILE  always have same or
+       increasing dates, and that transactions on the  same  day  do  not  get
        reordered.  See also the import command.
 
-       The print command also supports  output  destination  and  CSV  output.
+       The  print  command  also  supports  output destination and CSV output.
        Here's an example of print's CSV output:
 
               $ hledger print -Ocsv
@@ -1634,20 +1735,20 @@ COMMANDS
               "5","2008/12/31","","*","","pay off","","liabilities:debts","1","$","","1","",""
               "5","2008/12/31","","*","","pay off","","assets:bank:checking","-1","$","1","","",""
 
-       o There  is  one  CSV record per posting, with the parent transaction's
+       o There is one CSV record per posting, with  the  parent  transaction's
          fields repeated.
 
        o The "txnidx" (transaction index) field shows which postings belong to
-         the  same transaction.  (This number might change if transactions are
-         reordered within the file, files are parsed/included in  a  different
+         the same transaction.  (This number might change if transactions  are
+         reordered  within  the file, files are parsed/included in a different
          order, etc.)
 
-       o The  amount  is  separated into "commodity" (the symbol) and "amount"
+       o The amount is separated into "commodity" (the  symbol)  and  "amount"
          (numeric quantity) fields.
 
        o The numeric amount is repeated in either the "credit" or "debit" col-
-         umn,  for convenience.  (Those names are not accurate in the account-
-         ing sense; it just puts negative amounts under  credit  and  zero  or
+         umn, for convenience.  (Those names are not accurate in the  account-
+         ing  sense;  it  just  puts negative amounts under credit and zero or
          greater amounts under debit.)
 
    print-unique
@@ -1660,7 +1761,7 @@ COMMANDS
               show running total from report start date (default)
 
        -H --historical
-              show  historical running total/balance (includes postings before
+              show historical running total/balance (includes postings  before
               report start date)
 
        -A --average
@@ -1671,18 +1772,18 @@ COMMANDS
               show postings' siblings instead
 
        -w N --width=N
-              set  output  width  (default:  terminal width or COLUMNS.  -wN,M
+              set output width (default: terminal  width  or  COLUMNS.   -wN,M
               sets description width as well)
 
        -O FMT --output-format=FMT
               select the output format.  Supported formats: txt, csv.
 
        -o FILE --output-file=FILE
-              write output to FILE.  A file  extension  matching  one  of  the
+              write  output  to  FILE.   A  file extension matching one of the
               above formats selects that format.
 
        The register command displays postings, one per line, and their running
-       total.  This is typically used with  a  query  selecting  a  particular
+       total.   This  is  typically  used  with a query selecting a particular
        account, to see that account's activity:
 
               $ hledger register checking
@@ -1691,8 +1792,8 @@ COMMANDS
               2008/06/02 save                 assets:bank:checking           $-1            $1
               2008/12/31 pay off              assets:bank:checking           $-1             0
 
-       The  --historical/-H  flag  adds the balance from any undisplayed prior
-       postings to the running total.  This is useful when  you  want  to  see
+       The --historical/-H flag adds the balance from  any  undisplayed  prior
+       postings  to  the  running  total.  This is useful when you want to see
        only recent activity, with a historically accurate running balance:
 
               $ hledger register checking -b 2008/6 --historical
@@ -1702,23 +1803,23 @@ COMMANDS
 
        The --depth option limits the amount of sub-account detail displayed.
 
-       The  --average/-A flag shows the running average posting amount instead
+       The --average/-A flag shows the running average posting amount  instead
        of the running total (so, the final number displayed is the average for
-       the  whole  report period).  This flag implies --empty (see below).  It
-       is affected by --historical.  It  works  best  when  showing  just  one
+       the whole report period).  This flag implies --empty (see  below).   It
+       is  affected  by  --historical.   It  works  best when showing just one
        account and one commodity.
 
-       The  --related/-r  flag shows the other postings in the transactions of
+       The --related/-r flag shows the other postings in the  transactions  of
        the postings which would normally be shown.
 
-       With a reporting interval, register shows  summary  postings,  one  per
+       With  a  reporting  interval,  register shows summary postings, one per
        interval, aggregating the postings to each account:
 
               $ hledger register --monthly income
               2008/01                 income:salary                          $-1           $-1
               2008/06                 income:gifts                           $-1           $-2
 
-       Periods  with no activity, and summary postings with a zero amount, are
+       Periods with no activity, and summary postings with a zero amount,  are
        not shown by default; use the --empty/-E flag to see them:
 
               $ hledger register --monthly income -E
@@ -1735,7 +1836,7 @@ COMMANDS
               2008/11                                                          0           $-2
               2008/12                                                          0           $-2
 
-       Often, you'll want to see just one  line  per  interval.   The  --depth
+       Often,  you'll  want  to  see  just one line per interval.  The --depth
        option helps with this, causing subaccounts to be aggregated:
 
               $ hledger register --monthly assets --depth 1h
@@ -1743,18 +1844,18 @@ COMMANDS
               2008/06                 assets                                 $-1             0
               2008/12                 assets                                 $-1           $-1
 
-       Note  when using report intervals, if you specify start/end dates these
-       will be adjusted outward if necessary to  contain  a  whole  number  of
-       intervals.   This  ensures  that  the first and last intervals are full
+       Note when using report intervals, if you specify start/end dates  these
+       will  be  adjusted  outward  if  necessary to contain a whole number of
+       intervals.  This ensures that the first and  last  intervals  are  full
        length and comparable to the others in the report.
 
    Custom register output
-       register uses the full terminal width by default,  except  on  windows.
-       You  can override this by setting the COLUMNS environment variable (not
+       register  uses  the  full terminal width by default, except on windows.
+       You can override this by setting the COLUMNS environment variable  (not
        a bash shell variable) or by using the --width/-w option.
 
-       The description and account columns normally share  the  space  equally
-       (about  half  of  (width  - 40) each).  You can adjust this by adding a
+       The  description  and  account columns normally share the space equally
+       (about half of (width - 40) each).  You can adjust  this  by  adding  a
        description  width  as  part  of  -width's  argument,  comma-separated:
        --width W,D .  Here's a diagram:
 
@@ -1771,12 +1872,12 @@ COMMANDS
               $ hledger reg -w 100,40           # set overall width 100, description width 40
               $ hledger reg -w $COLUMNS,40      # use terminal width, and set description width
 
-       The  register  command also supports the -o/--output-file and -O/--out-
+       The register command also supports the -o/--output-file  and  -O/--out-
        put-format options for controlling output destination and CSV output.
 
    register-match
        Print the one posting whose transaction description is closest to DESC,
-       in  the  style  of  the register command.  Helps ledger-autosync detect
+       in the style of the register  command.   Helps  ledger-autosync  detect
        already-seen transactions when importing.
 
    rewrite
@@ -1786,7 +1887,7 @@ COMMANDS
        Show some journal statistics.
 
        -o FILE --output-file=FILE
-              write output to FILE.  A file  extension  matching  one  of  the
+              write  output  to  FILE.   A  file extension matching one of the
               above formats selects that format.
 
               $ hledger stats
@@ -1801,16 +1902,16 @@ COMMANDS
               Accounts                 : 8 (depth 3)
               Commodities              : 1 ($)
 
-       The  stats  command displays summary information for the whole journal,
-       or a matched part of it.  With a reporting interval, it shows a  report
+       The stats command displays summary information for the  whole  journal,
+       or  a matched part of it.  With a reporting interval, it shows a report
        for each report period.
 
        The stats command also supports -o/--output-file for controlling output
        destination.
 
    tags
-       List all the tag names used in the journal.  With a TAGREGEX  argument,
-       only  tag  names matching the regular expression (case insensitive) are
+       List  all the tag names used in the journal.  With a TAGREGEX argument,
+       only tag names matching the regular expression (case  insensitive)  are
        shown.  With additional QUERY arguments, only transactions matching the
        query are considered.
 
@@ -1820,34 +1921,34 @@ COMMANDS
               $ hledger test
               Cases: 74  Tried: 74  Errors: 0  Failures: 0
 
-       This  command  runs  hledger's built-in unit tests and displays a quick
+       This command runs hledger's built-in unit tests and  displays  a  quick
        report.  With a regular expression argument, it selects only tests with
        matching names.  It's mainly used in development, but it's also nice to
        be able to check your hledger executable for smoke at any time.
 
 ADD-ON COMMANDS
-       hledger also searches for external add-on commands,  and  will  include
+       hledger  also  searches  for external add-on commands, and will include
        these in the commands list.  These are programs or scripts in your PATH
-       whose name starts with hledger- and ends with a recognised file  exten-
+       whose  name starts with hledger- and ends with a recognised file exten-
        sion (currently: no extension, bat,com,exe, hs,lhs,pl,py,rb,rkt,sh).
 
-       Add-ons  can  be  invoked like any hledger command, but there are a few
+       Add-ons can be invoked like any hledger command, but there  are  a  few
        things to be aware of.  Eg if the hledger-web add-on is installed,
 
        o hledger -h web  shows  hledger's  help,  while  hledger web -h  shows
          hledger-web's help.
 
-       o Flags  specific  to  the add-on must have a preceding -- to hide them
-         from hledger.  So hledger web --serve --port 9000 will  be  rejected;
+       o Flags specific to the add-on must have a preceding --  to  hide  them
+         from  hledger.   So hledger web --serve --port 9000 will be rejected;
          you must use hledger web -- --serve --port 9000.
 
-       o You    can    always    run    add-ons    directly    if   preferred:
+       o You   can    always    run    add-ons    directly    if    preferred:
          hledger-web --serve --port 9000.
 
-       Add-ons are a relatively easy way to add local features  or  experiment
-       with  new  ideas.   They  can  be  written in any language, but haskell
-       scripts have a big advantage:  they  can  use  the  same  hledger  (and
-       haskell)  library functions that built-in commands do, for command-line
+       Add-ons  are  a relatively easy way to add local features or experiment
+       with new ideas.  They can be  written  in  any  language,  but  haskell
+       scripts  have  a  big  advantage:  they  can  use the same hledger (and
+       haskell) library functions that built-in commands do, for  command-line
        options, journal parsing, reporting, etc.
 
        Here are some hledger add-ons available:
@@ -1865,7 +1966,7 @@ ADD-ON COMMANDS
        hledger-web provides a simple web interface.
 
    Third party add-ons
-       These are maintained separately, and usually updated  shortly  after  a
+       These  are  maintained  separately, and usually updated shortly after a
        hledger release.
 
    diff
@@ -1873,7 +1974,7 @@ ADD-ON COMMANDS
        journal file and another.
 
    iadd
-       hledger-iadd is a curses-style, more interactive  replacement  for  the
+       hledger-iadd  is  a  curses-style, more interactive replacement for the
        add command.
 
    interest
@@ -1881,19 +1982,19 @@ ADD-ON COMMANDS
        ing to various schemes.
 
    irr
-       hledger-irr calculates the internal rate of  return  of  an  investment
+       hledger-irr  calculates  the  internal  rate of return of an investment
        account.
 
    Experimental add-ons
-       These  are  available  in source form in the hledger repo's bin/ direc-
+       These are available in source form in the hledger  repo's  bin/  direc-
        tory; installing them is pretty easy.  They may be less mature and doc-
-       umented  than  built-in commands.  Reading and tweaking these is a good
+       umented than built-in commands.  Reading and tweaking these is  a  good
        way to start making your own!
 
    autosync
        hledger-autosync is a symbolic link for easily running ledger-autosync,
-       if  installed.   ledger-autosync  does  deduplicating conversion of OFX
-       data and some CSV formats, and can also download the data if your  bank
+       if installed.  ledger-autosync does  deduplicating  conversion  of  OFX
+       data  and some CSV formats, and can also download the data if your bank
        offers OFX Direct Connect.
 
    budget
@@ -1906,21 +2007,21 @@ ADD-ON COMMANDS
        hledger-check.hs checks more powerful account balance assertions.
 
 ENVIRONMENT
-       COLUMNS  The  screen  width used by the register command.  Default: the
+       COLUMNS The screen width used by the register  command.   Default:  the
        full terminal width.
 
        LEDGER_FILE The journal file path when not specified with -f.  Default:
-       ~/.hledger.journal  (on  windows,  perhaps C:/Users/USER/.hledger.jour-
+       ~/.hledger.journal (on  windows,  perhaps  C:/Users/USER/.hledger.jour-
        nal).
 
 FILES
-       Reads data from one or more files in hledger journal, timeclock,  time-
-       dot,   or   CSV   format   specified   with  -f,  or  $LEDGER_FILE,  or
-       $HOME/.hledger.journal          (on          windows,           perhaps
+       Reads  data from one or more files in hledger journal, timeclock, time-
+       dot,  or  CSV  format  specified   with   -f,   or   $LEDGER_FILE,   or
+       $HOME/.hledger.journal           (on          windows,          perhaps
        C:/Users/USER/.hledger.journal).
 
 BUGS
-       The  need  to  precede  addon command options with -- when invoked from
+       The need to precede addon command options with  --  when  invoked  from
        hledger is awkward.
 
        When input data contains non-ascii characters, a suitable system locale
@@ -1933,33 +2034,33 @@ BUGS
        In a Cygwin/MSYS/Mintty window, the tab key is not supported in hledger
        add.
 
-       Not all of Ledger's journal file syntax is supported.  See file  format
+       Not  all of Ledger's journal file syntax is supported.  See file format
        differences.
 
-       On  large  data  files,  hledger  is  slower  and uses more memory than
+       On large data files, hledger  is  slower  and  uses  more  memory  than
        Ledger.
 
 TROUBLESHOOTING
-       Here are some issues you might encounter  when  you  run  hledger  (and
-       remember  you can also seek help from the IRC channel, mail list or bug
+       Here  are  some  issues  you  might encounter when you run hledger (and
+       remember you can also seek help from the IRC channel, mail list or  bug
        tracker):
 
        Successfully installed, but "No command `hledger' found"
        stack and cabal install binaries into a special directory, which should
-       be  added  to your PATH environment variable.  Eg on unix-like systems,
+       be added to your PATH environment variable.  Eg on  unix-like  systems,
        that is ~/.local/bin and ~/.cabal/bin respectively.
 
        I set a custom LEDGER_FILE, but hledger is still using the default file
-       LEDGER_FILE  should  be  a  real environment variable, not just a shell
-       variable.  The command env | grep LEDGER_FILE should show it.  You  may
+       LEDGER_FILE should be a real environment variable,  not  just  a  shell
+       variable.   The command env | grep LEDGER_FILE should show it.  You may
        need to use export.  Here's an explanation.
 
-       "Illegal  byte  sequence"  or  "Invalid or incomplete multibyte or wide
+       "Illegal byte sequence" or "Invalid or  incomplete  multibyte  or  wide
        character" errors
        In order to handle non-ascii letters and symbols (like ), hledger needs
        an appropriate locale.  This is usually configured system-wide; you can
        also configure it temporarily.  The locale may need to be one that sup-
-       ports  UTF-8,  if you built hledger with GHC < 7.2 (or possibly always,
+       ports UTF-8, if you built hledger with GHC < 7.2 (or  possibly  always,
        I'm not sure yet).
 
        Here's  an  example  of  setting  the  locale  temporarily,  on  ubuntu
@@ -1978,7 +2079,7 @@ TROUBLESHOOTING
               $ echo "export LANG=en_US.UTF-8" >>~/.bash_profile
               $ bash --login
 
-       If  we  preferred  to  use eg fr_FR.utf8, we might have to install that
+       If we preferred to use eg fr_FR.utf8, we might  have  to  install  that
        first:
 
               $ apt-get install language-pack-fr
@@ -1999,7 +2100,7 @@ TROUBLESHOOTING
 
 
 REPORTING BUGS
-       Report  bugs at http://bugs.hledger.org (or on the #hledger IRC channel
+       Report bugs at http://bugs.hledger.org (or on the #hledger IRC  channel
        or hledger mail list)
 
 
@@ -2013,7 +2114,7 @@ COPYRIGHT
 
 
 SEE ALSO
-       hledger(1),     hledger-ui(1),     hledger-web(1),      hledger-api(1),
+       hledger(1),      hledger-ui(1),     hledger-web(1),     hledger-api(1),
        hledger_csv(5), hledger_journal(5), hledger_timeclock(5), hledger_time-
        dot(5), ledger(1)
 
