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,485 @@
1
+ % fancyhdr.sty version 3.2
2
+ % Fancy headers and footers for LaTeX.
3
+ % Piet van Oostrum,
4
+ % Dept of Computer and Information Sciences, University of Utrecht,
5
+ % Padualaan 14, P.O. Box 80.089, 3508 TB Utrecht, The Netherlands
6
+ % Telephone: +31 30 2532180. Email: piet@cs.uu.nl
7
+ % ========================================================================
8
+ % LICENCE:
9
+ % This file may be distributed under the terms of the LaTeX Project Public
10
+ % License, as described in lppl.txt in the base LaTeX distribution.
11
+ % Either version 1 or, at your option, any later version.
12
+ % ========================================================================
13
+ % MODIFICATION HISTORY:
14
+ % Sep 16, 1994
15
+ % version 1.4: Correction for use with \reversemargin
16
+ % Sep 29, 1994:
17
+ % version 1.5: Added the \iftopfloat, \ifbotfloat and \iffloatpage commands
18
+ % Oct 4, 1994:
19
+ % version 1.6: Reset single spacing in headers/footers for use with
20
+ % setspace.sty or doublespace.sty
21
+ % Oct 4, 1994:
22
+ % version 1.7: changed \let\@mkboth\markboth to
23
+ % \def\@mkboth{\protect\markboth} to make it more robust
24
+ % Dec 5, 1994:
25
+ % version 1.8: corrections for amsbook/amsart: define \@chapapp and (more
26
+ % importantly) use the \chapter/sectionmark definitions from ps@headings if
27
+ % they exist (which should be true for all standard classes).
28
+ % May 31, 1995:
29
+ % version 1.9: The proposed \renewcommand{\headrulewidth}{\iffloatpage...
30
+ % construction in the doc did not work properly with the fancyplain style.
31
+ % June 1, 1995:
32
+ % version 1.91: The definition of \@mkboth wasn't restored on subsequent
33
+ % \pagestyle{fancy}'s.
34
+ % June 1, 1995:
35
+ % version 1.92: The sequence \pagestyle{fancyplain} \pagestyle{plain}
36
+ % \pagestyle{fancy} would erroneously select the plain version.
37
+ % June 1, 1995:
38
+ % version 1.93: \fancypagestyle command added.
39
+ % Dec 11, 1995:
40
+ % version 1.94: suggested by Conrad Hughes <chughes@maths.tcd.ie>
41
+ % CJCH, Dec 11, 1995: added \footruleskip to allow control over footrule
42
+ % position (old hardcoded value of .3\normalbaselineskip is far too high
43
+ % when used with very small footer fonts).
44
+ % Jan 31, 1996:
45
+ % version 1.95: call \@normalsize in the reset code if that is defined,
46
+ % otherwise \normalsize.
47
+ % this is to solve a problem with ucthesis.cls, as this doesn't
48
+ % define \@currsize. Unfortunately for latex209 calling \normalsize doesn't
49
+ % work as this is optimized to do very little, so there \@normalsize should
50
+ % be called. Hopefully this code works for all versions of LaTeX known to
51
+ % mankind.
52
+ % April 25, 1996:
53
+ % version 1.96: initialize \headwidth to a magic (negative) value to catch
54
+ % most common cases that people change it before calling \pagestyle{fancy}.
55
+ % Note it can't be initialized when reading in this file, because
56
+ % \textwidth could be changed afterwards. This is quite probable.
57
+ % We also switch to \MakeUppercase rather than \uppercase and introduce a
58
+ % \nouppercase command for use in headers. and footers.
59
+ % May 3, 1996:
60
+ % version 1.97: Two changes:
61
+ % 1. Undo the change in version 1.8 (using the pagestyle{headings} defaults
62
+ % for the chapter and section marks. The current version of amsbook and
63
+ % amsart classes don't seem to need them anymore. Moreover the standard
64
+ % latex classes don't use \markboth if twoside isn't selected, and this is
65
+ % confusing as \leftmark doesn't work as expected.
66
+ % 2. include a call to \ps@empty in ps@@fancy. This is to solve a problem
67
+ % in the amsbook and amsart classes, that make global changes to \topskip,
68
+ % which are reset in \ps@empty. Hopefully this doesn't break other things.
69
+ % May 7, 1996:
70
+ % version 1.98:
71
+ % Added % after the line \def\nouppercase
72
+ % May 7, 1996:
73
+ % version 1.99: This is the alpha version of fancyhdr 2.0
74
+ % Introduced the new commands \fancyhead, \fancyfoot, and \fancyhf.
75
+ % Changed \headrulewidth, \footrulewidth, \footruleskip to
76
+ % macros rather than length parameters, In this way they can be
77
+ % conditionalized and they don't consume length registers. There is no need
78
+ % to have them as length registers unless you want to do calculations with
79
+ % them, which is unlikely. Note that this may make some uses of them
80
+ % incompatible (i.e. if you have a file that uses \setlength or \xxxx=)
81
+ % May 10, 1996:
82
+ % version 1.99a:
83
+ % Added a few more % signs
84
+ % May 10, 1996:
85
+ % version 1.99b:
86
+ % Changed the syntax of \f@nfor to be resistent to catcode changes of :=
87
+ % Removed the [1] from the defs of \lhead etc. because the parameter is
88
+ % consumed by the \@[xy]lhead etc. macros.
89
+ % June 24, 1997:
90
+ % version 1.99c:
91
+ % corrected \nouppercase to also include the protected form of \MakeUppercase
92
+ % \global added to manipulation of \headwidth.
93
+ % \iffootnote command added.
94
+ % Some comments added about \@fancyhead and \@fancyfoot.
95
+ % Aug 24, 1998
96
+ % version 1.99d
97
+ % Changed the default \ps@empty to \ps@@empty in order to allow
98
+ % \fancypagestyle{empty} redefinition.
99
+ % Oct 11, 2000
100
+ % version 2.0
101
+ % Added LPPL license clause.
102
+ %
103
+ % A check for \headheight is added. An errormessage is given (once) if the
104
+ % header is too large. Empty headers don't generate the error even if
105
+ % \headheight is very small or even 0pt.
106
+ % Warning added for the use of 'E' option when twoside option is not used.
107
+ % In this case the 'E' fields will never be used.
108
+ %
109
+ % Mar 10, 2002
110
+ % version 2.1beta
111
+ % New command: \fancyhfoffset[place]{length}
112
+ % defines offsets to be applied to the header/footer to let it stick into
113
+ % the margins (if length > 0).
114
+ % place is like in fancyhead, except that only E,O,L,R can be used.
115
+ % This replaces the old calculation based on \headwidth and the marginpar
116
+ % area.
117
+ % \headwidth will be dynamically calculated in the headers/footers when
118
+ % this is used.
119
+ %
120
+ % Mar 26, 2002
121
+ % version 2.1beta2
122
+ % \fancyhfoffset now also takes h,f as possible letters in the argument to
123
+ % allow the header and footer widths to be different.
124
+ % New commands \fancyheadoffset and \fancyfootoffset added comparable to
125
+ % \fancyhead and \fancyfoot.
126
+ % Errormessages and warnings have been made more informative.
127
+ %
128
+ % Dec 9, 2002
129
+ % version 2.1
130
+ % The defaults for \footrulewidth, \plainheadrulewidth and
131
+ % \plainfootrulewidth are changed from \z@skip to 0pt. In this way when
132
+ % someone inadvertantly uses \setlength to change any of these, the value
133
+ % of \z@skip will not be changed, rather an errormessage will be given.
134
+
135
+ % March 3, 2004
136
+ % Release of version 3.0
137
+
138
+ % Oct 7, 2004
139
+ % version 3.1
140
+ % Added '\endlinechar=13' to \fancy@reset to prevent problems with
141
+ % includegraphics in header when verbatiminput is active.
142
+
143
+ % March 22, 2005
144
+ % version 3.2
145
+ % reset \everypar (the real one) in \fancy@reset because spanish.ldf does
146
+ % strange things with \everypar between << and >>.
147
+
148
+ \def\ifancy@mpty#1{\def\temp@a{#1}\ifx\temp@a\@empty}
149
+
150
+ \def\fancy@def#1#2{\ifancy@mpty{#2}\fancy@gbl\def#1{\leavevmode}\else
151
+ \fancy@gbl\def#1{#2\strut}\fi}
152
+
153
+ \let\fancy@gbl\global
154
+
155
+ \def\@fancyerrmsg#1{%
156
+ \ifx\PackageError\undefined
157
+ \errmessage{#1}\else
158
+ \PackageError{Fancyhdr}{#1}{}\fi}
159
+ \def\@fancywarning#1{%
160
+ \ifx\PackageWarning\undefined
161
+ \errmessage{#1}\else
162
+ \PackageWarning{Fancyhdr}{#1}{}\fi}
163
+
164
+ % Usage: \@forc \var{charstring}{command to be executed for each char}
165
+ % This is similar to LaTeX's \@tfor, but expands the charstring.
166
+
167
+ \def\@forc#1#2#3{\expandafter\f@rc\expandafter#1\expandafter{#2}{#3}}
168
+ \def\f@rc#1#2#3{\def\temp@ty{#2}\ifx\@empty\temp@ty\else
169
+ \f@@rc#1#2\f@@rc{#3}\fi}
170
+ \def\f@@rc#1#2#3\f@@rc#4{\def#1{#2}#4\f@rc#1{#3}{#4}}
171
+
172
+ % Usage: \f@nfor\name:=list\do{body}
173
+ % Like LaTeX's \@for but an empty list is treated as a list with an empty
174
+ % element
175
+
176
+ \newcommand{\f@nfor}[3]{\edef\@fortmp{#2}%
177
+ \expandafter\@forloop#2,\@nil,\@nil\@@#1{#3}}
178
+
179
+ % Usage: \def@ult \cs{defaults}{argument}
180
+ % sets \cs to the characters from defaults appearing in argument
181
+ % or defaults if it would be empty. All characters are lowercased.
182
+
183
+ \newcommand\def@ult[3]{%
184
+ \edef\temp@a{\lowercase{\edef\noexpand\temp@a{#3}}}\temp@a
185
+ \def#1{}%
186
+ \@forc\tmpf@ra{#2}%
187
+ {\expandafter\if@in\tmpf@ra\temp@a{\edef#1{#1\tmpf@ra}}{}}%
188
+ \ifx\@empty#1\def#1{#2}\fi}
189
+ %
190
+ % \if@in <char><set><truecase><falsecase>
191
+ %
192
+ \newcommand{\if@in}[4]{%
193
+ \edef\temp@a{#2}\def\temp@b##1#1##2\temp@b{\def\temp@b{##1}}%
194
+ \expandafter\temp@b#2#1\temp@b\ifx\temp@a\temp@b #4\else #3\fi}
195
+
196
+ \newcommand{\fancyhead}{\@ifnextchar[{\f@ncyhf\fancyhead h}%
197
+ {\f@ncyhf\fancyhead h[]}}
198
+ \newcommand{\fancyfoot}{\@ifnextchar[{\f@ncyhf\fancyfoot f}%
199
+ {\f@ncyhf\fancyfoot f[]}}
200
+ \newcommand{\fancyhf}{\@ifnextchar[{\f@ncyhf\fancyhf{}}%
201
+ {\f@ncyhf\fancyhf{}[]}}
202
+
203
+ % New commands for offsets added
204
+
205
+ \newcommand{\fancyheadoffset}{\@ifnextchar[{\f@ncyhfoffs\fancyheadoffset h}%
206
+ {\f@ncyhfoffs\fancyheadoffset h[]}}
207
+ \newcommand{\fancyfootoffset}{\@ifnextchar[{\f@ncyhfoffs\fancyfootoffset f}%
208
+ {\f@ncyhfoffs\fancyfootoffset f[]}}
209
+ \newcommand{\fancyhfoffset}{\@ifnextchar[{\f@ncyhfoffs\fancyhfoffset{}}%
210
+ {\f@ncyhfoffs\fancyhfoffset{}[]}}
211
+
212
+ % The header and footer fields are stored in command sequences with
213
+ % names of the form: \f@ncy<x><y><z> with <x> for [eo], <y> from [lcr]
214
+ % and <z> from [hf].
215
+
216
+ \def\f@ncyhf#1#2[#3]#4{%
217
+ \def\temp@c{}%
218
+ \@forc\tmpf@ra{#3}%
219
+ {\expandafter\if@in\tmpf@ra{eolcrhf,EOLCRHF}%
220
+ {}{\edef\temp@c{\temp@c\tmpf@ra}}}%
221
+ \ifx\@empty\temp@c\else
222
+ \@fancyerrmsg{Illegal char `\temp@c' in \string#1 argument:
223
+ [#3]}%
224
+ \fi
225
+ \f@nfor\temp@c{#3}%
226
+ {\def@ult\f@@@eo{eo}\temp@c
227
+ \if@twoside\else
228
+ \if\f@@@eo e\@fancywarning
229
+ {\string#1's `E' option without twoside option is useless}\fi\fi
230
+ \def@ult\f@@@lcr{lcr}\temp@c
231
+ \def@ult\f@@@hf{hf}{#2\temp@c}%
232
+ \@forc\f@@eo\f@@@eo
233
+ {\@forc\f@@lcr\f@@@lcr
234
+ {\@forc\f@@hf\f@@@hf
235
+ {\expandafter\fancy@def\csname
236
+ f@ncy\f@@eo\f@@lcr\f@@hf\endcsname
237
+ {#4}}}}}}
238
+
239
+ \def\f@ncyhfoffs#1#2[#3]#4{%
240
+ \def\temp@c{}%
241
+ \@forc\tmpf@ra{#3}%
242
+ {\expandafter\if@in\tmpf@ra{eolrhf,EOLRHF}%
243
+ {}{\edef\temp@c{\temp@c\tmpf@ra}}}%
244
+ \ifx\@empty\temp@c\else
245
+ \@fancyerrmsg{Illegal char `\temp@c' in \string#1 argument:
246
+ [#3]}%
247
+ \fi
248
+ \f@nfor\temp@c{#3}%
249
+ {\def@ult\f@@@eo{eo}\temp@c
250
+ \if@twoside\else
251
+ \if\f@@@eo e\@fancywarning
252
+ {\string#1's `E' option without twoside option is useless}\fi\fi
253
+ \def@ult\f@@@lcr{lr}\temp@c
254
+ \def@ult\f@@@hf{hf}{#2\temp@c}%
255
+ \@forc\f@@eo\f@@@eo
256
+ {\@forc\f@@lcr\f@@@lcr
257
+ {\@forc\f@@hf\f@@@hf
258
+ {\expandafter\setlength\csname
259
+ f@ncyO@\f@@eo\f@@lcr\f@@hf\endcsname
260
+ {#4}}}}}%
261
+ \fancy@setoffs}
262
+
263
+ % Fancyheadings version 1 commands. These are more or less deprecated,
264
+ % but they continue to work.
265
+
266
+ \newcommand{\lhead}{\@ifnextchar[{\@xlhead}{\@ylhead}}
267
+ \def\@xlhead[#1]#2{\fancy@def\f@ncyelh{#1}\fancy@def\f@ncyolh{#2}}
268
+ \def\@ylhead#1{\fancy@def\f@ncyelh{#1}\fancy@def\f@ncyolh{#1}}
269
+
270
+ \newcommand{\chead}{\@ifnextchar[{\@xchead}{\@ychead}}
271
+ \def\@xchead[#1]#2{\fancy@def\f@ncyech{#1}\fancy@def\f@ncyoch{#2}}
272
+ \def\@ychead#1{\fancy@def\f@ncyech{#1}\fancy@def\f@ncyoch{#1}}
273
+
274
+ \newcommand{\rhead}{\@ifnextchar[{\@xrhead}{\@yrhead}}
275
+ \def\@xrhead[#1]#2{\fancy@def\f@ncyerh{#1}\fancy@def\f@ncyorh{#2}}
276
+ \def\@yrhead#1{\fancy@def\f@ncyerh{#1}\fancy@def\f@ncyorh{#1}}
277
+
278
+ \newcommand{\lfoot}{\@ifnextchar[{\@xlfoot}{\@ylfoot}}
279
+ \def\@xlfoot[#1]#2{\fancy@def\f@ncyelf{#1}\fancy@def\f@ncyolf{#2}}
280
+ \def\@ylfoot#1{\fancy@def\f@ncyelf{#1}\fancy@def\f@ncyolf{#1}}
281
+
282
+ \newcommand{\cfoot}{\@ifnextchar[{\@xcfoot}{\@ycfoot}}
283
+ \def\@xcfoot[#1]#2{\fancy@def\f@ncyecf{#1}\fancy@def\f@ncyocf{#2}}
284
+ \def\@ycfoot#1{\fancy@def\f@ncyecf{#1}\fancy@def\f@ncyocf{#1}}
285
+
286
+ \newcommand{\rfoot}{\@ifnextchar[{\@xrfoot}{\@yrfoot}}
287
+ \def\@xrfoot[#1]#2{\fancy@def\f@ncyerf{#1}\fancy@def\f@ncyorf{#2}}
288
+ \def\@yrfoot#1{\fancy@def\f@ncyerf{#1}\fancy@def\f@ncyorf{#1}}
289
+
290
+ \newlength{\fancy@headwidth}
291
+ \let\headwidth\fancy@headwidth
292
+ \newlength{\f@ncyO@elh}
293
+ \newlength{\f@ncyO@erh}
294
+ \newlength{\f@ncyO@olh}
295
+ \newlength{\f@ncyO@orh}
296
+ \newlength{\f@ncyO@elf}
297
+ \newlength{\f@ncyO@erf}
298
+ \newlength{\f@ncyO@olf}
299
+ \newlength{\f@ncyO@orf}
300
+ \newcommand{\headrulewidth}{0.4pt}
301
+ \newcommand{\footrulewidth}{0pt}
302
+ \newcommand{\footruleskip}{.3\normalbaselineskip}
303
+
304
+ % Fancyplain stuff shouldn't be used anymore (rather
305
+ % \fancypagestyle{plain} should be used), but it must be present for
306
+ % compatibility reasons.
307
+
308
+ \newcommand{\plainheadrulewidth}{0pt}
309
+ \newcommand{\plainfootrulewidth}{0pt}
310
+ \newif\if@fancyplain \@fancyplainfalse
311
+ \def\fancyplain#1#2{\if@fancyplain#1\else#2\fi}
312
+
313
+ \headwidth=-123456789sp %magic constant
314
+
315
+ % Command to reset various things in the headers:
316
+ % a.o. single spacing (taken from setspace.sty)
317
+ % and the catcode of ^^M (so that epsf files in the header work if a
318
+ % verbatim crosses a page boundary)
319
+ % It also defines a \nouppercase command that disables \uppercase and
320
+ % \Makeuppercase. It can only be used in the headers and footers.
321
+ \let\fnch@everypar\everypar% save real \everypar because of spanish.ldf
322
+ \def\fancy@reset{\fnch@everypar{}\restorecr\endlinechar=13
323
+ \def\baselinestretch{1}%
324
+ \def\nouppercase##1{{\let\uppercase\relax\let\MakeUppercase\relax
325
+ \expandafter\let\csname MakeUppercase \endcsname\relax##1}}%
326
+ \ifx\undefined\@newbaseline% NFSS not present; 2.09 or 2e
327
+ \ifx\@normalsize\undefined \normalsize % for ucthesis.cls
328
+ \else \@normalsize \fi
329
+ \else% NFSS (2.09) present
330
+ \@newbaseline%
331
+ \fi}
332
+
333
+ % Initialization of the head and foot text.
334
+
335
+ % The default values still contain \fancyplain for compatibility.
336
+ \fancyhf{} % clear all
337
+ % lefthead empty on ``plain'' pages, \rightmark on even, \leftmark on odd pages
338
+ % evenhead empty on ``plain'' pages, \leftmark on even, \rightmark on odd pages
339
+ \if@twoside
340
+ \fancyhead[el,or]{\fancyplain{}{\sl\rightmark}}
341
+ \fancyhead[er,ol]{\fancyplain{}{\sl\leftmark}}
342
+ \else
343
+ \fancyhead[l]{\fancyplain{}{\sl\rightmark}}
344
+ \fancyhead[r]{\fancyplain{}{\sl\leftmark}}
345
+ \fi
346
+ \fancyfoot[c]{\rm\thepage} % page number
347
+
348
+ % Use box 0 as a temp box and dimen 0 as temp dimen.
349
+ % This can be done, because this code will always
350
+ % be used inside another box, and therefore the changes are local.
351
+
352
+ \def\@fancyvbox#1#2{\setbox0\vbox{#2}\ifdim\ht0>#1\@fancywarning
353
+ {\string#1 is too small (\the#1): ^^J Make it at least \the\ht0.^^J
354
+ We now make it that large for the rest of the document.^^J
355
+ This may cause the page layout to be inconsistent, however\@gobble}%
356
+ \dimen0=#1\global\setlength{#1}{\ht0}\ht0=\dimen0\fi
357
+ \box0}
358
+
359
+ % Put together a header or footer given the left, center and
360
+ % right text, fillers at left and right and a rule.
361
+ % The \lap commands put the text into an hbox of zero size,
362
+ % so overlapping text does not generate an errormessage.
363
+ % These macros have 5 parameters:
364
+ % 1. LEFTSIDE BEARING % This determines at which side the header will stick
365
+ % out. When \fancyhfoffset is used this calculates \headwidth, otherwise
366
+ % it is \hss or \relax (after expansion).
367
+ % 2. \f@ncyolh, \f@ncyelh, \f@ncyolf or \f@ncyelf. This is the left component.
368
+ % 3. \f@ncyoch, \f@ncyech, \f@ncyocf or \f@ncyecf. This is the middle comp.
369
+ % 4. \f@ncyorh, \f@ncyerh, \f@ncyorf or \f@ncyerf. This is the right component.
370
+ % 5. RIGHTSIDE BEARING. This is always \relax or \hss (after expansion).
371
+
372
+ \def\@fancyhead#1#2#3#4#5{#1\hbox to\headwidth{\fancy@reset
373
+ \@fancyvbox\headheight{\hbox
374
+ {\rlap{\parbox[b]{\headwidth}{\raggedright#2}}\hfill
375
+ \parbox[b]{\headwidth}{\centering#3}\hfill
376
+ \llap{\parbox[b]{\headwidth}{\raggedleft#4}}}\headrule}}#5}
377
+
378
+ \def\@fancyfoot#1#2#3#4#5{#1\hbox to\headwidth{\fancy@reset
379
+ \@fancyvbox\footskip{\footrule
380
+ \hbox{\rlap{\parbox[t]{\headwidth}{\raggedright#2}}\hfill
381
+ \parbox[t]{\headwidth}{\centering#3}\hfill
382
+ \llap{\parbox[t]{\headwidth}{\raggedleft#4}}}}}#5}
383
+
384
+ \def\headrule{{\if@fancyplain\let\headrulewidth\plainheadrulewidth\fi
385
+ \hrule\@height\headrulewidth\@width\headwidth \vskip-\headrulewidth}}
386
+
387
+ \def\footrule{{\if@fancyplain\let\footrulewidth\plainfootrulewidth\fi
388
+ \vskip-\footruleskip\vskip-\footrulewidth
389
+ \hrule\@width\headwidth\@height\footrulewidth\vskip\footruleskip}}
390
+
391
+ \def\ps@fancy{%
392
+ \@ifundefined{@chapapp}{\let\@chapapp\chaptername}{}%for amsbook
393
+ %
394
+ % Define \MakeUppercase for old LaTeXen.
395
+ % Note: we used \def rather than \let, so that \let\uppercase\relax (from
396
+ % the version 1 documentation) will still work.
397
+ %
398
+ \@ifundefined{MakeUppercase}{\def\MakeUppercase{\uppercase}}{}%
399
+ \@ifundefined{chapter}{\def\sectionmark##1{\markboth
400
+ {\MakeUppercase{\ifnum \c@secnumdepth>\z@
401
+ \thesection\hskip 1em\relax \fi ##1}}{}}%
402
+ \def\subsectionmark##1{\markright {\ifnum \c@secnumdepth >\@ne
403
+ \thesubsection\hskip 1em\relax \fi ##1}}}%
404
+ {\def\chaptermark##1{\markboth {\MakeUppercase{\ifnum \c@secnumdepth>\m@ne
405
+ \@chapapp\ \thechapter. \ \fi ##1}}{}}%
406
+ \def\sectionmark##1{\markright{\MakeUppercase{\ifnum \c@secnumdepth >\z@
407
+ \thesection. \ \fi ##1}}}}%
408
+ %\csname ps@headings\endcsname % use \ps@headings defaults if they exist
409
+ \ps@@fancy
410
+ \gdef\ps@fancy{\@fancyplainfalse\ps@@fancy}%
411
+ % Initialize \headwidth if the user didn't
412
+ %
413
+ \ifdim\headwidth<0sp
414
+ %
415
+ % This catches the case that \headwidth hasn't been initialized and the
416
+ % case that the user added something to \headwidth in the expectation that
417
+ % it was initialized to \textwidth. We compensate this now. This loses if
418
+ % the user intended to multiply it by a factor. But that case is more
419
+ % likely done by saying something like \headwidth=1.2\textwidth.
420
+ % The doc says you have to change \headwidth after the first call to
421
+ % \pagestyle{fancy}. This code is just to catch the most common cases were
422
+ % that requirement is violated.
423
+ %
424
+ \global\advance\headwidth123456789sp\global\advance\headwidth\textwidth
425
+ \fi}
426
+ \def\ps@fancyplain{\ps@fancy \let\ps@plain\ps@plain@fancy}
427
+ \def\ps@plain@fancy{\@fancyplaintrue\ps@@fancy}
428
+ \let\ps@@empty\ps@empty
429
+ \def\ps@@fancy{%
430
+ \ps@@empty % This is for amsbook/amsart, which do strange things with \topskip
431
+ \def\@mkboth{\protect\markboth}%
432
+ \def\@oddhead{\@fancyhead\fancy@Oolh\f@ncyolh\f@ncyoch\f@ncyorh\fancy@Oorh}%
433
+ \def\@oddfoot{\@fancyfoot\fancy@Oolf\f@ncyolf\f@ncyocf\f@ncyorf\fancy@Oorf}%
434
+ \def\@evenhead{\@fancyhead\fancy@Oelh\f@ncyelh\f@ncyech\f@ncyerh\fancy@Oerh}%
435
+ \def\@evenfoot{\@fancyfoot\fancy@Oelf\f@ncyelf\f@ncyecf\f@ncyerf\fancy@Oerf}%
436
+ }
437
+ % Default definitions for compatibility mode:
438
+ % These cause the header/footer to take the defined \headwidth as width
439
+ % And to shift in the direction of the marginpar area
440
+
441
+ \def\fancy@Oolh{\if@reversemargin\hss\else\relax\fi}
442
+ \def\fancy@Oorh{\if@reversemargin\relax\else\hss\fi}
443
+ \let\fancy@Oelh\fancy@Oorh
444
+ \let\fancy@Oerh\fancy@Oolh
445
+
446
+ \let\fancy@Oolf\fancy@Oolh
447
+ \let\fancy@Oorf\fancy@Oorh
448
+ \let\fancy@Oelf\fancy@Oelh
449
+ \let\fancy@Oerf\fancy@Oerh
450
+
451
+ % New definitions for the use of \fancyhfoffset
452
+ % These calculate the \headwidth from \textwidth and the specified offsets.
453
+
454
+ \def\fancy@offsolh{\headwidth=\textwidth\advance\headwidth\f@ncyO@olh
455
+ \advance\headwidth\f@ncyO@orh\hskip-\f@ncyO@olh}
456
+ \def\fancy@offselh{\headwidth=\textwidth\advance\headwidth\f@ncyO@elh
457
+ \advance\headwidth\f@ncyO@erh\hskip-\f@ncyO@elh}
458
+
459
+ \def\fancy@offsolf{\headwidth=\textwidth\advance\headwidth\f@ncyO@olf
460
+ \advance\headwidth\f@ncyO@orf\hskip-\f@ncyO@olf}
461
+ \def\fancy@offself{\headwidth=\textwidth\advance\headwidth\f@ncyO@elf
462
+ \advance\headwidth\f@ncyO@erf\hskip-\f@ncyO@elf}
463
+
464
+ \def\fancy@setoffs{%
465
+ % Just in case \let\headwidth\textwidth was used
466
+ \fancy@gbl\let\headwidth\fancy@headwidth
467
+ \fancy@gbl\let\fancy@Oolh\fancy@offsolh
468
+ \fancy@gbl\let\fancy@Oelh\fancy@offselh
469
+ \fancy@gbl\let\fancy@Oorh\hss
470
+ \fancy@gbl\let\fancy@Oerh\hss
471
+ \fancy@gbl\let\fancy@Oolf\fancy@offsolf
472
+ \fancy@gbl\let\fancy@Oelf\fancy@offself
473
+ \fancy@gbl\let\fancy@Oorf\hss
474
+ \fancy@gbl\let\fancy@Oerf\hss}
475
+
476
+ \newif\iffootnote
477
+ \let\latex@makecol\@makecol
478
+ \def\@makecol{\ifvoid\footins\footnotetrue\else\footnotefalse\fi
479
+ \let\topfloat\@toplist\let\botfloat\@botlist\latex@makecol}
480
+ \def\iftopfloat#1#2{\ifx\topfloat\empty #2\else #1\fi}
481
+ \def\ifbotfloat#1#2{\ifx\botfloat\empty #2\else #1\fi}
482
+ \def\iffloatpage#1#2{\if@fcolmade #1\else #2\fi}
483
+
484
+ \newcommand{\fancypagestyle}[2]{%
485
+ \@namedef{ps@#1}{\let\fancy@gbl\relax#2\relax\ps@fancy}}
@@ -0,0 +1,129 @@
1
+ %%
2
+ %% This is file `graphbox.sty',
3
+ %% generated with the docstrip utility.
4
+ %%
5
+ %% The original source files were:
6
+ %%
7
+ %% graphbox.dtx (with options: `package')
8
+ %%
9
+ %% Copyright (C) 2013-2014 Niklas Beisert
10
+ %%
11
+ %% This work may be distributed and/or modified under the
12
+ %% conditions of the LaTeX Project Public License, either version 1.3
13
+ %% of this license or (at your option) any later version.
14
+ %% The latest version of this license is in
15
+ %% http://www.latex-project.org/lppl.txt
16
+ %% and version 1.3 or later is part of all distributions of LaTeX
17
+ %% version 2005/12/01 or later.
18
+ %%
19
+ \NeedsTeXFormat{LaTeX2e}[1996/12/01]
20
+ \ProvidesPackage{graphbox}[2014/08/31 v1.0 extension for graphicx to adjust containing box]
21
+ \newif\ifGin@box@beamer\Gin@box@beamertrue
22
+ \DeclareOption{nobeamer}{\Gin@box@beamerfalse}
23
+ \ProcessOptions
24
+
25
+ \RequirePackage{graphicx}
26
+
27
+ \newsavebox{\Gin@box@box}
28
+ \newlength{\Gin@box@width}
29
+ \newlength{\Gin@box@height}
30
+ \newlength{\Gin@box@raise}
31
+ \newlength{\Gin@box@hspace}
32
+ \newlength{\Gin@box@bwidth}
33
+ \newlength{\Gin@box@bheight}
34
+
35
+ \def\Gin@box@align{b}
36
+ \def\Gin@box@hsmash{n}
37
+ \def\Gin@box@hshift{0pt}
38
+ \def\Gin@box@vshift{0pt}
39
+ \def\Gin@box@lmargin{0pt}
40
+ \def\Gin@box@rmargin{0pt}
41
+ \def\Gin@box@tmargin{0pt}
42
+ \def\Gin@box@bmargin{0pt}
43
+ \newif\ifGin@box@hide\Gin@box@hidefalse
44
+ \newif\ifGin@box@vsmash\Gin@box@vsmashfalse
45
+
46
+ \define@key{Gin}{hide}[true]{\lowercase{\Gin@boolkey{#1}}{box@hide}}
47
+ \define@key{Gin}{align}[c]{\def\Gin@box@align{#1}}
48
+ \define@key{Gin}{hsmash}[c]{\edef\Gin@box@hsmash{#1}}
49
+ \define@key{Gin}{vsmash}[c]{\if#1n\Gin@box@vsmashfalse\else%
50
+ \Gin@box@vsmashtrue\edef\Gin@box@align{%
51
+ \if#1bt\else\if#1tb\else%
52
+ \if#1lu\else\if#1ul\else#1\fi\fi\fi\fi\fi}}
53
+ \define@key{Gin}{smash}[cc]{\expandafter\KV@Gin@vsmash\@firstoftwo#1%
54
+ \expandafter\KV@Gin@hsmash\@secondoftwo#1}
55
+ \define@key{Gin}{hshift}{\def\Gin@box@hshift{#1}}
56
+ \define@key{Gin}{vshift}{\def\Gin@box@vshift{#1}}
57
+ \define@key{Gin}{lmargin}{\def\Gin@box@lmargin{#1}}
58
+ \define@key{Gin}{rmargin}{\def\Gin@box@rmargin{#1}}
59
+ \define@key{Gin}{tmargin}{\def\Gin@box@tmargin{#1}}
60
+ \define@key{Gin}{bmargin}{\def\Gin@box@bmargin{#1}}
61
+ \define@key{Gin}{hmargin}{\def\Gin@box@lmargin{#1}\def\Gin@box@rmargin{#1}}
62
+ \define@key{Gin}{vmargin}{\def\Gin@box@tmargin{#1}\def\Gin@box@bmargin{#1}}
63
+ \define@key{Gin}{margin}{\def\Gin@box@lmargin{#1}\def\Gin@box@rmargin{#1}%
64
+ \def\Gin@box@tmargin{#1}\def\Gin@box@bmargin{#1}}
65
+
66
+ \let\old@box@Ginclude@graphics\Ginclude@graphics
67
+ \def\Ginclude@graphics#1{%
68
+ \sbox{\Gin@box@box}{\old@box@Ginclude@graphics{#1}}%
69
+ \settowidth{\Gin@box@width}{\usebox{\Gin@box@box}}%
70
+ \settoheight{\Gin@box@height}{\usebox{\Gin@box@box}}%
71
+ \def\gwidth{\Gin@box@width}%
72
+ \def\gheight{\Gin@box@height}%
73
+ \ifGin@box@vsmash%
74
+ \def\Gin@box@tmargin{0pt}\def\Gin@box@bmargin{0pt}\fi%
75
+ \setlength{\Gin@box@raise}{\Gin@box@vshift}%
76
+ \setlength{\Gin@box@bheight}{\Gin@box@height}%
77
+ \addtolength{\Gin@box@bheight}{\Gin@box@tmargin}%
78
+ \addtolength{\Gin@box@bheight}{\Gin@box@bmargin}%
79
+ \if\Gin@box@align t%
80
+ \addtolength{\Gin@box@raise}{-\Gin@box@height}%
81
+ \addtolength{\Gin@box@raise}{1.161290323ex}\fi%
82
+ \if\Gin@box@align u%
83
+ \addtolength{\Gin@box@raise}{-\Gin@box@height}\fi%
84
+ \if\Gin@box@align c%
85
+ \addtolength{\Gin@box@raise}{-0.5\Gin@box@height}%
86
+ \addtolength{\Gin@box@raise}{0.580645161ex}\fi%
87
+ \if\Gin@box@align m%
88
+ \addtolength{\Gin@box@raise}{-0.5\Gin@box@height}\fi%
89
+ \setlength{\Gin@box@hspace}{0pt}%
90
+ \if\Gin@box@hsmash n%
91
+ \setlength{\Gin@box@bwidth}{\Gin@box@width}%
92
+ \addtolength{\Gin@box@bwidth}{\Gin@box@lmargin}%
93
+ \addtolength{\Gin@box@bwidth}{\Gin@box@rmargin}%
94
+ \setlength{\Gin@box@hspace}{\Gin@box@lmargin}%
95
+ \else%
96
+ \setlength{\Gin@box@bwidth}{0pt}%
97
+ \setlength{\Gin@box@hspace}{\Gin@box@hshift}%
98
+ \if\Gin@box@hsmash l%
99
+ \addtolength{\Gin@box@hspace}{-\Gin@box@width}\fi%
100
+ \if\Gin@box@hsmash c%
101
+ \addtolength{\Gin@box@hspace}{-0.5\Gin@box@width}\fi%
102
+ \fi%
103
+ \ifGin@box@vsmash\expandafter\smash\fi{%
104
+ \raisebox{\Gin@box@raise}{%
105
+ \parbox[b]{\Gin@box@bwidth}{%
106
+ \rule[-\Gin@box@bmargin]{0pt}{\Gin@box@bheight}%
107
+ \smash{%
108
+ \makebox[0pt][l]{%
109
+ \hspace*{\Gin@box@hspace}%
110
+ \ifGin@box@hide\else\usebox{\Gin@box@box}\fi%
111
+ }%
112
+ }%
113
+ }%
114
+ }%
115
+ }%
116
+ }
117
+
118
+ \@ifclassloaded{beamer}{\ifGin@box@beamer
119
+ \let\old@box@includegraphics\includegraphics
120
+ \newcommand<>{\fibox@includegraphics}[2][]{\Gin@box@hidefalse%
121
+ \beamer@ifempty{#3}%
122
+ {\alt<\c@beamerpauses->{}{\Gin@box@hidetrue}}%
123
+ {\alt#3{}{\Gin@box@hidetrue}}%
124
+ \old@box@includegraphics[#1]{#2}}
125
+ \AtBeginDocument{\let\includegraphics=\fibox@includegraphics}
126
+ \fi}{}
127
+ \endinput
128
+ %%
129
+ %% End of file `graphbox.sty'.