stockor 0.1.9 → 0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/Gemfile.lock +254 -72
- data/Guardfile +1 -1
- data/README.md +24 -3
- data/app.json +28 -0
- data/client/skr/Extension.coffee +18 -0
- data/client/skr/components/BankAccountFinder.cjsx +34 -0
- data/client/skr/components/Currency.cjsx +19 -0
- data/client/skr/components/CustomerFinder.cjsx +37 -0
- data/client/skr/components/CustomerLink.cjsx +13 -0
- data/client/skr/components/CustomerProjectFinder.cjsx +49 -0
- data/client/skr/components/GlAccountChooser.cjsx +38 -0
- data/client/skr/components/InvoiceFinder.cjsx +37 -0
- data/client/skr/components/InvoiceLink.cjsx +13 -0
- data/client/skr/components/LocationChooser.cjsx +37 -0
- data/client/skr/components/PaymentCategoryFinder.cjsx +34 -0
- data/client/skr/components/PrintFormChooser.cjsx +29 -0
- data/client/skr/components/SalesOrderFinder.cjsx +38 -0
- data/client/skr/components/ScreenControls.cjsx +20 -0
- data/client/skr/components/SkuFinder.cjsx +30 -0
- data/client/skr/components/SkuLines.cjsx +76 -0
- data/client/skr/components/SystemSettings.cjsx +26 -0
- data/client/skr/components/TermsChooser.cjsx +40 -0
- data/client/skr/components/ToolbarButton.cjsx +7 -0
- data/client/skr/components/TotalsLine.cjsx +21 -0
- data/client/skr/components/TriStateIcon.cjsx +12 -0
- data/client/skr/components/UOMChooser.cjsx +24 -0
- data/client/skr/components/UserPreferences.cjsx +30 -0
- data/client/skr/components/VendorFinder.cjsx +40 -0
- data/client/skr/components/address/Address.cjsx +10 -10
- data/client/skr/components/styles.scss +16 -0
- data/client/skr/index.js +3 -1
- data/client/skr/models/Address.coffee +9 -1
- data/client/skr/models/BankAccount.coffee +17 -0
- data/client/skr/models/Base.coffee +6 -0
- data/client/skr/models/Customer.coffee +17 -10
- data/client/skr/models/CustomerProject.coffee +29 -0
- data/client/skr/models/GlAccount.coffee +22 -10
- data/client/skr/models/GlManualEntry.coffee +4 -2
- data/client/skr/models/GlPeriod.coffee +4 -6
- data/client/skr/models/GlPosting.coffee +7 -7
- data/client/skr/models/GlTransaction.coffee +3 -3
- data/client/skr/models/IaLine.coffee +9 -9
- data/client/skr/models/IaReason.coffee +4 -4
- data/client/skr/models/InvLine.coffee +30 -11
- data/client/skr/models/InventoryAdjustment.coffee +8 -6
- data/client/skr/models/Invoice.coffee +89 -18
- data/client/skr/models/Location.coffee +27 -6
- data/client/skr/models/Payment.coffee +36 -0
- data/client/skr/models/PaymentCategory.coffee +12 -0
- data/client/skr/models/PaymentTerm.coffee +17 -4
- data/client/skr/models/PickTicket.coffee +7 -5
- data/client/skr/models/PoLine.coffee +15 -15
- data/client/skr/models/PoReceipt.coffee +8 -6
- data/client/skr/models/PorLine.coffee +11 -11
- data/client/skr/models/PricingProvider.coffee +6 -0
- data/client/skr/models/PtLine.coffee +13 -13
- data/client/skr/models/PurchaseOrder.coffee +11 -9
- data/client/skr/models/SalesOrder.coffee +59 -22
- data/client/skr/models/Sku.coffee +17 -15
- data/client/skr/models/SkuLoc.coffee +14 -9
- data/client/skr/models/SkuTran.coffee +10 -10
- data/client/skr/models/SkuVendor.coffee +9 -9
- data/client/skr/models/SoLine.coffee +27 -20
- data/client/skr/models/TimeEntry.coffee +75 -0
- data/client/skr/models/Uom.coffee +27 -6
- data/client/skr/models/Vendor.coffee +14 -12
- data/client/skr/models/VoLine.coffee +11 -11
- data/client/skr/models/Voucher.coffee +7 -5
- data/client/skr/models/mixins/HasVisibleId.coffee +7 -0
- data/client/skr/models/mixins/PrintSupport.coffee +6 -0
- data/client/skr/models/mixins/SkuLine.coffee +61 -0
- data/client/skr/screens/Commands.coffee +29 -0
- data/client/skr/screens/bank-maint/BankMaint.cjsx +43 -0
- data/client/skr/screens/bank-maint/index.js +5 -0
- data/client/skr/screens/chart-of-accounts/ChartOfAccounts.cjsx +40 -0
- data/client/skr/screens/chart-of-accounts/index.js +1 -0
- data/client/skr/screens/chart-of-accounts/index.scss +12 -0
- data/client/skr/screens/customer-maint/CustomerMaint.cjsx +35 -36
- data/client/skr/screens/customer-projects/CustomerProjects.cjsx +70 -0
- data/client/skr/screens/customer-projects/index.js +5 -0
- data/client/skr/screens/customer-projects/index.scss +25 -0
- data/client/skr/screens/fresh-books-import/ApiInfo.cjsx +35 -0
- data/client/skr/screens/fresh-books-import/ChooseRecords.cjsx +116 -0
- data/client/skr/screens/fresh-books-import/FreshBooksImport.cjsx +31 -0
- data/client/skr/screens/fresh-books-import/Import.coffee +52 -0
- data/client/skr/screens/fresh-books-import/ViewRecords.cjsx +96 -0
- data/client/skr/screens/fresh-books-import/index.js +1 -0
- data/client/skr/screens/fresh-books-import/index.scss +39 -0
- data/client/skr/screens/gl-accounts/GlAccounts.cjsx +31 -0
- data/client/skr/screens/gl-accounts/index.js +5 -0
- data/client/skr/screens/gl-transactions/GlTransactions.cjsx +46 -0
- data/client/skr/screens/gl-transactions/index.js +1 -0
- data/client/skr/screens/gl-transactions/index.scss +12 -0
- data/client/skr/screens/invoice/Invoice.cjsx +92 -0
- data/client/skr/screens/invoice/Payment.cjsx +28 -0
- data/client/skr/screens/invoice/index.js +5 -0
- data/client/skr/screens/locations/Locations.cjsx +31 -0
- data/client/skr/screens/locations/index.js +5 -0
- data/client/skr/screens/payment-category/PaymentCategory.cjsx +28 -0
- data/client/skr/screens/payment-category/index.js +5 -0
- data/client/skr/screens/payment-category/index.scss +9 -0
- data/client/skr/screens/payment-terms/PaymentTerms.cjsx +28 -0
- data/client/skr/screens/payment-terms/index.js +5 -0
- data/client/skr/screens/payment-terms/index.scss +9 -0
- data/client/skr/screens/payments/Payments.cjsx +59 -0
- data/client/skr/screens/payments/index.js +5 -0
- data/client/skr/screens/sales-order/SalesOrder.cjsx +68 -0
- data/client/skr/screens/sales-order/index.js +1 -5
- data/client/skr/screens/sku-maint/SkuMaint.cjsx +53 -0
- data/client/skr/screens/sku-maint/SkuUomList.cjsx +209 -0
- data/client/skr/screens/sku-maint/index.js +2 -5
- data/client/skr/screens/sku-maint/index.scss +37 -6
- data/client/skr/screens/time-invoicing/TimeInvoicing.cjsx +156 -0
- data/client/skr/screens/time-invoicing/index.js +5 -0
- data/client/skr/screens/time-invoicing/index.scss +7 -0
- data/client/skr/screens/time-tracking/EditEntry.cjsx +54 -0
- data/client/skr/screens/time-tracking/Entries.coffee +132 -0
- data/client/skr/screens/time-tracking/Header.cjsx +71 -0
- data/client/skr/screens/time-tracking/Popover.cjsx +70 -0
- data/client/skr/screens/time-tracking/PopoverMiniControls.cjsx +25 -0
- data/client/skr/screens/time-tracking/TimeTracking.cjsx +63 -0
- data/client/skr/screens/time-tracking/WeekSummary.cjsx +16 -0
- data/client/skr/screens/time-tracking/index.js +1 -0
- data/client/skr/screens/time-tracking/index.scss +126 -0
- data/client/skr/screens/vendor-maint/VendorMaint.cjsx +45 -0
- data/client/skr/screens/vendor-maint/index.js +1 -5
- data/client/skr/styles.scss +1 -13
- data/config/puma.rb +4 -0
- data/config/routes.rb +21 -9
- data/config/screens.rb +147 -32
- data/db/migrate/20140202194700_create_skr_gl_transaction_details.rb +35 -0
- data/db/migrate/20140220031800_create_skr_locations.rb +2 -0
- data/db/migrate/20140220190836_create_skr_vendors.rb +1 -0
- data/db/migrate/20140220203029_create_skr_customers.rb +3 -2
- data/db/migrate/20140224034759_create_skr_skus.rb +2 -3
- data/db/migrate/20140322223912_create_skr_sales_orders.rb +4 -3
- data/db/migrate/20140322223920_create_skr_so_lines.rb +4 -5
- data/db/migrate/20140323001446_create_so_details_view.rb +7 -5
- data/db/migrate/20140327202209_create_skr_pt_lines.rb +2 -2
- data/db/migrate/20140327214000_create_customer_project.rb +16 -0
- data/db/migrate/20140327223002_create_time_entries.rb +17 -0
- data/db/migrate/20140327224000_create_skr_invoices.rb +5 -1
- data/db/migrate/20140327224002_create_skr_inv_lines.rb +3 -1
- data/db/migrate/20140422024010_create_skr_inv_details_view.rb +1 -1
- data/db/migrate/20151121211323_create_customer_project_details_views.rb +31 -0
- data/db/migrate/20160216142845_create_gl_account_balances_view.rb +20 -0
- data/db/migrate/20160229002044_create_bank_accounts.rb +18 -0
- data/db/migrate/20160229041711_create_payments.rb +33 -0
- data/db/migrate/20160307022705_create_create_combined_uom_views.rb +18 -0
- data/db/schema.sql +639 -140
- data/db/seed/chart_of_accounts.yml +8 -6
- data/db/seed/payment_categories.yml +12 -0
- data/db/seed/skus.yml +32 -0
- data/db/seed.rb +21 -0
- data/lib/skr/access_roles.rb +19 -6
- data/lib/skr/concerns/has_sku_loc_lines.rb +0 -16
- data/lib/skr/concerns/inv_extensions.rb +24 -0
- data/lib/skr/concerns/is_sku_loc_line.rb +3 -4
- data/lib/skr/concerns/so_extensions.rb +8 -0
- data/lib/skr/concerns/visible_id_identifier.rb +1 -1
- data/lib/skr/db/migration_helpers.rb +2 -4
- data/lib/skr/extension.rb +11 -4
- data/lib/skr/handlers/fresh_books_import.rb +20 -0
- data/lib/skr/handlers/invoice_from_time_entries.rb +49 -0
- data/lib/skr/jobs/fresh_books/base.rb +54 -0
- data/lib/skr/jobs/fresh_books/import.rb +151 -0
- data/lib/skr/jobs/fresh_books/retrieve.rb +62 -0
- data/lib/skr/model.rb +5 -0
- data/lib/skr/models/address.rb +1 -1
- data/lib/skr/models/bank_account.rb +13 -0
- data/lib/skr/models/business_entity.rb +3 -0
- data/lib/skr/models/customer.rb +1 -1
- data/lib/skr/models/customer_project.rb +22 -0
- data/lib/skr/models/gl_account.rb +13 -3
- data/lib/skr/models/gl_period.rb +6 -0
- data/lib/skr/models/gl_posting.rb +7 -4
- data/lib/skr/models/gl_transaction.rb +19 -33
- data/lib/skr/models/ia_line.rb +1 -1
- data/lib/skr/models/inv_line.rb +33 -15
- data/lib/skr/models/invoice.rb +47 -20
- data/lib/skr/models/location.rb +7 -1
- data/lib/skr/models/payment.rb +49 -0
- data/lib/skr/models/payment_category.rb +11 -0
- data/lib/skr/models/payment_term.rb +1 -1
- data/lib/skr/models/por_line.rb +1 -1
- data/lib/skr/models/pt_line.rb +1 -1
- data/lib/skr/models/sales_order.rb +9 -9
- data/lib/skr/models/sku_loc.rb +1 -1
- data/lib/skr/models/sku_tran.rb +6 -11
- data/lib/skr/models/so_line.rb +22 -12
- data/lib/skr/models/time_entry.rb +36 -0
- data/lib/skr/models/uom.rb +11 -10
- data/lib/skr/models/user_proxy.rb +1 -1
- data/lib/skr/number.rb +25 -0
- data/lib/skr/print/form.rb +46 -0
- data/lib/skr/print/template.rb +48 -0
- data/lib/skr/print.rb +11 -0
- data/lib/skr/string.rb +11 -0
- data/lib/skr/version.rb +1 -1
- data/lib/skr.rb +9 -0
- data/spec/fixtures/skr/address.yml +164 -4
- data/spec/fixtures/skr/bank_account.yml +8 -0
- data/spec/fixtures/skr/customer.yml +30 -4
- data/spec/fixtures/skr/customer_project.yml +20 -0
- data/spec/fixtures/skr/gl_account.yml +19 -1
- data/spec/fixtures/skr/gl_period.yml +3 -0
- data/spec/fixtures/skr/gl_posting.yml +22 -1
- data/spec/fixtures/skr/gl_transaction.yml +4 -1
- data/spec/fixtures/skr/inv_line.yml +35 -0
- data/spec/fixtures/skr/invoice.yml +13 -2
- data/spec/fixtures/skr/location.yml +5 -0
- data/spec/fixtures/skr/payment.yml +10 -0
- data/spec/fixtures/skr/payment_category.yml +8 -0
- data/spec/fixtures/skr/payment_term.yml +37 -3
- data/spec/fixtures/skr/sales_order.yml +12 -1
- data/spec/fixtures/skr/sku.yml +78 -1
- data/spec/fixtures/skr/sku_loc.yml +42 -1
- data/spec/fixtures/skr/sku_tran.yml +24 -1
- data/spec/fixtures/skr/so_line.yml +32 -0
- data/spec/fixtures/skr/time_entry.yml +82 -0
- data/spec/fixtures/skr/uom.yml +52 -1
- data/spec/fixtures/skr/vendor.yml +28 -1
- data/spec/fixtures/stockor.png +0 -0
- data/spec/server/bank_account_spec.rb +10 -0
- data/spec/server/customer_project_spec.rb +10 -0
- data/spec/server/handlers/invoice_from_time_entries_spec.rb +49 -0
- data/spec/server/jobs/fresh_books/import_spec.rb +69 -0
- data/spec/server/jobs/fresh_books/retrieve_spec.rb +37 -0
- data/spec/server/models/address_spec.rb +4 -3
- data/spec/server/models/gl_transaction_spec.rb +3 -3
- data/spec/server/models/inv_line_spec.rb +83 -3
- data/spec/server/models/invoice_spec.rb +32 -3
- data/spec/server/models/payment_spec.rb +40 -0
- data/spec/server/models/sales_order_spec.rb +1 -1
- data/spec/server/models/so_line_spec.rb +3 -3
- data/spec/server/models/spec_helper_spec.rb +1 -1
- data/spec/server/payment_spec.rb +10 -0
- data/spec/server/print/form_spec.rb +47 -0
- data/spec/server/print/template_spec.rb +36 -0
- data/spec/server/spec_helper.rb +14 -1
- data/spec/server/time_entry_spec.rb +10 -0
- data/spec/skr/components/SkuLinesSpec.coffee +61 -0
- data/spec/skr/models/BankAccountSpec.coffee +5 -0
- data/spec/skr/models/CustomerProjectSpec.coffee +5 -0
- data/spec/skr/models/CustomerSpec.coffee +2 -2
- data/spec/skr/models/PaymentSpec.coffee +5 -0
- data/spec/skr/models/SalesOrderSpec.coffee +21 -5
- data/spec/skr/models/SoLineSpec.coffee +7 -2
- data/spec/skr/models/TimeEntrySpec.coffee +5 -0
- data/spec/skr/screens/bank-maint/BankMaintSpec.coffee +5 -0
- data/spec/skr/screens/customer-projects/CustomerProjectsSpec.coffee +5 -0
- data/spec/skr/screens/fresh-books-import/FreshBooksImportSpec.coffee +1 -0
- data/spec/skr/screens/gl-accounts/GlAccountsSpec.coffee +5 -0
- data/spec/skr/screens/invoice/InvoiceSpec.coffee +5 -0
- data/spec/skr/screens/locations/LocationsSpec.coffee +5 -0
- data/spec/skr/screens/payment-category/PaymentCategorySpec.coffee +5 -0
- data/spec/skr/screens/payment-terms/PaymentTermsSpec.coffee +5 -0
- data/spec/skr/screens/payments/PaymentsSpec.coffee +5 -0
- data/spec/skr/screens/time-invoicing/TimeInvoicingSpec.coffee +5 -0
- data/spec/skr/screens/time-tracking/TimeTrackingSpec.coffee +14 -0
- data/spec/vcr/freshbooks.yml +698 -0
- data/stockor.gemspec +5 -1
- data/templates/print/fonts/GnuMICR.otf +0 -0
- data/templates/print/layout.tex.erb +39 -0
- data/templates/print/packages/booktabs.sty +182 -0
- data/templates/print/packages/fancybox.sty +966 -0
- data/templates/print/packages/fancyhdr.sty +485 -0
- data/templates/print/packages/graphbox.sty +129 -0
- data/templates/print/packages/lastpage.sty +283 -0
- data/templates/print/packages/lastpage209.sty +70 -0
- data/templates/print/packages/marginnote.sty +412 -0
- data/templates/print/packages/multirow.sty +159 -0
- data/templates/print/packages/rotating.sty +282 -0
- data/templates/print/packages/tabu.sty +2557 -0
- data/templates/print/packages/textpos.sty +361 -0
- data/templates/print/packages/varwidth.sty +318 -0
- data/templates/print/partials/address.tex.erb +6 -0
- data/templates/print/partials/bill_to_ship_to.tex.erb +13 -0
- data/templates/print/partials/header.tex.erb +13 -0
- data/templates/print/partials/invoice_paid_state.tex.erb +2 -0
- data/templates/print/partials/old/inv_lines_grouping.tex.erb +8 -0
- data/templates/print/partials/old/labor_lines_footer.tex.erb +18 -0
- data/templates/print/partials/skus_table.tex.erb +32 -0
- data/templates/print/partials/skus_table_col_hdr.tex.erb +8 -0
- data/templates/print/partials/skus_table_footer.tex.erb +5 -0
- data/templates/print/partials/skus_table_group_footer.tex.erb +4 -0
- data/templates/print/partials/skus_table_invoice_footer.tex.erb +25 -0
- data/templates/print/partials/skus_table_invoice_info_line.tex.erb +16 -0
- data/templates/print/partials/skus_table_labor_col_hdr.tex.erb +8 -0
- data/templates/print/partials/skus_table_labor_group_footer.tex.erb +7 -0
- data/templates/print/partials/skus_table_labor_line.tex.erb +11 -0
- data/templates/print/partials/skus_table_line.tex.erb +6 -0
- data/templates/print/partials/skus_table_other_charge_lines.tex.erb +7 -0
- data/templates/print/partials/so_info_line.tex.erb +14 -0
- data/templates/print/types/invoice/default.tex.erb +13 -0
- data/templates/print/types/invoice/labor.tex.erb +33 -0
- data/templates/print/types/payment/default.tex.erb +64 -0
- data/templates/print/types/sales-order/default.tex.erb +8 -0
- metadata +252 -15
- data/client/skr/components/address/address.html +0 -20
- data/client/skr/models/mixins/CodeField.coffee +0 -5
- data/client/skr/screens/customer-maint/index.scss +0 -11
- data/client/skr/screens/customer-maint/layout.html +0 -32
- data/client/skr/screens/sales-order/SalesOrder.coffee +0 -30
- data/client/skr/screens/sales-order/index.scss +0 -8
- data/client/skr/screens/sales-order/layout.html +0 -30
- data/client/skr/screens/sku-maint/SkuMaint.coffee +0 -18
- data/client/skr/screens/sku-maint/layout.html +0 -16
- data/client/skr/screens/vendor-maint/VendorMaint.coffee +0 -28
- data/client/skr/screens/vendor-maint/index.scss +0 -8
- data/client/skr/screens/vendor-maint/layout.html +0 -32
@@ -0,0 +1,361 @@
|
|
1
|
+
%%
|
2
|
+
%% This is file `textpos.sty',
|
3
|
+
%% generated with the docstrip utility.
|
4
|
+
%%
|
5
|
+
%% The original source files were:
|
6
|
+
%%
|
7
|
+
%% textpos.dtx (with options: `package')
|
8
|
+
%% Textpos: absolute positioning of text on the page
|
9
|
+
%%%% File: textpos.dtx
|
10
|
+
%%%% Copyright 1999, 2001--2003, 2005-7, 2009-12, 2014, Norman Gray
|
11
|
+
%%
|
12
|
+
%% This work may be distributed and/or modified under the
|
13
|
+
%% conditions of the LaTeX Project Public License, either version 1.3
|
14
|
+
%% of this license or (at your option) any later version.
|
15
|
+
%% The latest version of this license is in
|
16
|
+
%% http://www.latex-project.org/lppl.txt
|
17
|
+
%% and version 1.3 or later is part of all distributions of LaTeX
|
18
|
+
%% version 2005/12/01 or later.
|
19
|
+
%%
|
20
|
+
%% This work has the LPPL maintenance status `maintained'.
|
21
|
+
%%
|
22
|
+
%% The Current Maintainer of this work is Norman Gray <http://nxg.me.uk>
|
23
|
+
%%
|
24
|
+
%% This work consists of the files textpos.dtx and textpos.ins,
|
25
|
+
%% and the derived file textpos.cls.
|
26
|
+
%%
|
27
|
+
%% Author: Norman Gray, norman@astro.gla.ac.uk.
|
28
|
+
%% Department of Physics and Astronomy, University of Glasgow, UK
|
29
|
+
%%
|
30
|
+
%% See the file LICENCE for a copy of the LPPL.
|
31
|
+
%%
|
32
|
+
%% Mercurial ident: 41b12ce5565c, 2014-01-03 19:15 +0000
|
33
|
+
%%
|
34
|
+
\NeedsTeXFormat{LaTeX2e}
|
35
|
+
\ProvidesPackage{textpos}[2014/01/03 v1.7j]
|
36
|
+
\typeout{Package: textpos 2014/01/03 1.7j, absolute positioning of text on the page}
|
37
|
+
|
38
|
+
\newif\ifTPshowboxes
|
39
|
+
\TPshowboxesfalse
|
40
|
+
\DeclareOption{showboxes}{\TPshowboxestrue}
|
41
|
+
\newif\ifTP@showtext
|
42
|
+
\TP@showtexttrue
|
43
|
+
\DeclareOption{noshowtext}{\TP@showtextfalse}
|
44
|
+
\newif\ifTP@abspos
|
45
|
+
\TP@absposfalse
|
46
|
+
\DeclareOption{absolute}{\TP@abspostrue}
|
47
|
+
\newif\ifTP@overlay
|
48
|
+
\TP@overlayfalse
|
49
|
+
\DeclareOption{overlay}{\TP@overlaytrue}
|
50
|
+
\newif\ifTP@chatter
|
51
|
+
\TP@chattertrue
|
52
|
+
\DeclareOption{quiet}{\TP@chatterfalse}
|
53
|
+
\DeclareOption{verbose}{\TP@chattertrue}
|
54
|
+
\ProcessOptions
|
55
|
+
\ifTP@abspos
|
56
|
+
\RequirePackage{everyshi}
|
57
|
+
\fi
|
58
|
+
\def\TP@xfloat#1[#2]{
|
59
|
+
\par\def\@captype{#1}%
|
60
|
+
\@floatpenalty\z@
|
61
|
+
\color@vbox
|
62
|
+
\normalcolor
|
63
|
+
\vbox\bgroup
|
64
|
+
}
|
65
|
+
\def\TP@xympar{
|
66
|
+
\PackageError{textpos}
|
67
|
+
{You can't use \protect\marginpar\space within a textblock}
|
68
|
+
{You're using textpos because you _don't_ want things to float around, yes?}}
|
69
|
+
\newbox\TP@textbox
|
70
|
+
\ifTP@abspos
|
71
|
+
\newbox\TP@holdbox % starts off void
|
72
|
+
\AtEndDocument{\ifvoid\TP@holdbox \else \hbox{}\fi}
|
73
|
+
\fi
|
74
|
+
\newdimen\TPHorizModule
|
75
|
+
\newdimen\TPVertModule
|
76
|
+
\newdimen\TP@margin
|
77
|
+
\TP@margin=0pt
|
78
|
+
\newdimen\TP@absmargin
|
79
|
+
\TP@absmargin=0pt
|
80
|
+
\newcommand{\TPMargin}{%
|
81
|
+
\@ifstar\TPMargin@outer\TPMargin@inner
|
82
|
+
}
|
83
|
+
\newcommand{\TPMargin@inner}[1]{%
|
84
|
+
\TP@margin=#1\relax
|
85
|
+
\ifdim\TP@margin < 0pt
|
86
|
+
\PackageError{textpos}
|
87
|
+
{\protect\TPMargin\space must have a positive argument}
|
88
|
+
{\protect\TPMargin\space must have a positive argument}
|
89
|
+
\fi
|
90
|
+
\TP@absmargin=\TP@margin
|
91
|
+
}
|
92
|
+
\newcommand\TPMargin@outer[1]{%
|
93
|
+
\TP@margin=-#1\relax
|
94
|
+
\ifdim\TP@margin > 0pt
|
95
|
+
\PackageError{textpos}
|
96
|
+
{\protect\TPMargin*\space must have a positive argument}
|
97
|
+
{\protect\TPMargin*\space must have a positive argument}
|
98
|
+
\fi
|
99
|
+
\TP@absmargin=-\TP@margin
|
100
|
+
}
|
101
|
+
\def\TPGrid{%
|
102
|
+
\@ifnextchar[{\@tempswatrue\TP@Grid}{\@tempswafalse\TP@Grid[0pt,0pt]}}
|
103
|
+
\def\TP@Grid[#1,#2]#3#4{
|
104
|
+
\setlength{\@tempdima}{#1}
|
105
|
+
\multiply\@tempdima by 2
|
106
|
+
\TPHorizModule=\paperwidth
|
107
|
+
\advance\TPHorizModule by -\@tempdima
|
108
|
+
\divide\TPHorizModule by #3
|
109
|
+
\setlength{\@tempdima}{#2}
|
110
|
+
\multiply\@tempdima by 2
|
111
|
+
\TPVertModule=\paperheight
|
112
|
+
\advance\TPVertModule by -\@tempdima
|
113
|
+
\divide\TPVertModule by #4
|
114
|
+
\ifTP@chatter
|
115
|
+
\typeout{Grid set #3 x #4 = \the\TPHorizModule\space x \the\TPVertModule}%
|
116
|
+
\fi
|
117
|
+
\ifTP@abspos\if@tempswa \textblockorigin{#1}{#2}\fi\fi
|
118
|
+
}
|
119
|
+
\TPGrid{16}{16}
|
120
|
+
\newdimen\TPboxrulesize
|
121
|
+
\setlength{\TPboxrulesize}{0.4pt}
|
122
|
+
\def\showtextsize{\normalsize}
|
123
|
+
\ifTP@abspos
|
124
|
+
\newdimen\TP@ox
|
125
|
+
\newdimen\TP@oy
|
126
|
+
\fi
|
127
|
+
\def\textblockorigin#1#2{%
|
128
|
+
\ifTP@abspos
|
129
|
+
\TP@ox=-1in \addtolength\TP@ox{#1}
|
130
|
+
\TP@oy=-1in \addtolength\TP@oy{#2}
|
131
|
+
\ifTP@chatter\typeout{TextBlockOrigin set to #1 x #2}\fi
|
132
|
+
\else
|
133
|
+
\PackageError{textpos}
|
134
|
+
{The \protect\textblockorigin\space command\MessageBreak
|
135
|
+
may only be used if the package was given\MessageBreak
|
136
|
+
the`absolute' option when it was invoked}
|
137
|
+
{If you want to use the \protect\textblockorigin\space command, then
|
138
|
+
\MessageBreak
|
139
|
+
invoke the package with the syntax\MessageBreak
|
140
|
+
\protect\usepackage[absolute]{textpos}}
|
141
|
+
\fi
|
142
|
+
}
|
143
|
+
\def\textblocklabel#1{\gdef\TP@textblocklabel{#1}}
|
144
|
+
\def\textblockcolour#1{%
|
145
|
+
\@ifundefined{color}%
|
146
|
+
{\PackageWarning{textpos}{command textblockcolour used,\MessageBreak
|
147
|
+
but {color} package not loaded.\MessageBreak
|
148
|
+
Colour changes ignored.}}
|
149
|
+
{\gdef\TP@blockcolour{#1}
|
150
|
+
\ifx\TP@defaultblockcolour\@undefined
|
151
|
+
\gdef\TP@defaultblockcolour{#1}
|
152
|
+
\fi
|
153
|
+
}}
|
154
|
+
\def\TP@blockcolour{} % safe initial default
|
155
|
+
\let\textblockcolor\textblockcolour
|
156
|
+
\let\tekstblokkulur\textblockcolour
|
157
|
+
\def\textblockrulecolour#1{%
|
158
|
+
\@ifundefined{color}%
|
159
|
+
{\PackageWarning{textpos}{command textblockrulecolour used,\MessageBreak
|
160
|
+
but {color} package not loaded.\MessageBreak
|
161
|
+
Colour changes ignored.}}
|
162
|
+
{\gdef\TP@rulecolour{#1}}}
|
163
|
+
\def\TP@rulecolour{black}
|
164
|
+
\let\textblockrulecolor\textblockrulecolour
|
165
|
+
\let\tekstblokroolkulur\textblockrulecolour
|
166
|
+
\gdef\TP@color[#1]#2{}
|
167
|
+
\def\TP@checkdummycolorpackage{%
|
168
|
+
\@ifundefined{color}%
|
169
|
+
{\globaldefs=1
|
170
|
+
\DeclareRobustCommand\color[2][]{}%
|
171
|
+
\def\color@block##1##2##3{}%
|
172
|
+
\globaldefs=0 }{}%
|
173
|
+
\global\let\TP@checkdummycolorpackage\relax % don't come here again
|
174
|
+
}
|
175
|
+
\def\textblock#1{%
|
176
|
+
\@tempdima=#1\TPHorizModule
|
177
|
+
\ifvmode\else
|
178
|
+
\ifmmode
|
179
|
+
\PackageError{textpos}
|
180
|
+
{You cannot use textblock in maths mode}
|
181
|
+
{You may use the textblock environment only in \MessageBreak
|
182
|
+
vertical mode or horizontal mode (when it triggers a\MessageBreak
|
183
|
+
new paragraph). You cannot use it in maths mode.}
|
184
|
+
\else % in horizontal mode
|
185
|
+
\par % force us back into vertical mode
|
186
|
+
\fi
|
187
|
+
\fi
|
188
|
+
\@ifnextchar[{\TP@textblock}{\TP@textblock[0,0]}%] bracematch
|
189
|
+
}
|
190
|
+
\def\TP@textblockstar#1{%
|
191
|
+
\setlength{\@tempdima}{#1}
|
192
|
+
\ifvmode\else
|
193
|
+
\PackageWarning{textpos}{environment textblock* not in vertical mode.
|
194
|
+
\MessageBreak
|
195
|
+
Environment textblock* should not have any text\MessageBreak
|
196
|
+
or printable material appearing before it.\MessageBreak
|
197
|
+
Alignment may work out wrongly.}%
|
198
|
+
\par % force us back into vertical mode
|
199
|
+
\fi
|
200
|
+
\@ifnextchar[{\TP@textblock}{\TP@textblock[0,0]}%] bracematch
|
201
|
+
}
|
202
|
+
\expandafter\let\csname textblock*\endcsname\TP@textblockstar
|
203
|
+
\newtoks\TP@tbargs
|
204
|
+
\def\TP@textblock[#1,#2](#3,#4){%
|
205
|
+
\TP@tbargs={{#1}{#2}{#3}{#4}}%
|
206
|
+
\let\@xfloat\TP@xfloat
|
207
|
+
\let\@xympar\TP@xympar
|
208
|
+
\setbox\TP@textbox=\vbox\bgroup
|
209
|
+
\ifTPshowboxes
|
210
|
+
\TP@checkdummycolorpackage
|
211
|
+
{\color{\TP@rulecolour}\hrule height0pt depth \TPboxrulesize }%
|
212
|
+
\vskip-\TPboxrulesize
|
213
|
+
\fi
|
214
|
+
\ifdim\TP@margin = 0pt
|
215
|
+
\hsize=\@tempdima
|
216
|
+
\textwidth\hsize \columnwidth\hsize \linewidth\hsize
|
217
|
+
\else
|
218
|
+
\vskip\TP@absmargin
|
219
|
+
\@tempdimb=\@tempdima % \@tempdimb is outer box width
|
220
|
+
\hsize=\@tempdima % \hsize is inner box width
|
221
|
+
\ifdim\TP@margin < 0pt
|
222
|
+
\advance\@tempdimb by 2\TP@absmargin % bigger box
|
223
|
+
\else
|
224
|
+
\advance\hsize by -2\TP@absmargin % narrower content
|
225
|
+
\fi
|
226
|
+
\hbox to \@tempdimb\bgroup
|
227
|
+
\hskip\TP@absmargin\vbox\bgroup
|
228
|
+
\textwidth\hsize \columnwidth\hsize \linewidth\hsize
|
229
|
+
\fi
|
230
|
+
}
|
231
|
+
\def\endtextblock{\global\@tempswatrue\TP@commonendtextblock}
|
232
|
+
\@namedef{endtextblock*}{\global\@tempswafalse\TP@commonendtextblock}
|
233
|
+
\newdimen\TP@prevdepth
|
234
|
+
\def\TP@commonendtextblock{%
|
235
|
+
\ifdim\TP@margin = 0pt
|
236
|
+
\relax
|
237
|
+
\else
|
238
|
+
\egroup % end of inner vbox
|
239
|
+
\hskip\TP@absmargin
|
240
|
+
\egroup % end of inner hbox
|
241
|
+
\vskip \TP@absmargin
|
242
|
+
\fi
|
243
|
+
\ifTPshowboxes
|
244
|
+
\vskip-\TPboxrulesize
|
245
|
+
{\color{\TP@rulecolour}\hrule depth 0pt height \TPboxrulesize}%
|
246
|
+
\fi
|
247
|
+
\egroup % end of \TP@textbox
|
248
|
+
\TP@prevdepth=\prevdepth
|
249
|
+
\prevdepth=-1000pt % = \nointerlineskip
|
250
|
+
\expandafter\TP@endtextblock\the\TP@tbargs
|
251
|
+
}
|
252
|
+
\def\TP@endtextblock#1#2#3#4{%
|
253
|
+
\if@tempswa % modular/unstarred endtextblock
|
254
|
+
\@tempdima=#3\TPHorizModule
|
255
|
+
\@tempdimb=#4\TPVertModule
|
256
|
+
\else % absolute/starred endtextblock
|
257
|
+
\setlength{\@tempdima}{#3}
|
258
|
+
\setlength{\@tempdimb}{#4}
|
259
|
+
\fi
|
260
|
+
\ifdim\TP@margin < 0pt
|
261
|
+
\advance\@tempdima \TP@margin
|
262
|
+
\advance\@tempdimb \TP@margin
|
263
|
+
% #1,#2 are proportions of \TP@textbox size
|
264
|
+
\@tempdimc=-#1\wd\TP@textbox
|
265
|
+
\advance\@tempdima\@tempdimc
|
266
|
+
\@tempdimc=-#2\ht\TP@textbox
|
267
|
+
\advance\@tempdimb\@tempdimc
|
268
|
+
\else
|
269
|
+
% \TP@margin is positive
|
270
|
+
% #1,#2 are proportions of \TP@framebox size = \TP@textbox+2\TP@margin
|
271
|
+
\@tempdimc=\wd\TP@textbox
|
272
|
+
\advance\@tempdimc 2\TP@margin
|
273
|
+
\@tempdimc=#1\@tempdimc
|
274
|
+
\advance\@tempdima -\@tempdimc
|
275
|
+
\@tempdimc=\ht\TP@textbox
|
276
|
+
\advance\@tempdimc 2\TP@margin
|
277
|
+
\@tempdimc=#2\@tempdimc
|
278
|
+
\advance\@tempdimb -\@tempdimc
|
279
|
+
\fi
|
280
|
+
\ifTP@abspos
|
281
|
+
\advance\@tempdima by \TP@ox
|
282
|
+
\advance\@tempdimb by \TP@oy
|
283
|
+
\fi
|
284
|
+
\setbox0=\vbox to 0pt{\vskip\@tempdimb
|
285
|
+
\hbox to 0pt{\hskip\@tempdima
|
286
|
+
\ifx\TP@blockcolour\@empty \else
|
287
|
+
{\TP@checkdummycolorpackage
|
288
|
+
\color{\TP@blockcolour}%
|
289
|
+
\color@block{\wd\TP@textbox}{\ht\TP@textbox}{\dp\TP@textbox}%
|
290
|
+
}%
|
291
|
+
\fi
|
292
|
+
\ifx\TP@defaultblockcolour\@undefined \else
|
293
|
+
\global\let\TP@blockcolour\TP@defaultblockcolour
|
294
|
+
\fi
|
295
|
+
\ifTPshowboxes
|
296
|
+
{\color{\TP@rulecolour}\vrule width \TPboxrulesize}%
|
297
|
+
\hskip -\TPboxrulesize
|
298
|
+
\fi
|
299
|
+
\ifTP@showtext
|
300
|
+
\box\TP@textbox
|
301
|
+
\else
|
302
|
+
\vbox to\ht\TP@textbox{%
|
303
|
+
\ifTPshowboxes
|
304
|
+
{\color{\TP@rulecolour}\hrule depth 0pt height \TPboxrulesize \vskip-\TPboxrulesize}%
|
305
|
+
\fi
|
306
|
+
\vskip\smallskipamount
|
307
|
+
\hbox to\wd\TP@textbox{%
|
308
|
+
\ifx\TP@textblocklabel\undefined
|
309
|
+
\hbox{}%
|
310
|
+
\else
|
311
|
+
\hskip\smallskipamount
|
312
|
+
\fbox{\showtextsize \TP@textblocklabel}%
|
313
|
+
\global\let\TP@textblocklabel\undefined
|
314
|
+
\fi
|
315
|
+
\hss
|
316
|
+
}%
|
317
|
+
\vss
|
318
|
+
\ifTPshowboxes
|
319
|
+
\vskip -\TPboxrulesize
|
320
|
+
{\color{\TP@rulecolour}\hrule depth 0pt height \TPboxrulesize}%
|
321
|
+
\fi
|
322
|
+
}%
|
323
|
+
\fi
|
324
|
+
\ifTPshowboxes
|
325
|
+
\hskip -\TPboxrulesize
|
326
|
+
{\color{\TP@rulecolour}\vrule width \TPboxrulesize}%
|
327
|
+
\fi
|
328
|
+
\hss}%
|
329
|
+
\vss
|
330
|
+
}% end of box0
|
331
|
+
\ifTP@abspos
|
332
|
+
\global\setbox\TP@holdbox\vbox{%
|
333
|
+
\unvbox\TP@holdbox
|
334
|
+
\box0
|
335
|
+
}%
|
336
|
+
\else
|
337
|
+
\box0
|
338
|
+
\prevdepth=\TP@prevdepth
|
339
|
+
\fi
|
340
|
+
}%
|
341
|
+
\ifTP@abspos
|
342
|
+
\ifTP@overlay
|
343
|
+
\EveryShipout{%
|
344
|
+
\global\setbox\@cclv\vbox{%
|
345
|
+
\vbox to 0pt{\ifvbox\@cclv \unvbox\@cclv \else \box\@cclv \fi \vss}%
|
346
|
+
\unvbox\TP@holdbox % TP@holdbox is now void
|
347
|
+
}
|
348
|
+
}%
|
349
|
+
\else
|
350
|
+
\EveryShipout{%
|
351
|
+
\global\setbox\@cclv\vbox{%
|
352
|
+
\unvbox\TP@holdbox
|
353
|
+
\ifvbox\@cclv \unvbox\@cclv \else \box\@cclv \fi
|
354
|
+
}%
|
355
|
+
}%
|
356
|
+
\fi
|
357
|
+
\textblockorigin{0pt}{0pt}%
|
358
|
+
\fi
|
359
|
+
\endinput
|
360
|
+
%%
|
361
|
+
%% End of file `textpos.sty'.
|
@@ -0,0 +1,318 @@
|
|
1
|
+
% varwidth.sty v 0.92 Mar 2009 Donald Arseneau asnd@triumf.ca
|
2
|
+
%
|
3
|
+
% Copyright 2003-2004,2009 by Donald Arseneau (asnd@triumf.ca).
|
4
|
+
% This software is released under the terms of the LaTeX Project Public
|
5
|
+
% License (ftp://ctan.tug.org/tex-archive/macros/latex/base/lppl.txt).
|
6
|
+
% (Essentially: Free to use, copy, distribute (sell) and change, but, if
|
7
|
+
% changed, that fact must be clearly displayed to the user.)
|
8
|
+
%
|
9
|
+
% The varwidth environment is based on minipage, and takes the same
|
10
|
+
% parameters, but the specified width is just a maximum value -- the
|
11
|
+
% environment will be typeset with a narrower "natural" width if
|
12
|
+
% possible.
|
13
|
+
%
|
14
|
+
% In a varwidth environment, paragraph line-breaks are chosen
|
15
|
+
% according to the specified width, but each line is reset to
|
16
|
+
% match a narrower natural width, if there is one.
|
17
|
+
%
|
18
|
+
% The \narrowragged command works like \raggedright, but produces
|
19
|
+
% generally narrower lines in paragraphs, with more text in the last
|
20
|
+
% line (the lines have more-equal lengths).
|
21
|
+
%
|
22
|
+
% This version works fine, but there are still many questions about
|
23
|
+
% how it would work best. Should there be a version that avoids the
|
24
|
+
% usual minipage formatting style?
|
25
|
+
%
|
26
|
+
% Numbered equations are not handled well, especially with leqno.
|
27
|
+
% AMSmath environments have not been tried, and undoubtedly fail.
|
28
|
+
%
|
29
|
+
% To do: Extend v-list wrappers to handle all e-TeX primitives.
|
30
|
+
% (pdfTeX too?)
|
31
|
+
% Capture marks and floats, propagating them out of the box
|
32
|
+
% Support numbered equations, including ams math.
|
33
|
+
%
|
34
|
+
|
35
|
+
\ProvidesPackage{varwidth}[2009/03/30 ver 0.92; \space
|
36
|
+
Variable-width minipages]
|
37
|
+
|
38
|
+
\newcommand\narrowragged{\rightskip \z@ plus .25\hsize
|
39
|
+
\@rightskip\rightskip \parfillskip\z@ plus .15\hsize
|
40
|
+
\sloppy }
|
41
|
+
|
42
|
+
\newbox\@vwid@box
|
43
|
+
|
44
|
+
% The varwidth environment is based on minipage, and takes the same
|
45
|
+
% parameters, but the specified width is only a limit -- a narrower
|
46
|
+
% natural width may be used. \varwidth uses \minipage.
|
47
|
+
|
48
|
+
\def\varwidth{\let\@minipagerestore\@vwid@setup \minipage}
|
49
|
+
|
50
|
+
% Many things may appear on vertical lists that can't be re-processed,
|
51
|
+
% so they have to be modified.
|
52
|
+
|
53
|
+
\def\@vwid@setup{%
|
54
|
+
% several things can't appear in vertical mode, so they may get
|
55
|
+
% a \vbox wrapped around them.
|
56
|
+
\let\@bsphack\@vwid@bsphack % \label and others
|
57
|
+
\let\mark\@gobble % Marks disappear in minipages anyway
|
58
|
+
\let\special\@vwid@special % \color and others
|
59
|
+
\let\pdfliteral\@vwid@pdfliteral % \color and others
|
60
|
+
\let\addtocontents\@vwid@addtocontents % \addcontentsline
|
61
|
+
% Shifted boxes (\parshape,\hangindent) will have their shifts
|
62
|
+
% indicated in a separate box.
|
63
|
+
\let\@hangfrom\@vwid@hangfrom % hanging indents
|
64
|
+
\let\list\@vwid@list
|
65
|
+
\let\endtrivlist\@vwid@endtrivlist
|
66
|
+
\postdisplaypenalty\@vwid@posteqp
|
67
|
+
\predisplaypenalty\@vwid@preeqp
|
68
|
+
\def\@eqnnum{\aftergroup\@vwid@afterva\@@vwid@eqnnum}%
|
69
|
+
\global\@vwid@roff\z@ \global\@vwid@loff\z@
|
70
|
+
% Begin an inner minipage-like vertical box (in \@tempboxa)
|
71
|
+
\let\@minipagerestore\@@vwid@minipagerestore \@minipagerestore
|
72
|
+
\setbox\@tempboxa\vbox\bgroup\begingroup
|
73
|
+
% Flag the top of the list
|
74
|
+
\penalty\@vwid@toppen
|
75
|
+
}
|
76
|
+
|
77
|
+
\let\@@vwid@minipagerestore\@minipagerestore
|
78
|
+
|
79
|
+
% At end of varwidth environment.
|
80
|
+
\def\endvarwidth{\par\@@par
|
81
|
+
\unskip
|
82
|
+
% Handle minipage-style notes.
|
83
|
+
\ifvoid\@mpfootins\else
|
84
|
+
\vskip\skip\@mpfootins
|
85
|
+
\normalcolor
|
86
|
+
\@vwid@wrap\footnoterule
|
87
|
+
\unvbox\@mpfootins
|
88
|
+
\fi
|
89
|
+
\unskip
|
90
|
+
\@minipagefalse
|
91
|
+
\endgroup\egroup % got my \@tempboxa
|
92
|
+
%{\showoutput\showbox\@tempboxa}%
|
93
|
+
% in a discarded box, sift through list measuring max width.
|
94
|
+
\begingroup\setbox\z@\vbox\bgroup
|
95
|
+
%\message{-------------------------------------------------------------}%
|
96
|
+
%\message{First pass; hsize=\the\hsize... }%{\tracingall\showlists}%%
|
97
|
+
\unvcopy\@tempboxa
|
98
|
+
\@tempdima-\maxdimen
|
99
|
+
\let\@vwid@resetb\@vwid@measure
|
100
|
+
\let\@vwid@append\relax
|
101
|
+
\sift@deathcycles\z@
|
102
|
+
\@vwid@sift
|
103
|
+
\xdef\@vwid@{\the\@tempdima}%
|
104
|
+
\egroup\endgroup
|
105
|
+
% Done measuring. Now empty \@tempboxa onto current vertical list
|
106
|
+
% which is the contents of a minipage environment
|
107
|
+
%\message{Got natural width \@vwid@ (compare \the\hsize) }%
|
108
|
+
\unvbox\@tempboxa
|
109
|
+
% Choose the natural width or the declared width, whichever is smaller.
|
110
|
+
\ifdim\@vwid@<\hsize
|
111
|
+
\hsize\@vwid@
|
112
|
+
\fi
|
113
|
+
% Go through the vertical list reboxing and moving everything into
|
114
|
+
% \@vwid@box; then spill \@vwid@box. If the natural width is narrower,
|
115
|
+
\setbox\@vwid@box\vbox{}%
|
116
|
+
\sift@deathcycles\z@
|
117
|
+
%\message{----------------------------------------------------------------}%
|
118
|
+
%\message{Second pass; hsize=\the\hsize... }%{\tracingall\showlists}%
|
119
|
+
\@vwid@sift
|
120
|
+
%\message{After sifting:}%
|
121
|
+
%{\showoutput\showbox\@vwid@box}%
|
122
|
+
\unvbox\@vwid@box
|
123
|
+
% end the minipage environment
|
124
|
+
\endminipage}
|
125
|
+
|
126
|
+
%
|
127
|
+
% Here are definitions for sifting through the vertical list, either
|
128
|
+
% measuring things or reboxing them.
|
129
|
+
%
|
130
|
+
% Penalties used as signals to the vertical-list processor:
|
131
|
+
|
132
|
+
\mathchardef\@vwid@posteqp 17321 % Penalty below equations
|
133
|
+
\mathchardef\@vwid@preeqp 17322 % Penalty above equations
|
134
|
+
\mathchardef\@vwid@postnump 17323 % Penalty below numbered equations
|
135
|
+
\mathchardef\@vwid@toppen 17324 % Penalty marking top of vertical list
|
136
|
+
\mathchardef\@vwid@offsets 17325 % Penalty below special h-offsets box
|
137
|
+
\mathchardef\@vwid@postw 17326 % Penalty below a \vbox-wrapped object
|
138
|
+
|
139
|
+
\newcount\sift@deathcycles
|
140
|
+
|
141
|
+
\def\@vwid@sift{%
|
142
|
+
\skip@\lastskip\unskip
|
143
|
+
\dimen@\lastkern\unkern
|
144
|
+
\count@\lastpenalty\unpenalty
|
145
|
+
\setbox\z@\lastbox
|
146
|
+
%{\showoutput\showbox\z@}%
|
147
|
+
\ifvoid\z@ \advance\sift@deathcycles\@ne \else \sift@deathcycles\z@ \fi
|
148
|
+
\ifnum\sift@deathcycles>33
|
149
|
+
\let\@vwid@sift\relax
|
150
|
+
\PackageWarning{varwidth}{Failed to reprocess entire contents}%
|
151
|
+
\fi
|
152
|
+
%\message{\the\sift@deathcycles: skip \the\skip@; kern \the\dimen@; penalty \the\count@. }%
|
153
|
+
%\ifhbox\z@\setbox99\hbox to0pt{\unhcopy\z@}\fi % = message
|
154
|
+
\ifnum\count@=\@vwid@preeqp \@vwid@eqmodefalse\fi
|
155
|
+
%\ifnum\count@=\@vwid@preeqp \message{End equation mode. }\fi
|
156
|
+
\ifnum\count@=\@vwid@posteqp \@vwid@eqmodetrue\fi
|
157
|
+
%\ifnum\count@=\@vwid@posteqp\message{Begin equation mode. }\fi
|
158
|
+
%\if@vwid@eqmode {\showoutput\showbox\z@}\fi
|
159
|
+
\ifnum\count@=\@vwid@toppen % finished
|
160
|
+
\let\@vwid@sift\relax
|
161
|
+
\else\ifnum\count@=\@vwid@offsets
|
162
|
+
\@vwid@setoffsets
|
163
|
+
\else
|
164
|
+
\ifnum\count@=\@vwid@postw
|
165
|
+
\else
|
166
|
+
\@vwid@resetb % reset box \z@ or measure it
|
167
|
+
\fi
|
168
|
+
\@vwid@append
|
169
|
+
\fi\fi
|
170
|
+
\@vwid@sift}
|
171
|
+
|
172
|
+
\def\@vwid@setoffsets{%
|
173
|
+
\setbox\z@=\hbox{\unhbox\z@
|
174
|
+
\global\@vwid@roff\lastkern\unkern
|
175
|
+
\global\@vwid@loff\lastkern\unkern}%
|
176
|
+
%\message{Set offsets to \the\@vwid@loff, \the\@vwid@roff. }%
|
177
|
+
}
|
178
|
+
|
179
|
+
\def\@vwid@append{% Append contents of box \z@ and glue to \@vwid@box
|
180
|
+
\setbox\@vwid@box\vbox{%
|
181
|
+
\unvbox\z@
|
182
|
+
\ifdim\dimen@=\z@\else \kern\dimen@ \fi
|
183
|
+
\vskip\skip@
|
184
|
+
\unvbox\@vwid@box
|
185
|
+
}%{\tracingall\showbox\@vwid@box}%
|
186
|
+
}
|
187
|
+
|
188
|
+
% reset box \z@ to \hsize, applying shifts, and wrap in vbox
|
189
|
+
% Don't worry about numbered equations because we won't get
|
190
|
+
% here if there are any.
|
191
|
+
\def\@vwid@resetb{%
|
192
|
+
\setbox\z@\vbox\bgroup
|
193
|
+
\ifvoid\z@
|
194
|
+
\else
|
195
|
+
\ifvbox\z@
|
196
|
+
\box\z@
|
197
|
+
\else % \hbox
|
198
|
+
\@tempdima\hsize
|
199
|
+
\advance\@tempdima-\@vwid@roff
|
200
|
+
\advance\@tempdima-\@vwid@loff
|
201
|
+
\advance\@tempdima-\p@
|
202
|
+
%\message{Test if \the\wd\z@ > \the\@tempdima, }%
|
203
|
+
\ifdim\wd\z@>\@tempdima % full-width line; rebox it
|
204
|
+
%\message{An ordinary line or alignment. (\the\wd\z@ > \the\@tempdima) }%
|
205
|
+
\hbox to\hsize
|
206
|
+
{\kern\@vwid@loff \unhbox\z@ \kern\@vwid@roff}%
|
207
|
+
\else % an equation or direct \hbox
|
208
|
+
\if@vwid@eqmode % re-center unnumbered equations
|
209
|
+
%\message{A centered equation hsize=\the\hsize. }%
|
210
|
+
\hbox to\hsize
|
211
|
+
{\hskip\@vwid@loff\@plus1fil
|
212
|
+
\unhbox\z@ \hskip\@vwid@roff\@plus1fil}%
|
213
|
+
\else % plain narrow \hbox; leave it as-is
|
214
|
+
%\message{Plain narrow box}%
|
215
|
+
\box\z@
|
216
|
+
\fi\fi\fi\fi
|
217
|
+
\egroup}
|
218
|
+
|
219
|
+
|
220
|
+
% Measure a line (in box \z@) and keep a running tally of the
|
221
|
+
% widest natural width in \@tempdima
|
222
|
+
|
223
|
+
\def\@vwid@measure{%
|
224
|
+
\ifvoid\z@
|
225
|
+
\else
|
226
|
+
% numbered equations not part of alignments can't be reset,
|
227
|
+
% so force retention of full width.
|
228
|
+
\ifnum\count@=\@vwid@postnump \ifdim\wd\z@<\linewidth
|
229
|
+
\ifdim\@tempdima<\linewidth \@tempdima\linewidth \fi
|
230
|
+
\fi\fi
|
231
|
+
\ifhbox\z@
|
232
|
+
\setbox\z@=\hbox
|
233
|
+
{\kern\@vwid@loff \unhbox\z@ \kern\@vwid@roff}%
|
234
|
+
\fi
|
235
|
+
\ifdim\wd\z@>\@tempdima \@tempdima\wd\z@ \fi
|
236
|
+
\fi}
|
237
|
+
|
238
|
+
\newdimen\@vwid@loff
|
239
|
+
\newdimen\@vwid@roff
|
240
|
+
|
241
|
+
\let\@@bsphack\@bsphack
|
242
|
+
\let\@@esphack\@esphack
|
243
|
+
\let\@@Esphack\@Esphack
|
244
|
+
|
245
|
+
\def\@vwid@bsphack{\@@bsphack
|
246
|
+
\ifx\@vwid@wrap\@firstofone
|
247
|
+
\bgroup
|
248
|
+
\else
|
249
|
+
\ifvmode
|
250
|
+
\setbox\@vwid@box \vbox\bgroup \vbox\bgroup
|
251
|
+
\let\@vwid@wrap\@firstofone
|
252
|
+
\def\@esphack{\@vwid@esphack\@@esphack}%
|
253
|
+
\def\@Esphack{\@vwid@esphack\@@Esphack}%
|
254
|
+
\fi
|
255
|
+
\fi}
|
256
|
+
|
257
|
+
\def\@vwid@esphack{\egroup
|
258
|
+
\ifx\@vwid@wrap\@firstofone\else
|
259
|
+
\egroup % end outer box
|
260
|
+
\unvbox\@vwid@box % put inner box on list without lineskip
|
261
|
+
\penalty\@vwid@postw
|
262
|
+
\fi}
|
263
|
+
|
264
|
+
% \vbox Wrapper for misc vlist items
|
265
|
+
\long\def\@vwid@wrap{\relax
|
266
|
+
\ifvmode\expandafter\@vwid@dowrap \else \expandafter\@firstofone \fi}
|
267
|
+
\long\def\@vwid@dowrap#1{%
|
268
|
+
\setbox\@vwid@box \vbox{\vbox{\let\@vwid@wrap\@firstofone
|
269
|
+
#1}\penalty\@vwid@postw
|
270
|
+
}\unvbox\@vwid@box }
|
271
|
+
|
272
|
+
\let\@@vwid@special\special
|
273
|
+
\let\@@vwid@pdfliteral\pdfliteral
|
274
|
+
\let\@@vwid@addtocontents\addtocontents
|
275
|
+
\let\@@vwid@list\list
|
276
|
+
\let\@@vwid@endtrivlist\endtrivlist
|
277
|
+
\let\@@vwid@eqnnum\@eqnnum
|
278
|
+
|
279
|
+
\long\def\@vwid@special#1{\@vwid@wrap{\@@vwid@special{#1}}}
|
280
|
+
\long\def\@vwid@pdfliteral#1{\@vwid@wrap{\@@vwid@pdfliteral{#1}}}
|
281
|
+
\long\def\@vwid@addtocontents#1#2{\@vwid@wrap{\@@vwid@addtocontents{#1}{#2}}}
|
282
|
+
|
283
|
+
\long\def\@vwid@hangfrom#1{\par
|
284
|
+
\setbox\@tempboxa\hbox{{#1}}%
|
285
|
+
\setbox\@vwid@box \vbox{\hbox{\kern\z@ \kern\z@
|
286
|
+
}\penalty\@vwid@offsets}\unvbox\@vwid@box
|
287
|
+
\def\par{\relax\ifhmode\unskip\fi
|
288
|
+
\vadjust{\hbox{\kern\hangindent\kern\z@}\penalty\@vwid@offsets}%
|
289
|
+
\@restorepar\par}%
|
290
|
+
\hangindent \wd\@tempboxa\noindent\box\@tempboxa}
|
291
|
+
|
292
|
+
\def\@vwid@list{\@vwid@setlist\@@vwid@list}
|
293
|
+
\def\@vwid@endtrivlist{\@vwid@setlist\@@vwid@endtrivlist}
|
294
|
+
|
295
|
+
\def\@vwid@setlist{\relax\ifhmode \unskip\expandafter\vadjust\fi
|
296
|
+
{\setbox\@vwid@box \vbox{\hbox{%
|
297
|
+
\advance\hsize-\linewidth \advance\hsize-\@totalleftmargin
|
298
|
+
\kern\@totalleftmargin \kern\hsize}%
|
299
|
+
\penalty\@vwid@offsets}%
|
300
|
+
\unvbox\@vwid@box}}
|
301
|
+
|
302
|
+
\newif\if@vwid@eqmode
|
303
|
+
|
304
|
+
\def\@vwid@afterva{\vadjust{\penalty\@vwid@postnump}}
|
305
|
+
|
306
|
+
% Should I do this? ...
|
307
|
+
|
308
|
+
\@ifundefined{newcolumntype}{}{%
|
309
|
+
\@ifundefined{NC@rewrite@V}{
|
310
|
+
\newcolumntype{V}[1]{%
|
311
|
+
>{\begin{varwidth}[t]{#1}\narrowragged\let\\\tabularnewline}%
|
312
|
+
l%
|
313
|
+
<{\@finalstrut\@arstrutbox\end{varwidth}}}
|
314
|
+
}{}
|
315
|
+
}
|
316
|
+
|
317
|
+
% V 0.91 Always restack contents, even if width didn't change.
|
318
|
+
% V 0.92 fix \special, \pdfliteral
|
@@ -0,0 +1,6 @@
|
|
1
|
+
\begin{tabular}{l}
|
2
|
+
<% unless @address.name.blank? %><%=q @address.name %> \\<% end %>
|
3
|
+
<% unless @address.line1.blank? %><%=q @address.line1 %> \\<% end %>
|
4
|
+
<% unless @address.line2.blank? %><%=q @address.line2 %> \\<% end %>
|
5
|
+
<% unless @address.city.blank? %><%=q @address.city %>, <% end %><%=q @address.state %> <%=q @address.postal_code %> \\
|
6
|
+
\end{tabular}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
\noindent\begin{tabu} to\linewidth{X[pc]X[pc]}
|
2
|
+
\multicolumn{1}{l}{\textbf{Bill To:}} & \multicolumn{1}{l}{\textbf{Ship To:}}\\
|
3
|
+
\parbox{115\unitlength}{
|
4
|
+
<%=partial 'address', address: @record.billing_address %>
|
5
|
+
} &
|
6
|
+
\parbox{115\unitlength}{
|
7
|
+
%<% if @record.shipping_address.blank? %>
|
8
|
+
\emph{Same as Billing}
|
9
|
+
%<% else %>
|
10
|
+
<%=partial 'address', address: @record.shipping_address %>
|
11
|
+
%<% end %>
|
12
|
+
} \\
|
13
|
+
\end{tabu}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
\lhead{
|
2
|
+
\begin{tabularx}{\textwidth} {lXr}
|
3
|
+
%<% if @location.get_logo.present? %>
|
4
|
+
\raisebox{1mm}{\includegraphics[align=t,height=18mm,keepaspectratio]{<%= @location.get_logo.file.path %>}}
|
5
|
+
%<% end %>
|
6
|
+
& \small <%= break_lines @location.address.to_s(include: [:email,:phone]) -%>
|
7
|
+
& \raisebox{-6.5mm}{{\begin{tabularx}{4cm}{Xr}
|
8
|
+
\multicolumn{2}{c}{\Ovalbox{\parbox[c]{4cm}{\centering\bf <%=q @form_title %>}}} \\[2mm]
|
9
|
+
Date: & <%=q @date.strftime("%b #{Skr::Number.ordinalize(@date.day)}, %Y") %> \\[1mm]
|
10
|
+
Page: & \thepage{} of \pageref{LastPage} \\
|
11
|
+
\end{tabularx}}} \\
|
12
|
+
\end{tabularx}
|
13
|
+
}
|