stockor 0.1.9 → 0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (313) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -1
  3. data/Gemfile.lock +254 -72
  4. data/Guardfile +1 -1
  5. data/README.md +24 -3
  6. data/app.json +28 -0
  7. data/client/skr/Extension.coffee +18 -0
  8. data/client/skr/components/BankAccountFinder.cjsx +34 -0
  9. data/client/skr/components/Currency.cjsx +19 -0
  10. data/client/skr/components/CustomerFinder.cjsx +37 -0
  11. data/client/skr/components/CustomerLink.cjsx +13 -0
  12. data/client/skr/components/CustomerProjectFinder.cjsx +49 -0
  13. data/client/skr/components/GlAccountChooser.cjsx +38 -0
  14. data/client/skr/components/InvoiceFinder.cjsx +37 -0
  15. data/client/skr/components/InvoiceLink.cjsx +13 -0
  16. data/client/skr/components/LocationChooser.cjsx +37 -0
  17. data/client/skr/components/PaymentCategoryFinder.cjsx +34 -0
  18. data/client/skr/components/PrintFormChooser.cjsx +29 -0
  19. data/client/skr/components/SalesOrderFinder.cjsx +38 -0
  20. data/client/skr/components/ScreenControls.cjsx +20 -0
  21. data/client/skr/components/SkuFinder.cjsx +30 -0
  22. data/client/skr/components/SkuLines.cjsx +76 -0
  23. data/client/skr/components/SystemSettings.cjsx +26 -0
  24. data/client/skr/components/TermsChooser.cjsx +40 -0
  25. data/client/skr/components/ToolbarButton.cjsx +7 -0
  26. data/client/skr/components/TotalsLine.cjsx +21 -0
  27. data/client/skr/components/TriStateIcon.cjsx +12 -0
  28. data/client/skr/components/UOMChooser.cjsx +24 -0
  29. data/client/skr/components/UserPreferences.cjsx +30 -0
  30. data/client/skr/components/VendorFinder.cjsx +40 -0
  31. data/client/skr/components/address/Address.cjsx +10 -10
  32. data/client/skr/components/styles.scss +16 -0
  33. data/client/skr/index.js +3 -1
  34. data/client/skr/models/Address.coffee +9 -1
  35. data/client/skr/models/BankAccount.coffee +17 -0
  36. data/client/skr/models/Base.coffee +6 -0
  37. data/client/skr/models/Customer.coffee +17 -10
  38. data/client/skr/models/CustomerProject.coffee +29 -0
  39. data/client/skr/models/GlAccount.coffee +22 -10
  40. data/client/skr/models/GlManualEntry.coffee +4 -2
  41. data/client/skr/models/GlPeriod.coffee +4 -6
  42. data/client/skr/models/GlPosting.coffee +7 -7
  43. data/client/skr/models/GlTransaction.coffee +3 -3
  44. data/client/skr/models/IaLine.coffee +9 -9
  45. data/client/skr/models/IaReason.coffee +4 -4
  46. data/client/skr/models/InvLine.coffee +30 -11
  47. data/client/skr/models/InventoryAdjustment.coffee +8 -6
  48. data/client/skr/models/Invoice.coffee +89 -18
  49. data/client/skr/models/Location.coffee +27 -6
  50. data/client/skr/models/Payment.coffee +36 -0
  51. data/client/skr/models/PaymentCategory.coffee +12 -0
  52. data/client/skr/models/PaymentTerm.coffee +17 -4
  53. data/client/skr/models/PickTicket.coffee +7 -5
  54. data/client/skr/models/PoLine.coffee +15 -15
  55. data/client/skr/models/PoReceipt.coffee +8 -6
  56. data/client/skr/models/PorLine.coffee +11 -11
  57. data/client/skr/models/PricingProvider.coffee +6 -0
  58. data/client/skr/models/PtLine.coffee +13 -13
  59. data/client/skr/models/PurchaseOrder.coffee +11 -9
  60. data/client/skr/models/SalesOrder.coffee +59 -22
  61. data/client/skr/models/Sku.coffee +17 -15
  62. data/client/skr/models/SkuLoc.coffee +14 -9
  63. data/client/skr/models/SkuTran.coffee +10 -10
  64. data/client/skr/models/SkuVendor.coffee +9 -9
  65. data/client/skr/models/SoLine.coffee +27 -20
  66. data/client/skr/models/TimeEntry.coffee +75 -0
  67. data/client/skr/models/Uom.coffee +27 -6
  68. data/client/skr/models/Vendor.coffee +14 -12
  69. data/client/skr/models/VoLine.coffee +11 -11
  70. data/client/skr/models/Voucher.coffee +7 -5
  71. data/client/skr/models/mixins/HasVisibleId.coffee +7 -0
  72. data/client/skr/models/mixins/PrintSupport.coffee +6 -0
  73. data/client/skr/models/mixins/SkuLine.coffee +61 -0
  74. data/client/skr/screens/Commands.coffee +29 -0
  75. data/client/skr/screens/bank-maint/BankMaint.cjsx +43 -0
  76. data/client/skr/screens/bank-maint/index.js +5 -0
  77. data/client/skr/screens/chart-of-accounts/ChartOfAccounts.cjsx +40 -0
  78. data/client/skr/screens/chart-of-accounts/index.js +1 -0
  79. data/client/skr/screens/chart-of-accounts/index.scss +12 -0
  80. data/client/skr/screens/customer-maint/CustomerMaint.cjsx +35 -36
  81. data/client/skr/screens/customer-projects/CustomerProjects.cjsx +70 -0
  82. data/client/skr/screens/customer-projects/index.js +5 -0
  83. data/client/skr/screens/customer-projects/index.scss +25 -0
  84. data/client/skr/screens/fresh-books-import/ApiInfo.cjsx +35 -0
  85. data/client/skr/screens/fresh-books-import/ChooseRecords.cjsx +116 -0
  86. data/client/skr/screens/fresh-books-import/FreshBooksImport.cjsx +31 -0
  87. data/client/skr/screens/fresh-books-import/Import.coffee +52 -0
  88. data/client/skr/screens/fresh-books-import/ViewRecords.cjsx +96 -0
  89. data/client/skr/screens/fresh-books-import/index.js +1 -0
  90. data/client/skr/screens/fresh-books-import/index.scss +39 -0
  91. data/client/skr/screens/gl-accounts/GlAccounts.cjsx +31 -0
  92. data/client/skr/screens/gl-accounts/index.js +5 -0
  93. data/client/skr/screens/gl-transactions/GlTransactions.cjsx +46 -0
  94. data/client/skr/screens/gl-transactions/index.js +1 -0
  95. data/client/skr/screens/gl-transactions/index.scss +12 -0
  96. data/client/skr/screens/invoice/Invoice.cjsx +92 -0
  97. data/client/skr/screens/invoice/Payment.cjsx +28 -0
  98. data/client/skr/screens/invoice/index.js +5 -0
  99. data/client/skr/screens/locations/Locations.cjsx +31 -0
  100. data/client/skr/screens/locations/index.js +5 -0
  101. data/client/skr/screens/payment-category/PaymentCategory.cjsx +28 -0
  102. data/client/skr/screens/payment-category/index.js +5 -0
  103. data/client/skr/screens/payment-category/index.scss +9 -0
  104. data/client/skr/screens/payment-terms/PaymentTerms.cjsx +28 -0
  105. data/client/skr/screens/payment-terms/index.js +5 -0
  106. data/client/skr/screens/payment-terms/index.scss +9 -0
  107. data/client/skr/screens/payments/Payments.cjsx +59 -0
  108. data/client/skr/screens/payments/index.js +5 -0
  109. data/client/skr/screens/sales-order/SalesOrder.cjsx +68 -0
  110. data/client/skr/screens/sales-order/index.js +1 -5
  111. data/client/skr/screens/sku-maint/SkuMaint.cjsx +53 -0
  112. data/client/skr/screens/sku-maint/SkuUomList.cjsx +209 -0
  113. data/client/skr/screens/sku-maint/index.js +2 -5
  114. data/client/skr/screens/sku-maint/index.scss +37 -6
  115. data/client/skr/screens/time-invoicing/TimeInvoicing.cjsx +156 -0
  116. data/client/skr/screens/time-invoicing/index.js +5 -0
  117. data/client/skr/screens/time-invoicing/index.scss +7 -0
  118. data/client/skr/screens/time-tracking/EditEntry.cjsx +54 -0
  119. data/client/skr/screens/time-tracking/Entries.coffee +132 -0
  120. data/client/skr/screens/time-tracking/Header.cjsx +71 -0
  121. data/client/skr/screens/time-tracking/Popover.cjsx +70 -0
  122. data/client/skr/screens/time-tracking/PopoverMiniControls.cjsx +25 -0
  123. data/client/skr/screens/time-tracking/TimeTracking.cjsx +63 -0
  124. data/client/skr/screens/time-tracking/WeekSummary.cjsx +16 -0
  125. data/client/skr/screens/time-tracking/index.js +1 -0
  126. data/client/skr/screens/time-tracking/index.scss +126 -0
  127. data/client/skr/screens/vendor-maint/VendorMaint.cjsx +45 -0
  128. data/client/skr/screens/vendor-maint/index.js +1 -5
  129. data/client/skr/styles.scss +1 -13
  130. data/config/puma.rb +4 -0
  131. data/config/routes.rb +21 -9
  132. data/config/screens.rb +147 -32
  133. data/db/migrate/20140202194700_create_skr_gl_transaction_details.rb +35 -0
  134. data/db/migrate/20140220031800_create_skr_locations.rb +2 -0
  135. data/db/migrate/20140220190836_create_skr_vendors.rb +1 -0
  136. data/db/migrate/20140220203029_create_skr_customers.rb +3 -2
  137. data/db/migrate/20140224034759_create_skr_skus.rb +2 -3
  138. data/db/migrate/20140322223912_create_skr_sales_orders.rb +4 -3
  139. data/db/migrate/20140322223920_create_skr_so_lines.rb +4 -5
  140. data/db/migrate/20140323001446_create_so_details_view.rb +7 -5
  141. data/db/migrate/20140327202209_create_skr_pt_lines.rb +2 -2
  142. data/db/migrate/20140327214000_create_customer_project.rb +16 -0
  143. data/db/migrate/20140327223002_create_time_entries.rb +17 -0
  144. data/db/migrate/20140327224000_create_skr_invoices.rb +5 -1
  145. data/db/migrate/20140327224002_create_skr_inv_lines.rb +3 -1
  146. data/db/migrate/20140422024010_create_skr_inv_details_view.rb +1 -1
  147. data/db/migrate/20151121211323_create_customer_project_details_views.rb +31 -0
  148. data/db/migrate/20160216142845_create_gl_account_balances_view.rb +20 -0
  149. data/db/migrate/20160229002044_create_bank_accounts.rb +18 -0
  150. data/db/migrate/20160229041711_create_payments.rb +33 -0
  151. data/db/migrate/20160307022705_create_create_combined_uom_views.rb +18 -0
  152. data/db/schema.sql +639 -140
  153. data/db/seed/chart_of_accounts.yml +8 -6
  154. data/db/seed/payment_categories.yml +12 -0
  155. data/db/seed/skus.yml +32 -0
  156. data/db/seed.rb +21 -0
  157. data/lib/skr/access_roles.rb +19 -6
  158. data/lib/skr/concerns/has_sku_loc_lines.rb +0 -16
  159. data/lib/skr/concerns/inv_extensions.rb +24 -0
  160. data/lib/skr/concerns/is_sku_loc_line.rb +3 -4
  161. data/lib/skr/concerns/so_extensions.rb +8 -0
  162. data/lib/skr/concerns/visible_id_identifier.rb +1 -1
  163. data/lib/skr/db/migration_helpers.rb +2 -4
  164. data/lib/skr/extension.rb +11 -4
  165. data/lib/skr/handlers/fresh_books_import.rb +20 -0
  166. data/lib/skr/handlers/invoice_from_time_entries.rb +49 -0
  167. data/lib/skr/jobs/fresh_books/base.rb +54 -0
  168. data/lib/skr/jobs/fresh_books/import.rb +151 -0
  169. data/lib/skr/jobs/fresh_books/retrieve.rb +62 -0
  170. data/lib/skr/model.rb +5 -0
  171. data/lib/skr/models/address.rb +1 -1
  172. data/lib/skr/models/bank_account.rb +13 -0
  173. data/lib/skr/models/business_entity.rb +3 -0
  174. data/lib/skr/models/customer.rb +1 -1
  175. data/lib/skr/models/customer_project.rb +22 -0
  176. data/lib/skr/models/gl_account.rb +13 -3
  177. data/lib/skr/models/gl_period.rb +6 -0
  178. data/lib/skr/models/gl_posting.rb +7 -4
  179. data/lib/skr/models/gl_transaction.rb +19 -33
  180. data/lib/skr/models/ia_line.rb +1 -1
  181. data/lib/skr/models/inv_line.rb +33 -15
  182. data/lib/skr/models/invoice.rb +47 -20
  183. data/lib/skr/models/location.rb +7 -1
  184. data/lib/skr/models/payment.rb +49 -0
  185. data/lib/skr/models/payment_category.rb +11 -0
  186. data/lib/skr/models/payment_term.rb +1 -1
  187. data/lib/skr/models/por_line.rb +1 -1
  188. data/lib/skr/models/pt_line.rb +1 -1
  189. data/lib/skr/models/sales_order.rb +9 -9
  190. data/lib/skr/models/sku_loc.rb +1 -1
  191. data/lib/skr/models/sku_tran.rb +6 -11
  192. data/lib/skr/models/so_line.rb +22 -12
  193. data/lib/skr/models/time_entry.rb +36 -0
  194. data/lib/skr/models/uom.rb +11 -10
  195. data/lib/skr/models/user_proxy.rb +1 -1
  196. data/lib/skr/number.rb +25 -0
  197. data/lib/skr/print/form.rb +46 -0
  198. data/lib/skr/print/template.rb +48 -0
  199. data/lib/skr/print.rb +11 -0
  200. data/lib/skr/string.rb +11 -0
  201. data/lib/skr/version.rb +1 -1
  202. data/lib/skr.rb +9 -0
  203. data/spec/fixtures/skr/address.yml +164 -4
  204. data/spec/fixtures/skr/bank_account.yml +8 -0
  205. data/spec/fixtures/skr/customer.yml +30 -4
  206. data/spec/fixtures/skr/customer_project.yml +20 -0
  207. data/spec/fixtures/skr/gl_account.yml +19 -1
  208. data/spec/fixtures/skr/gl_period.yml +3 -0
  209. data/spec/fixtures/skr/gl_posting.yml +22 -1
  210. data/spec/fixtures/skr/gl_transaction.yml +4 -1
  211. data/spec/fixtures/skr/inv_line.yml +35 -0
  212. data/spec/fixtures/skr/invoice.yml +13 -2
  213. data/spec/fixtures/skr/location.yml +5 -0
  214. data/spec/fixtures/skr/payment.yml +10 -0
  215. data/spec/fixtures/skr/payment_category.yml +8 -0
  216. data/spec/fixtures/skr/payment_term.yml +37 -3
  217. data/spec/fixtures/skr/sales_order.yml +12 -1
  218. data/spec/fixtures/skr/sku.yml +78 -1
  219. data/spec/fixtures/skr/sku_loc.yml +42 -1
  220. data/spec/fixtures/skr/sku_tran.yml +24 -1
  221. data/spec/fixtures/skr/so_line.yml +32 -0
  222. data/spec/fixtures/skr/time_entry.yml +82 -0
  223. data/spec/fixtures/skr/uom.yml +52 -1
  224. data/spec/fixtures/skr/vendor.yml +28 -1
  225. data/spec/fixtures/stockor.png +0 -0
  226. data/spec/server/bank_account_spec.rb +10 -0
  227. data/spec/server/customer_project_spec.rb +10 -0
  228. data/spec/server/handlers/invoice_from_time_entries_spec.rb +49 -0
  229. data/spec/server/jobs/fresh_books/import_spec.rb +69 -0
  230. data/spec/server/jobs/fresh_books/retrieve_spec.rb +37 -0
  231. data/spec/server/models/address_spec.rb +4 -3
  232. data/spec/server/models/gl_transaction_spec.rb +3 -3
  233. data/spec/server/models/inv_line_spec.rb +83 -3
  234. data/spec/server/models/invoice_spec.rb +32 -3
  235. data/spec/server/models/payment_spec.rb +40 -0
  236. data/spec/server/models/sales_order_spec.rb +1 -1
  237. data/spec/server/models/so_line_spec.rb +3 -3
  238. data/spec/server/models/spec_helper_spec.rb +1 -1
  239. data/spec/server/payment_spec.rb +10 -0
  240. data/spec/server/print/form_spec.rb +47 -0
  241. data/spec/server/print/template_spec.rb +36 -0
  242. data/spec/server/spec_helper.rb +14 -1
  243. data/spec/server/time_entry_spec.rb +10 -0
  244. data/spec/skr/components/SkuLinesSpec.coffee +61 -0
  245. data/spec/skr/models/BankAccountSpec.coffee +5 -0
  246. data/spec/skr/models/CustomerProjectSpec.coffee +5 -0
  247. data/spec/skr/models/CustomerSpec.coffee +2 -2
  248. data/spec/skr/models/PaymentSpec.coffee +5 -0
  249. data/spec/skr/models/SalesOrderSpec.coffee +21 -5
  250. data/spec/skr/models/SoLineSpec.coffee +7 -2
  251. data/spec/skr/models/TimeEntrySpec.coffee +5 -0
  252. data/spec/skr/screens/bank-maint/BankMaintSpec.coffee +5 -0
  253. data/spec/skr/screens/customer-projects/CustomerProjectsSpec.coffee +5 -0
  254. data/spec/skr/screens/fresh-books-import/FreshBooksImportSpec.coffee +1 -0
  255. data/spec/skr/screens/gl-accounts/GlAccountsSpec.coffee +5 -0
  256. data/spec/skr/screens/invoice/InvoiceSpec.coffee +5 -0
  257. data/spec/skr/screens/locations/LocationsSpec.coffee +5 -0
  258. data/spec/skr/screens/payment-category/PaymentCategorySpec.coffee +5 -0
  259. data/spec/skr/screens/payment-terms/PaymentTermsSpec.coffee +5 -0
  260. data/spec/skr/screens/payments/PaymentsSpec.coffee +5 -0
  261. data/spec/skr/screens/time-invoicing/TimeInvoicingSpec.coffee +5 -0
  262. data/spec/skr/screens/time-tracking/TimeTrackingSpec.coffee +14 -0
  263. data/spec/vcr/freshbooks.yml +698 -0
  264. data/stockor.gemspec +5 -1
  265. data/templates/print/fonts/GnuMICR.otf +0 -0
  266. data/templates/print/layout.tex.erb +39 -0
  267. data/templates/print/packages/booktabs.sty +182 -0
  268. data/templates/print/packages/fancybox.sty +966 -0
  269. data/templates/print/packages/fancyhdr.sty +485 -0
  270. data/templates/print/packages/graphbox.sty +129 -0
  271. data/templates/print/packages/lastpage.sty +283 -0
  272. data/templates/print/packages/lastpage209.sty +70 -0
  273. data/templates/print/packages/marginnote.sty +412 -0
  274. data/templates/print/packages/multirow.sty +159 -0
  275. data/templates/print/packages/rotating.sty +282 -0
  276. data/templates/print/packages/tabu.sty +2557 -0
  277. data/templates/print/packages/textpos.sty +361 -0
  278. data/templates/print/packages/varwidth.sty +318 -0
  279. data/templates/print/partials/address.tex.erb +6 -0
  280. data/templates/print/partials/bill_to_ship_to.tex.erb +13 -0
  281. data/templates/print/partials/header.tex.erb +13 -0
  282. data/templates/print/partials/invoice_paid_state.tex.erb +2 -0
  283. data/templates/print/partials/old/inv_lines_grouping.tex.erb +8 -0
  284. data/templates/print/partials/old/labor_lines_footer.tex.erb +18 -0
  285. data/templates/print/partials/skus_table.tex.erb +32 -0
  286. data/templates/print/partials/skus_table_col_hdr.tex.erb +8 -0
  287. data/templates/print/partials/skus_table_footer.tex.erb +5 -0
  288. data/templates/print/partials/skus_table_group_footer.tex.erb +4 -0
  289. data/templates/print/partials/skus_table_invoice_footer.tex.erb +25 -0
  290. data/templates/print/partials/skus_table_invoice_info_line.tex.erb +16 -0
  291. data/templates/print/partials/skus_table_labor_col_hdr.tex.erb +8 -0
  292. data/templates/print/partials/skus_table_labor_group_footer.tex.erb +7 -0
  293. data/templates/print/partials/skus_table_labor_line.tex.erb +11 -0
  294. data/templates/print/partials/skus_table_line.tex.erb +6 -0
  295. data/templates/print/partials/skus_table_other_charge_lines.tex.erb +7 -0
  296. data/templates/print/partials/so_info_line.tex.erb +14 -0
  297. data/templates/print/types/invoice/default.tex.erb +13 -0
  298. data/templates/print/types/invoice/labor.tex.erb +33 -0
  299. data/templates/print/types/payment/default.tex.erb +64 -0
  300. data/templates/print/types/sales-order/default.tex.erb +8 -0
  301. metadata +252 -15
  302. data/client/skr/components/address/address.html +0 -20
  303. data/client/skr/models/mixins/CodeField.coffee +0 -5
  304. data/client/skr/screens/customer-maint/index.scss +0 -11
  305. data/client/skr/screens/customer-maint/layout.html +0 -32
  306. data/client/skr/screens/sales-order/SalesOrder.coffee +0 -30
  307. data/client/skr/screens/sales-order/index.scss +0 -8
  308. data/client/skr/screens/sales-order/layout.html +0 -30
  309. data/client/skr/screens/sku-maint/SkuMaint.coffee +0 -18
  310. data/client/skr/screens/sku-maint/layout.html +0 -16
  311. data/client/skr/screens/vendor-maint/VendorMaint.coffee +0 -28
  312. data/client/skr/screens/vendor-maint/index.scss +0 -8
  313. 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
+ }