a5c4fca0f4e5fea46b2bc045249d38a5cddb506c
[tool/hledger.git] / doc / hledger.fr.slidy.html
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
2 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr">
4 <head>
5 <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />
6 <meta name="copyright" content="© 2014 (CC) BY Julien Moutinho &amp;lt;julm+hledger@autogeree.net&amp;gt;" />
7 <meta name="generator" content="AsciiDoc 8.6.9 / slidy2 backend 1.0.3" />
8 <meta name="font-size-adjustment" content="-3" />
9 <title>Informatiser une comptabilité avec confiance</title>
10 <style type="text/css">
11 /* Shared CSS for AsciiDoc xhtml11 and html5 backends */
12
13 /* Default font. */
14 body {
15 font-family: Georgia,serif;
16 }
17
18 /* Title font. */
19 h1, h2, h3, h4, h5, h6,
20 div.title, caption.title,
21 thead, p.table.header,
22 #toctitle,
23 #author, #revnumber, #revdate, #revremark,
24 #footer {
25 font-family: Arial,Helvetica,sans-serif;
26 }
27
28 body {
29 margin: 1em 5% 1em 5%;
30 }
31
32 a {
33 color: blue;
34 text-decoration: underline;
35 }
36 a:visited {
37 color: fuchsia;
38 }
39
40 em {
41 font-style: italic;
42 color: navy;
43 }
44
45 strong {
46 font-weight: bold;
47 color: #083194;
48 }
49
50 h1, h2, h3, h4, h5, h6 {
51 color: #527bbd;
52 margin-top: 1.2em;
53 margin-bottom: 0.5em;
54 line-height: 1.3;
55 }
56
57 h1, h2, h3 {
58 border-bottom: 2px solid silver;
59 }
60 h2 {
61 padding-top: 0.5em;
62 }
63 h3 {
64 float: left;
65 }
66 h3 + * {
67 clear: left;
68 }
69 h5 {
70 font-size: 1.0em;
71 }
72
73 div.sectionbody {
74 margin-left: 0;
75 }
76
77 hr {
78 border: 1px solid silver;
79 }
80
81 p {
82 margin-top: 0.5em;
83 margin-bottom: 0.5em;
84 }
85
86 ul, ol, li > p {
87 margin-top: 0;
88 }
89 ul > li { color: #aaa; }
90 ul > li > * { color: black; }
91
92 .monospaced, code, pre {
93 font-family: "Courier New", Courier, monospace;
94 font-size: inherit;
95 color: navy;
96 padding: 0;
97 margin: 0;
98 }
99 pre {
100 white-space: pre-wrap;
101 }
102
103 #author {
104 color: #527bbd;
105 font-weight: bold;
106 font-size: 1.1em;
107 }
108 #email {
109 }
110 #revnumber, #revdate, #revremark {
111 }
112
113 #footer {
114 font-size: small;
115 border-top: 2px solid silver;
116 padding-top: 0.5em;
117 margin-top: 4.0em;
118 }
119 #footer-text {
120 float: left;
121 padding-bottom: 0.5em;
122 }
123 #footer-badges {
124 float: right;
125 padding-bottom: 0.5em;
126 }
127
128 #preamble {
129 margin-top: 1.5em;
130 margin-bottom: 1.5em;
131 }
132 div.imageblock, div.exampleblock, div.verseblock,
133 div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
134 div.admonitionblock {
135 margin-top: 1.0em;
136 margin-bottom: 1.5em;
137 }
138 div.admonitionblock {
139 margin-top: 2.0em;
140 margin-bottom: 2.0em;
141 margin-right: 10%;
142 color: #606060;
143 }
144
145 div.content { /* Block element content. */
146 padding: 0;
147 }
148
149 /* Block element titles. */
150 div.title, caption.title {
151 color: #527bbd;
152 font-weight: bold;
153 text-align: left;
154 margin-top: 1.0em;
155 margin-bottom: 0.5em;
156 }
157 div.title + * {
158 margin-top: 0;
159 }
160
161 td div.title:first-child {
162 margin-top: 0.0em;
163 }
164 div.content div.title:first-child {
165 margin-top: 0.0em;
166 }
167 div.content + div.title {
168 margin-top: 0.0em;
169 }
170
171 div.sidebarblock > div.content {
172 background: #ffffee;
173 border: 1px solid #dddddd;
174 border-left: 4px solid #f0f0f0;
175 padding: 0.5em;
176 }
177
178 div.listingblock > div.content {
179 border: 1px solid #dddddd;
180 border-left: 5px solid #f0f0f0;
181 background: #f8f8f8;
182 padding: 0.5em;
183 }
184
185 div.quoteblock, div.verseblock {
186 padding-left: 1.0em;
187 margin-left: 1.0em;
188 margin-right: 10%;
189 border-left: 5px solid #f0f0f0;
190 color: #888;
191 }
192
193 div.quoteblock > div.attribution {
194 padding-top: 0.5em;
195 text-align: right;
196 }
197
198 div.verseblock > pre.content {
199 font-family: inherit;
200 font-size: inherit;
201 }
202 div.verseblock > div.attribution {
203 padding-top: 0.75em;
204 text-align: left;
205 }
206 /* DEPRECATED: Pre version 8.2.7 verse style literal block. */
207 div.verseblock + div.attribution {
208 text-align: left;
209 }
210
211 div.admonitionblock .icon {
212 vertical-align: top;
213 font-size: 1.1em;
214 font-weight: bold;
215 text-decoration: underline;
216 color: #527bbd;
217 padding-right: 0.5em;
218 }
219 div.admonitionblock td.content {
220 padding-left: 0.5em;
221 border-left: 3px solid #dddddd;
222 }
223
224 div.exampleblock > div.content {
225 border-left: 3px solid #dddddd;
226 padding-left: 0.5em;
227 }
228
229 div.imageblock div.content { padding-left: 0; }
230 span.image img { border-style: none; vertical-align: text-bottom; }
231 a.image:visited { color: white; }
232
233 dl {
234 margin-top: 0.8em;
235 margin-bottom: 0.8em;
236 }
237 dt {
238 margin-top: 0.5em;
239 margin-bottom: 0;
240 font-style: normal;
241 color: navy;
242 }
243 dd > *:first-child {
244 margin-top: 0.1em;
245 }
246
247 ul, ol {
248 list-style-position: outside;
249 }
250 ol.arabic {
251 list-style-type: decimal;
252 }
253 ol.loweralpha {
254 list-style-type: lower-alpha;
255 }
256 ol.upperalpha {
257 list-style-type: upper-alpha;
258 }
259 ol.lowerroman {
260 list-style-type: lower-roman;
261 }
262 ol.upperroman {
263 list-style-type: upper-roman;
264 }
265
266 div.compact ul, div.compact ol,
267 div.compact p, div.compact p,
268 div.compact div, div.compact div {
269 margin-top: 0.1em;
270 margin-bottom: 0.1em;
271 }
272
273 tfoot {
274 font-weight: bold;
275 }
276 td > div.verse {
277 white-space: pre;
278 }
279
280 div.hdlist {
281 margin-top: 0.8em;
282 margin-bottom: 0.8em;
283 }
284 div.hdlist tr {
285 padding-bottom: 15px;
286 }
287 dt.hdlist1.strong, td.hdlist1.strong {
288 font-weight: bold;
289 }
290 td.hdlist1 {
291 vertical-align: top;
292 font-style: normal;
293 padding-right: 0.8em;
294 color: navy;
295 }
296 td.hdlist2 {
297 vertical-align: top;
298 }
299 div.hdlist.compact tr {
300 margin: 0;
301 padding-bottom: 0;
302 }
303
304 .comment {
305 background: yellow;
306 }
307
308 .footnote, .footnoteref {
309 font-size: 0.8em;
310 }
311
312 span.footnote, span.footnoteref {
313 vertical-align: super;
314 }
315
316 #footnotes {
317 margin: 20px 0 20px 0;
318 padding: 7px 0 0 0;
319 }
320
321 #footnotes div.footnote {
322 margin: 0 0 5px 0;
323 }
324
325 #footnotes hr {
326 border: none;
327 border-top: 1px solid silver;
328 height: 1px;
329 text-align: left;
330 margin-left: 0;
331 width: 20%;
332 min-width: 100px;
333 }
334
335 div.colist td {
336 padding-right: 0.5em;
337 padding-bottom: 0.3em;
338 vertical-align: top;
339 }
340 div.colist td img {
341 margin-top: 0.3em;
342 }
343
344 @media print {
345 #footer-badges { display: none; }
346 }
347
348 #toc {
349 margin-bottom: 2.5em;
350 }
351
352 #toctitle {
353 color: #527bbd;
354 font-size: 1.1em;
355 font-weight: bold;
356 margin-top: 1.0em;
357 margin-bottom: 0.1em;
358 }
359
360 div.toclevel0, div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
361 margin-top: 0;
362 margin-bottom: 0;
363 }
364 div.toclevel2 {
365 margin-left: 2em;
366 font-size: 0.9em;
367 }
368 div.toclevel3 {
369 margin-left: 4em;
370 font-size: 0.9em;
371 }
372 div.toclevel4 {
373 margin-left: 6em;
374 font-size: 0.9em;
375 }
376
377 span.aqua { color: aqua; }
378 span.black { color: black; }
379 span.blue { color: blue; }
380 span.fuchsia { color: fuchsia; }
381 span.gray { color: gray; }
382 span.green { color: green; }
383 span.lime { color: lime; }
384 span.maroon { color: maroon; }
385 span.navy { color: navy; }
386 span.olive { color: olive; }
387 span.purple { color: purple; }
388 span.red { color: red; }
389 span.silver { color: silver; }
390 span.teal { color: teal; }
391 span.white { color: white; }
392 span.yellow { color: yellow; }
393
394 span.aqua-background { background: aqua; }
395 span.black-background { background: black; }
396 span.blue-background { background: blue; }
397 span.fuchsia-background { background: fuchsia; }
398 span.gray-background { background: gray; }
399 span.green-background { background: green; }
400 span.lime-background { background: lime; }
401 span.maroon-background { background: maroon; }
402 span.navy-background { background: navy; }
403 span.olive-background { background: olive; }
404 span.purple-background { background: purple; }
405 span.red-background { background: red; }
406 span.silver-background { background: silver; }
407 span.teal-background { background: teal; }
408 span.white-background { background: white; }
409 span.yellow-background { background: yellow; }
410
411 span.big { font-size: 2em; }
412 span.small { font-size: 0.6em; }
413
414 span.underline { text-decoration: underline; }
415 span.overline { text-decoration: overline; }
416 span.line-through { text-decoration: line-through; }
417
418 div.unbreakable { page-break-inside: avoid; }
419
420
421 /*
422 * xhtml11 specific
423 *
424 * */
425
426 div.tableblock {
427 margin-top: 1.0em;
428 margin-bottom: 1.5em;
429 }
430 div.tableblock > table {
431 border: 3px solid #527bbd;
432 }
433 thead, p.table.header {
434 font-weight: bold;
435 color: #527bbd;
436 }
437 p.table {
438 margin-top: 0;
439 }
440 /* Because the table frame attribute is overriden by CSS in most browsers. */
441 div.tableblock > table[frame="void"] {
442 border-style: none;
443 }
444 div.tableblock > table[frame="hsides"] {
445 border-left-style: none;
446 border-right-style: none;
447 }
448 div.tableblock > table[frame="vsides"] {
449 border-top-style: none;
450 border-bottom-style: none;
451 }
452
453
454 /*
455 * html5 specific
456 *
457 * */
458
459 table.tableblock {
460 margin-top: 1.0em;
461 margin-bottom: 1.5em;
462 }
463 thead, p.tableblock.header {
464 font-weight: bold;
465 color: #527bbd;
466 }
467 p.tableblock {
468 margin-top: 0;
469 }
470 table.tableblock {
471 border-width: 3px;
472 border-spacing: 0px;
473 border-style: solid;
474 border-color: #527bbd;
475 border-collapse: collapse;
476 }
477 th.tableblock, td.tableblock {
478 border-width: 1px;
479 padding: 4px;
480 border-style: solid;
481 border-color: #527bbd;
482 }
483
484 table.tableblock.frame-topbot {
485 border-left-style: hidden;
486 border-right-style: hidden;
487 }
488 table.tableblock.frame-sides {
489 border-top-style: hidden;
490 border-bottom-style: hidden;
491 }
492 table.tableblock.frame-none {
493 border-style: hidden;
494 }
495
496 th.tableblock.halign-left, td.tableblock.halign-left {
497 text-align: left;
498 }
499 th.tableblock.halign-center, td.tableblock.halign-center {
500 text-align: center;
501 }
502 th.tableblock.halign-right, td.tableblock.halign-right {
503 text-align: right;
504 }
505
506 th.tableblock.valign-top, td.tableblock.valign-top {
507 vertical-align: top;
508 }
509 th.tableblock.valign-middle, td.tableblock.valign-middle {
510 vertical-align: middle;
511 }
512 th.tableblock.valign-bottom, td.tableblock.valign-bottom {
513 vertical-align: bottom;
514 }
515
516
517 /*
518 * manpage specific
519 *
520 * */
521
522 body.manpage h1 {
523 padding-top: 0.5em;
524 padding-bottom: 0.5em;
525 border-top: 2px solid silver;
526 border-bottom: 2px solid silver;
527 }
528 body.manpage h2 {
529 border-style: none;
530 }
531 body.manpage div.sectionbody {
532 margin-left: 3em;
533 }
534
535 @media print {
536 body.manpage div#toc { display: none; }
537 }
538 </style>
539 <style type="text/css">
540 /* slidy.css
541
542 Copyright (c) 2005-2010 W3C (MIT, ERCIM, Keio), All Rights Reserved.
543 W3C liability, trademark, document use and software licensing
544 rules apply, see:
545
546 http://www.w3.org/Consortium/Legal/copyright-documents
547 http://www.w3.org/Consortium/Legal/copyright-software
548 */
549
550 /*
551 SJR: 2010-09-29: Modified for AsciiDoc slidy backend.
552 Mostly just commented out stuff that is handled by AsciiDoc's CSS files.
553 */
554
555 body
556 {
557 margin: 0 0 0 0;
558 padding: 0 0 0 0;
559 width: 100%;
560 height: 100%;
561 color: black;
562 background-color: white;
563 /*
564 font-family: "Gill Sans MT", "Gill Sans", GillSans, sans-serif;
565 */
566 font-size: 14pt;
567 }
568
569 div.toolbar {
570 position: fixed; z-index: 200;
571 top: auto; bottom: 0; left: 0; right: 0;
572 height: 1.2em; text-align: right;
573 padding-left: 1em;
574 padding-right: 1em;
575 font-size: 60%;
576 color: red;
577 background-color: rgb(240,240,240);
578 border-top: solid 1px rgb(180,180,180);
579 }
580
581 div.toolbar span.copyright {
582 color: black;
583 margin-left: 0.5em;
584 }
585
586 div.initial_prompt {
587 position: absolute;
588 z-index: 1000;
589 bottom: 1.2em;
590 width: 90%;
591 background-color: rgb(200,200,200);
592 opacity: 0.35;
593 cursor: pointer;
594 }
595
596 div.initial_prompt p.help {
597 text-align: center;
598 }
599
600 div.initial_prompt p.close {
601 text-align: right;
602 font-style: italic;
603 }
604
605 div.slidy_toc {
606 position: absolute;
607 z-index: 300;
608 width: 60%;
609 max-width: 30em;
610 height: 30em;
611 overflow: auto;
612 top: auto;
613 right: auto;
614 left: 4em;
615 bottom: 4em;
616 padding: 1em;
617 background: rgb(240,240,240);
618 border-style: solid;
619 border-width: 2px;
620 font-size: 60%;
621 }
622
623 div.slidy_toc .toc_heading {
624 text-align: center;
625 width: 100%;
626 margin: 0;
627 margin-bottom: 1em;
628 border-bottom-style: solid;
629 border-bottom-color: rgb(180,180,180);
630 border-bottom-width: 1px;
631 }
632
633 div.slide {
634 z-index: 20;
635 margin: 0 0 0 0;
636 padding-top: 0;
637 padding-bottom: 0;
638 padding-left: 20px;
639 padding-right: 20px;
640 border-width: 0;
641 clear: both;
642 top: 0;
643 bottom: 0;
644 left: 0;
645 right: 0;
646 line-height: 120%;
647 background-color: transparent;
648 }
649
650 div.background {
651 display: none;
652 }
653
654 div.handout {
655 margin-left: 20px;
656 margin-right: 20px;
657 }
658
659 div.slide.titlepage {
660 text-align: center;
661 }
662
663 div.slide.titlepage.h1 {
664 padding-top: 10%;
665 }
666
667 div.slide h1 {
668 padding-left: 0;
669 padding-right: 20pt;
670 padding-top: 4pt;
671 padding-bottom: 4pt;
672 margin-top: 0;
673 margin-left: 0;
674 margin-right: 60pt;
675 margin-bottom: 0.5em;
676 display: block;
677 font-size: 160%;
678 line-height: 1.2em;
679 background: transparent;
680 }
681
682 div.toc {
683 position: absolute;
684 top: auto;
685 bottom: 4em;
686 left: 4em;
687 right: auto;
688 width: 60%;
689 max-width: 30em;
690 height: 30em;
691 border: solid thin black;
692 padding: 1em;
693 background: rgb(240,240,240);
694 color: black;
695 z-index: 300;
696 overflow: auto;
697 display: block;
698 visibility: visible;
699 }
700
701 div.toc-heading {
702 width: 100%;
703 border-bottom: solid 1px rgb(180,180,180);
704 margin-bottom: 1em;
705 text-align: center;
706 }
707
708 /*
709 pre {
710 font-size: 80%;
711 font-weight: bold;
712 line-height: 120%;
713 padding-top: 0.2em;
714 padding-bottom: 0.2em;
715 padding-left: 1em;
716 padding-right: 1em;
717 border-style: solid;
718 border-left-width: 1em;
719 border-top-width: thin;
720 border-right-width: thin;
721 border-bottom-width: thin;
722 border-color: #95ABD0;
723 color: #00428C;
724 background-color: #E4E5E7;
725 }
726 */
727
728 /*
729 li pre { margin-left: 0; }
730
731 blockquote { font-style: italic }
732
733 img { background-color: transparent }
734
735 p.copyright { font-size: smaller }
736 */
737
738 .center { text-align: center }
739 .footnote { font-size: smaller; margin-left: 2em; }
740
741 /*
742 a img { border-width: 0; border-style: none }
743 */
744
745 a:visited { color: navy }
746 a:link { color: navy }
747 a:hover { color: red; text-decoration: underline }
748 a:active { color: red; text-decoration: underline }
749
750 a {text-decoration: none}
751 .navbar a:link {color: white}
752 .navbar a:visited {color: yellow}
753 .navbar a:active {color: red}
754 .navbar a:hover {color: red}
755
756 /*
757 ul { list-style-type: square; }
758 ul ul { list-style-type: disc; }
759 ul ul ul { list-style-type: circle; }
760 ul ul ul ul { list-style-type: disc; }
761 li { margin-left: 0.5em; margin-top: 0.5em; }
762 li li { font-size: 85%; font-style: italic }
763 li li li { font-size: 85%; font-style: normal }
764 */
765
766 div dt
767 {
768 margin-left: 0;
769 margin-top: 1em;
770 margin-bottom: 0.5em;
771 font-weight: bold;
772 }
773 div dd
774 {
775 margin-left: 2em;
776 margin-bottom: 0.5em;
777 }
778
779
780 /*
781 p,pre,ul,ol,blockquote,h2,h3,h4,h5,h6,dl,table {
782 margin-left: 1em;
783 margin-right: 1em;
784 }
785 */
786
787 p.subhead { font-weight: bold; margin-top: 2em; }
788
789 .smaller { font-size: smaller }
790 .bigger { font-size: 130% }
791
792 /*
793 td,th { padding: 0.2em }
794 */
795
796 ul {
797 margin: 0.5em 1.5em 0.5em 1.5em;
798 padding: 0;
799 }
800
801 ol {
802 margin: 0.5em 1.5em 0.5em 1.5em;
803 padding: 0;
804 }
805
806 ul { list-style-type: square; }
807 ul ul { list-style-type: disc; }
808 ul ul ul { list-style-type: circle; }
809 ul ul ul ul { list-style-type: disc; }
810
811 /*
812 ul li {
813 list-style: square;
814 margin: 0.1em 0em 0.6em 0;
815 padding: 0 0 0 0;
816 line-height: 140%;
817 }
818
819 ol li {
820 margin: 0.1em 0em 0.6em 1.5em;
821 padding: 0 0 0 0px;
822 line-height: 140%;
823 list-style-type: decimal;
824 }
825
826 li ul li {
827 font-size: 85%;
828 font-style: italic;
829 list-style-type: disc;
830 background: transparent;
831 padding: 0 0 0 0;
832 }
833 li li ul li {
834 font-size: 85%;
835 font-style: normal;
836 list-style-type: circle;
837 background: transparent;
838 padding: 0 0 0 0;
839 }
840 li li li ul li {
841 list-style-type: disc;
842 background: transparent;
843 padding: 0 0 0 0;
844 }
845
846 li ol li {
847 list-style-type: decimal;
848 }
849
850
851 li li ol li {
852 list-style-type: decimal;
853 }
854 */
855
856 /*
857 setting class="outline" on ol or ul makes it behave as an
858 ouline list where blocklevel content in li elements is
859 hidden by default and can be expanded or collapsed with
860 mouse click. Set class="expand" on li to override default
861 */
862
863 ol.outline li:hover { cursor: pointer }
864 ol.outline li.nofold:hover { cursor: default }
865
866 ul.outline li:hover { cursor: pointer }
867 ul.outline li.nofold:hover { cursor: default }
868
869 ol.outline { list-style:decimal; }
870 ol.outline ol { list-style-type:lower-alpha }
871
872 ol.outline li.nofold {
873 padding: 0 0 0 20px;
874 background: transparent url(../graphics/nofold-dim.gif) no-repeat 0px 0.5em;
875 }
876 ol.outline li.unfolded {
877 padding: 0 0 0 20px;
878 background: transparent url(../graphics/fold-dim.gif) no-repeat 0px 0.5em;
879 }
880 ol.outline li.folded {
881 padding: 0 0 0 20px;
882 background: transparent url(../graphics/unfold-dim.gif) no-repeat 0px 0.5em;
883 }
884 ol.outline li.unfolded:hover {
885 padding: 0 0 0 20px;
886 background: transparent url(../graphics/fold.gif) no-repeat 0px 0.5em;
887 }
888 ol.outline li.folded:hover {
889 padding: 0 0 0 20px;
890 background: transparent url(../graphics/unfold.gif) no-repeat 0px 0.5em;
891 }
892
893 ul.outline li.nofold {
894 padding: 0 0 0 20px;
895 background: transparent url(../graphics/nofold-dim.gif) no-repeat 0px 0.5em;
896 }
897 ul.outline li.unfolded {
898 padding: 0 0 0 20px;
899 background: transparent url(../graphics/fold-dim.gif) no-repeat 0px 0.5em;
900 }
901 ul.outline li.folded {
902 padding: 0 0 0 20px;
903 background: transparent url(../graphics/unfold-dim.gif) no-repeat 0px 0.5em;
904 }
905 ul.outline li.unfolded:hover {
906 padding: 0 0 0 20px;
907 background: transparent url(../graphics/fold.gif) no-repeat 0px 0.5em;
908 }
909 ul.outline li.folded:hover {
910 padding: 0 0 0 20px;
911 background: transparent url(../graphics/unfold.gif) no-repeat 0px 0.5em;
912 }
913
914 /* for slides with class "title" in table of contents */
915 a.titleslide { font-weight: bold; font-style: italic }
916
917 /*
918 hide images for work around for save as bug
919 where browsers fail to save images used by CSS
920 */
921 img.hidden { display: none; visibility: hidden }
922 div.initial_prompt { display: none; visibility: hidden }
923
924 div.slide {
925 visibility: visible;
926 position: inherit;
927 }
928 div.handout {
929 border-top-style: solid;
930 border-top-width: thin;
931 border-top-color: black;
932 }
933
934 @media screen {
935 .hidden { display: none; visibility: visible }
936
937 div.slide.hidden { display: block; visibility: visible }
938 div.handout.hidden { display: block; visibility: visible }
939 div.background { display: none; visibility: hidden }
940 body.single_slide div.initial_prompt { display: block; visibility: visible }
941 body.single_slide div.background { display: block; visibility: visible }
942 body.single_slide div.background.hidden { display: none; visibility: hidden }
943 body.single_slide .invisible { visibility: hidden }
944 body.single_slide .hidden { display: none; visibility: hidden }
945 body.single_slide div.slide { position: absolute }
946 body.single_slide div.handout { display: none; visibility: hidden }
947 }
948
949 @media print {
950 .hidden { display: block; visibility: visible }
951
952 /*
953 div.slide pre { font-size: 60%; padding-left: 0.5em; }
954 */
955 div.toolbar { display: none; visibility: hidden; }
956 div.slidy_toc { display: none; visibility: hidden; }
957 div.background { display: none; visibility: hidden; }
958 div.slide { page-break-before: always }
959 /* :first-child isn't reliable for print media */
960 div.slide.first-slide { page-break-before: avoid }
961 }
962
963
964 /* SJR: AsciiDoc slidy backend tweaks */
965
966 ol, ul {
967 margin: 0.8em 1.5em 0.8em 1.8em;
968 }
969 li > ul, li > ol {
970 margin-top: 0.5em;
971 }
972
973 .outline > li.folded,
974 .outline > li.unfolded {
975 color: #527bbd;
976 }
977 ul > li{ color: #aaa; }
978 ul > li > *, ol > li > * { color: black; }
979
980 li {
981 margin-top: 0.5em;
982 margin-bottom: 0.5em;
983 }
984
985 /* jmi hack */
986 @media screen {
987 body.single_slide .invisible { opacity: 0.15; visibility: visible; }
988 /*img.invisible { opacity: 0.1; visibility: visible; } */
989 img.invisible { visibility: hidden !important }
990 }
991 a {text-decoration: underline;}
992 </style>
993 <style type="text/css" title="slidy_color_set_none">
994 /* empty color set styles */
995 </style>
996 <style type="text/css" title="slidy_color_set_yellow">
997 /* rainbow color styles */
998 body { background-color: #ffffaa;}
999 a:link, a:visited, a:hover, a:active { color: blue; text-decoration: underline }
1000 a:hover { color: red; text-decoration: underline }
1001 div.slide { color: black;}
1002 div.slide h1,h2,h3,h4,h5,h6 { color: orange;}
1003 em { color: green;}
1004 tt { color: green;}
1005 div.sidebarblock, div.literalblock, div.listingblock, div.exampleblock, div.title { color: red;}
1006 div.quoteblock, div.verseblock { color: black; }
1007 div.admonitionblock { color: red;}
1008 </style>
1009 <style type="text/css" title="slidy_color_set_green">
1010 /* blue color styles */
1011 body { background-color: #449900;}
1012 a:link, a:visited, a:hover, a:active { color: fuchsia; text-decoration: underline }
1013 a:hover { color: red; text-decoration: underline }
1014 div.slide { color: yellow;}
1015 div.slide h1,h2,h3,h4,h5,h6 { color: lime;}
1016 em { color: orange;}
1017 tt { color: orange;}
1018 div.sidebarblock, div.literalblock, div.listingblock, div.exampleblock, div.title { color: #44ff00;}
1019 div.quoteblock, div.verseblock { color: black; }
1020 div.admonitionblock { color: #88ff55;}
1021 </style>
1022 <style type="text/css" title="slidy_color_set_blue">
1023 /* blue color styles */
1024 body { background-color: navy;}
1025 a:link, a:visited, a:hover, a:active { color: yellow; text-decoration: underline }
1026 a:hover { color: red; text-decoration: underline }
1027 div.slide { background-color: navy; color: aqua;}
1028 div.slide h1,h2,h3,h4,h5,h6 { color: aqua;}
1029 em { color: blue;}
1030 tt { color: blue;}
1031 div.sidebarblock, div.literalblock, div.listingblock, div.exampleblock, div.title { color: teal;}
1032 div.admonitionblock { color: teal;}
1033 </style>
1034 <style type="text/css" title="slidy_color_set_black">
1035 /* black color set styles */
1036 body { background-color: black !important; }
1037 a:link, a:visited, a:hover, a:active { color: gray; text-decoration: underline }
1038 a:hover { color: red; text-decoration: underline }
1039 div.slide { color: silver !important; }
1040 span, caption, th { color: silver !important; }
1041 div.slide h1,h2,h3,h4,h5,h6 { color: white;}
1042 em, strong { color: #999999;}
1043 tt { color: blue;}
1044 div.sidebarblock, div.literalblock, div.listingblock, div.exampleblock, div.title { color: black; }
1045 div.admonitionblock, div.quoteblock, div.verseblock { color: white; }
1046 div.cover.slide, div.cover.slide h1 { background-color: black; }
1047 </style>
1048 <style type="text/css">
1049 html body {
1050 color:#343434;
1051 font-family:serif;
1052 font-size:10px;
1053 margin:0 0;
1054 padding:0 0 0 0;
1055 }
1056 /* titres */
1057 h1, h2, h3, h4, h5, h6 {
1058 font-family: serif;
1059 }
1060 div.slide h1 {
1061 margin: 0 0 0 0 !important;
1062 }
1063 #revnumber {
1064 font-family: serif;
1065 font-size:inherit;
1066 font-weight:bold;
1067 }
1068 /* sections */
1069 .article {
1070 }
1071 .article > .sect1,
1072 .article > .sect2,
1073 .article > .sect3 {
1074 -moz-box-sizing:border-box;
1075 -webkit-box-sizing:border-box;
1076 box-sizing:border-box;
1077 clear:both;
1078 display:table;
1079 float:left;
1080 margin:0 auto 0 auto;
1081 padding:0 1em 0 1em;
1082 width:100%;
1083 }
1084 .article > .sect1:last-child {
1085 margin-bottom:2ex;
1086 }
1087 .article > .sect1 * {
1088 clear:both;
1089 }
1090 .article > .refnamediv > *,
1091 .article > .sect1 > *,
1092 .article > .refsynopsisdiv > * {
1093 }
1094 .article > .sect1 > .sect2 > * {
1095 margin-left:1em;
1096 }
1097 .article > .sect1 > .sect2 > .sect3 > * {
1098 margin-left:2em;
1099 }
1100 /* text */
1101 a:empty {
1102 margin:0 0 0 0;
1103 padding:0 0 0 0;
1104 }
1105 .article em {
1106 color:#000080;
1107 }
1108 .article .emphasis {
1109 text-decoration:underline;
1110 }
1111 .article p {
1112 margin:0 0 0 0;
1113 max-width:34em;
1114 padding:1ex 0 0 0;
1115 text-align:justify;
1116 }
1117 .article h2 + p {
1118 margin-top:0;
1119 padding-top:0.25ex;
1120 }
1121 .article h3 + p,
1122 .article h3 + p[title] {
1123 margin-top:0;
1124 padding-top:0;
1125 }
1126 /* citations */
1127 .article code,
1128 .article code.literal {
1129 background-color:#EEEEEE;
1130 color:inherit !important;
1131 font-family:monospace,Courier;
1132 white-space:pre;
1133 font-size:90%;
1134 }
1135 .article pre {
1136 /*background-color: #ffffff;*/
1137 font-family:monospace,Courier;
1138 line-height:1.3; /* TODO: 1.2 ? */
1139 color: #000000;
1140 font-family: monospace;
1141 line-height: 1.13;
1142 overflow: auto;
1143 white-space: pre;
1144 }
1145 .article pre.literallayout {
1146 border-left:1ex solid navy;
1147 margin-left:0;
1148 padding-left:1ex;
1149 }
1150 .article .screen {
1151 border-width:0px 0px 0px 5px;
1152 color:black;
1153 display:inline-block;
1154 margin:0.5ex 0 0.5ex 0;
1155 }
1156 .article .programlisting {
1157 color:black;
1158 margin-left:2em;
1159 margin-right:2em;
1160 }
1161 .article .listitem > .simpara {
1162 display:inline;
1163 margin-bottom:0;
1164 }
1165 /* titles */
1166 .article > .sect1 > h2 {
1167 border-bottom:2px solid black;
1168 /*box-shadow:0px 1px 00px #888888;*/
1169 color:green;
1170 font-family:monospace,Arial,sans-serif;
1171 font-size:120%;
1172 /*font-variant:small-caps;*/
1173 line-height:1.2;
1174 margin:1ex 0 0.5ex 0;
1175 padding:0 0 0.5ex 0;
1176 }
1177 .article > .refnamediv > h2,
1178 .article > .refsynopsisdiv > h2 {
1179 font-variant:small-caps;
1180 }
1181 .article > .sect1 > .sect2 > h3 {
1182 color:DarkGreen;
1183 font-family:monospace,Arial,sans-serif;
1184 font-size:100%;
1185 padding:1.5ex 0 0.5ex 0;
1186 margin:0 0 0 0;
1187 }
1188 .article > .sect1 > h2 + .sect2 > h3 {
1189 padding-top:0;
1190 }
1191 .article > .sect1 > .sect2 > h3:before,
1192 .article .toc .sect2:before {
1193 color:black;
1194 content:"► ";
1195 font-family:monospace,Arial,sans-serif;
1196 float:left;
1197 }
1198 .article > .sect1 > .sect2 > .sect3 > h4 {
1199 color:DarkGreen;
1200 font-family:monospace,Arial,sans-serif;
1201 font-size:100%;
1202 padding:1em 0 0 0;
1203 margin:0 0 0 0;
1204 }
1205 .article > .sect1 > .sect2 > .sect3 > h4:before,
1206 .article .toc .sect3:before {
1207 color:black;
1208 content:"►► ";
1209 font-family:monospace,Arial,sans-serif;
1210 float:left;
1211 }
1212 .article li.listitem > p.simpara:first-child {
1213 margin-top:0;
1214 }
1215 .article p .formalpara-title {
1216 /* XXX: there is a docbook-xsl bug here:
1217 * https://lists.oasis-open.org/archives/docbook-apps/201107/msg00003.html
1218 */
1219 color:black;
1220 font-weight:bold;
1221 line-height:1.4;
1222 margin:0 0 0 0;
1223 padding:0 0 0 0;
1224 text-align:left;
1225 }
1226 .article p[title] {
1227 margin:1ex 0 0 0;
1228 max-width:none;
1229 padding:0 0 0 0;
1230 }
1231 .article span.citerefentry > span.articletitle {
1232 white-space:nowrap;
1233 }
1234 /* lists */
1235 .article .hdlist p {
1236 padding:0 0 0 0;
1237 }
1238 .article .hdlist td.hdlist1 {
1239 text-align:right;
1240 vertical-align:top;
1241 }
1242 .article .hdlist td.hdlist1,
1243 .article .hdlist td.hdlist1 {
1244 text-align:right;
1245 }
1246 .article .hdlist td.hdlist2 {
1247 text-align:left;
1248 padding:0 0 0 0;
1249 vertical-align:middle;
1250 }
1251 .article .hdlist td.hdlist2 > .listingblock {
1252 margin-top: 0;
1253 }
1254 .article .hdlist.math td.hdlist1,
1255 .article .hdlist.math td.hdlist2 {
1256 vertical-align:middle !important;
1257 }
1258 .article .calloutlist p {
1259 padding:0 0 0 0;
1260 }
1261 .article .calloutlist td {
1262 padding:0 0 0 0;
1263 }
1264 .article .calloutlist td p {
1265 }
1266 .article .calloutlist td:first-child {
1267 padding-right:1em;
1268 }
1269 .article .calloutlist td:first-child p {
1270 text-align:right;
1271 }
1272 .article .itemizedlist,
1273 .article .orderedlist {
1274 padding:0 0 0 0;
1275 margin:0 0 0 0;
1276 }
1277 .article .itemizedlist ul,
1278 .article .orderedlist ol {
1279 padding:0 0 0 0;
1280 margin:0 0 0 1.5em;
1281 list-style-position:outside;
1282 }
1283 .article .itemizedlist ul li,
1284 .article .orderedlist ol li {
1285 margin:0 0 0 0;
1286 max-width:51em;
1287 padding:0 0 0 0;
1288 }
1289 .article .dlist {
1290 padding:0 0 0 0;
1291 margin:0 0 0 0;
1292 }
1293 .article .dlist dl {
1294 list-style-position:outside;
1295 margin:0 0 0 0;
1296 padding:0.5ex 0 0 0;
1297 }
1298 .article .dlist dl dt {
1299 margin:0 0 0 0;
1300 padding-left:1px;
1301 }
1302 .article .dlist dl dd {
1303 border-left:1px dotted black;
1304 margin:0.5ex 0 0.5ex 0.9ex;
1305 max-width:51em;
1306 padding-left:1.1ex;
1307 text-align:justify;
1308 }
1309 .article .dlist dl dd > p:first-child {
1310 padding-top:0;
1311 }
1312 .article .dlist dl dd > p:last-child {
1313 padding-bottom:0;
1314 }
1315 .article .dlist dt:before,
1316 .article .toc dt:before {
1317 color:black;
1318 content:"▪ ";
1319 font-family:monospace,Arial,sans-serif;
1320 float:left;
1321 }
1322 .article h2 + .itemizedlist ul,
1323 .article h2 + .orderedlist ol,
1324 .article h2 + .dlist dl {
1325 padding-top:0;
1326 }
1327 /* fhs */
1328 .article a[href^="#fhs:"] {
1329 white-space:pre;
1330 }
1331 .article .toc a[href^="#fhs:"] {
1332 white-space:normal;
1333 }
1334 /* sidebar */
1335 .article .sidebar {
1336 -moz-box-sizing:border-box;
1337 -webkit-box-sizing:border-box;
1338 background:none repeat scroll 0 0 #FFFFEE;
1339 border:1px solid #C0C0C0;
1340 box-sizing:border-box;
1341 clear:both;
1342 float:left;
1343 height:96%;
1344 left:0;
1345 margin:1em 0 0 1em;
1346 overflow:auto;
1347 padding:1ex 1em 1ex 1em;
1348 position:fixed;
1349 top:0;
1350 width:30em;
1351 }
1352 .article .sidebar .refnamediv {
1353 margin:0 0 1ex 0;
1354 }
1355 .article .sidebar .refnamediv h2 {
1356 border-bottom:2px solid black;
1357 color:green;
1358 font-family:monospace,Arial,sans-serif;
1359 font-size:120%;
1360 font-variant:small-caps;
1361 border-bottom:0 solid black;
1362 margin:0 0 0.5ex 0;
1363 padding:0 0 0 0;
1364 }
1365 .article .sidebar .refnamediv p {
1366 margin:0 0 0 0;
1367 padding:0 0 0 0;
1368 text-align:justify;
1369 }
1370 /* location */
1371 .article .location {
1372 margin:0 0 0 0;
1373 }
1374 .article .location .location-title {
1375 display:inline-block;
1376 }
1377 .article .location .location-path {
1378 display:inline-block;
1379 margin-left:1em;
1380 margin-bottom:0.5ex;
1381 }
1382 .article .location .location-path a {
1383 display:inline-block;
1384 }
1385 .article .location .location-path .dir {
1386 color:blue;
1387 font-weight:bold;
1388 }
1389 .article .location .location-path .dir .slash {
1390 color:black;
1391 }
1392 .article .location .location-path .file {
1393 font-weight:bold;
1394 }
1395 /* language */
1396 .article .language {
1397 margin:0 0 0 0;
1398 }
1399 .article .language .language-title {
1400 display:inline-block;
1401 }
1402 .article .language .language-list {
1403 display:inline-block;
1404 font-weight:bold;
1405 margin-left:1em;
1406 }
1407 .article .language .language-list .lang-available {
1408 color:blue;
1409 }
1410 .article .language .language-list .lang-current {
1411 color:black;
1412 }
1413 /* toc */
1414 .article .toc {
1415 }
1416 .article .toc dl {
1417 clear:left;
1418 margin-left:0;
1419 padding-left:0;
1420 }
1421 .article .toc dl dd {
1422 border-left:1px dotted #333;
1423 margin-bottom:1px;
1424 margin-left:0.1ex;
1425 padding-left:1.9ex;
1426 }
1427 .article .toc dl dt span.refsynopsisdiv {
1428 }
1429 .article .toc .sect1:before {
1430 color:black;
1431 content:"§ ";
1432 font-family:monospace,Arial,sans-serif;
1433 float:left;
1434 }
1435 .article .toc .toc-title,
1436 .article .language .language-title,
1437 .article .location .location-title {
1438 border-bottom:0 solid black;
1439 color:green;
1440 font-size:120%;
1441 font-variant:small-caps;
1442 font-weight:bold;
1443 margin-bottom:0.5ex;
1444 }
1445 div.slidy_toc,
1446 body > div.slidy_toc,
1447 .article div.slidy_toc {
1448 background: none repeat scroll 0 0 #F0F0F0;
1449 border-style: solid;
1450 border-width: 2px;
1451 font-size: 100%;
1452 height: 80%;
1453 left: auto !important;
1454 bottom: auto !important;
1455 right: 0 !important;
1456 max-width: none !important;
1457 width: 50% !important;
1458 overflow: auto;
1459 padding: 1em;
1460 position: absolute;
1461 top: 0;
1462 z-index: 300;
1463 }
1464 .article div.toc-heading {
1465 border-bottom: 1px solid #B4B4B4;
1466 font-weight: bold;
1467 margin-bottom: 1em;
1468 text-align: center;
1469 width: 100%;
1470 }
1471 /* incremental preview */
1472 body.single_slide .invisible {
1473 opacity: 0.15;
1474 visibility: visible;
1475 }
1476 img.invisible {
1477 visibility: hidden !important;
1478 }
1479 /* image */
1480 .imageblock img {
1481 border:1px solid black;
1482 display:block;
1483 margin:0 auto 0 auto;
1484 }
1485 /* splash */
1486 div.hledgersplash > div.imageblock {
1487 /*border:black solid 1px;*/
1488 left:-50%;
1489 position:relative;
1490 }
1491 /* vim syntax */
1492 pre .Error { color: #8080ff; background-color: #ffffff; }
1493 pre .PreProc { color: #ff6060; text-decoration: underline; font-weight: bold; }
1494 pre .Special { color: #8080ff; font-weight: bold; }
1495 pre .Constant { color: #ff40ff; text-decoration: none; }
1496 pre .Statement { color: #B8860B; font-weight: bold; }
1497 pre .Identifier { color: #ffff00; text-decoration: underline; }
1498 pre .Comment { color: #4169e1; font-weight: bold; }
1499 /* vim syntax: hledger */
1500 pre .hledgerNumberOdd { color: #0000ff; background-color: #e5e5e5; font-weight: bold; }
1501 pre .hledgerPostingAmountOdd { color: #eead0e; background-color: #e5e5e5; font-weight: bold; }
1502 pre .hledgerAccountSeparatorOdd { color: #eead0e; background-color: #e5e5e5; font-weight: bold; }
1503 pre .hledgerPostingAccountOdd { color: #4d4d4d; background-color: #e5e5e5; }
1504 pre .hledgerNumber { color: #0000ff; background-color: #90ee90; font-weight: bold; }
1505 pre .hledgerPostingAmount { color: #eead0e; background-color: #90ee90; font-weight: bold; }
1506 pre .hledgerAccountSeparator { color: #eead0e; background-color: #90ee90; font-weight: bold; }
1507 pre .hledgerPostingAccount { color: #4d4d4d; background-color: #90ee90; }
1508 pre .hledgerTagValue { color: #ff0000; }
1509 pre .hledgerTag { color: #ffa500; font-weight: bold; }
1510 pre .hledgerTransactionComment { color: #4169e1; font-weight: bold; }
1511 pre .hledgerTransaction { font-weight: bold; }
1512 pre .hledgerTransactionDate { background-color: #eedd82; font-weight: bold; }
1513 pre .hledgerDirective { font-weight: bold; }
1514 pre .hledgerInclude { font-weight: bold; }
1515 pre .hledgerComment { color: #4169e1; font-weight: bold; }
1516 </style>
1517 <script type="text/javascript">
1518 /*<![CDATA[*/
1519 /* slidy.js
1520
1521 Copyright (c) 2005-2010 W3C (MIT, ERCIM, Keio), All Rights Reserved.
1522 W3C liability, trademark, document use and software licensing
1523 rules apply, see:
1524
1525 http://www.w3.org/Consortium/Legal/copyright-documents
1526 http://www.w3.org/Consortium/Legal/copyright-software
1527
1528 Defines single name "w3c_slidy" in global namespace
1529 Adds event handlers without trampling on any others
1530
1531 JMI: Dynamic features added
1532 */
1533
1534 // the slidy object implementation
1535 var w3c_slidy = {
1536 // classify which kind of browser we're running under
1537 ns_pos: (typeof window.pageYOffset!='undefined'),
1538 khtml: ((navigator.userAgent).indexOf("KHTML") >= 0 ? true : false),
1539 opera: ((navigator.userAgent).indexOf("Opera") >= 0 ? true : false),
1540 ipad: ((navigator.userAgent).indexOf("iPad") >= 0 ? true : false),
1541 iphone: ((navigator.userAgent).indexOf("iPhone") >= 0 ? true : false),
1542 ie: (typeof document.all != "undefined" && !this.opera),
1543 ie6: (!this.ns_pos && navigator.userAgent.indexOf("MSIE 6") != -1),
1544 ie7: (!this.ns_pos && navigator.userAgent.indexOf("MSIE 7") != -1),
1545 ie8: (!this.ns_pos && navigator.userAgent.indexOf("MSIE 8") != -1),
1546 ie9: (!this.ns_pos && navigator.userAgent.indexOf("MSIE 9") != -1),
1547 keyboardless: (this.ipad || this.iphone),
1548
1549 // are we running as XHTML? (doesn't work on Opera)
1550 is_xhtml: /xml/.test(document.contentType),
1551
1552 slide_number: 0, // integer slide count: 0, 1, 2, ...
1553 slide_number_element: null, // element containing slide number
1554 slides: [], // set to array of slide div's
1555 notes: [], // set to array of handout div's
1556 backgrounds: [], // set to array of background div's
1557 toolbar: null, // element containing toolbar
1558 title: null, // document title
1559 last_shown: null, // last incrementally shown item
1560 eos: null, // span element for end of slide indicator
1561 toc: null, // table of contents
1562 outline: null, // outline element with the focus
1563 selected_text_len: 0, // length of drag selection on document
1564 view_all: 0, // 1 to view all slides + handouts
1565 want_toolbar: true, // user preference to show/hide toolbar
1566 mouse_click_enabled: true, // enables left click for next slide
1567 scroll_hack: 0, // IE work around for position: fixed
1568 disable_slide_click: false, // used by clicked anchors
1569
1570 lang: "en", // updated to language specified by html file
1571
1572 help_anchor: null, // used for keyboard focus hack in showToolbar()
1573 help_page: "http://www.w3.org/Talks/Tools/Slidy2/help/help.html",
1574 help_text: "Navigate with mouse click, space bar, Cursor Left/Right, " +
1575 "or Pg Up and Pg Dn. Use S and B to change font size.",
1576 // jmi
1577 help_keymap:
1578 "PGDN\t: nextSlide\n" +
1579 "PGUP\t: previousSlide\n" +
1580 "HOME\t: firstSlide\n" +
1581 "END \t: lastSlide\n" +
1582 "SPACE\t: nextContent\n" +
1583 "-> \t: nextContent\n" +
1584 "<- \t: previousContent\n" +
1585 "A \t: toggleAllSlides\n" +
1586 "F \t: toggleFooter\n" +
1587 "K \t: toggleMouseClick\n" +
1588 "I \t: toggleIncremental\n" +
1589 "L \t: toggleColorSet\n" +
1590 "T, C\t: tableOfContents\n" +
1591 "B \t: biggerFontSize\n" +
1592 "S \t: smallerFontSize\n" +
1593 "M \t: key mapping\n",
1594
1595 size_index: 0,
1596 size_adjustment: 0,
1597 sizes: new Array("10pt", "12pt", "14pt", "16pt", "18pt", "20pt",
1598 "22pt", "24pt", "26pt", "28pt", "30pt", "32pt"),
1599
1600 // needed for efficient resizing
1601 last_width: 0,
1602 last_height: 0,
1603
1604
1605 // Needed for cross browser support for relative width/height on
1606 // object elements. The work around is to save width/height attributes
1607 // and then to recompute absolute width/height dimensions on resizing
1608 objects: [],
1609
1610 //jmi
1611 incremental_display: true,
1612
1613 // attach initialiation event handlers
1614 set_up: function () {
1615 var init = function() { w3c_slidy.init(); };
1616 if (typeof window.addEventListener != "undefined")
1617 window.addEventListener("load", init, false);
1618 else
1619 window.attachEvent("onload", init);
1620 },
1621
1622 hide_slides: function () {
1623 if (document.body && !w3c_slidy.initialized)
1624 document.body.style.visibility = "hidden";
1625 else
1626 setTimeout(w3c_slidy.hide_slides, 50);
1627 },
1628
1629 // hack to persuade IE to compute correct document height
1630 // as needed for simulating fixed positioning of toolbar
1631 ie_hack: function () {
1632 window.resizeBy(0,-1);
1633 window.resizeBy(0, 1);
1634 },
1635
1636 init: function () {
1637 //alert("slidy starting test 10");
1638 document.body.style.visibility = "visible";
1639 this.init_localization();
1640 this.add_toolbar();
1641 this.wrap_implicit_slides();
1642 this.collect_slides();
1643 this.collect_notes();
1644 this.collect_backgrounds();
1645 this.objects = document.body.getElementsByTagName("object");
1646 this.patch_anchors();
1647 this.slide_number = this.find_slide_number(location.href);
1648 window.offscreenbuffering = true;
1649 this.size_adjustment = this.find_size_adjust();
1650 this.time_left = this.find_duration();
1651 this.hide_image_toolbar(); // suppress IE image toolbar popup
1652 this.init_outliner(); // activate fold/unfold support
1653 this.title = document.title;
1654 // jmi
1655 this.color_sets = new Array();
1656 this.init_color_sets();
1657
1658 // work around for opera bug
1659 this.is_xhtml = (document.body.tagName == "BODY" ? false : true);
1660
1661 if (this.slides.length > 0)
1662 {
1663 var slide = this.slides[this.slide_number];
1664
1665 if (this.slide_number > 0)
1666 {
1667 this.set_visibility_all_incremental("visible");
1668 this.last_shown = this.previous_incremental_item(null);
1669 this.set_eos_status(true);
1670 }
1671 else
1672 {
1673 this.last_shown = null;
1674 this.set_visibility_all_incremental("hidden");
1675 this.set_eos_status(!this.next_incremental_item(this.last_shown));
1676 }
1677
1678 this.set_location();
1679 this.add_class(this.slides[0], "first-slide");
1680 w3c_slidy.show_slide(slide);
1681 }
1682
1683 this.toc = this.table_of_contents();
1684
1685 this.add_initial_prompt();
1686
1687 // bind event handlers without interfering with custom page scripts
1688 // Tap events behave too weirdly to support clicks reliably on
1689 // iPhone and iPad, so exclude these from click handler
1690
1691 if (!this.keyboardless)
1692 this.add_listener(document.body, "click", this.mouse_button_click);
1693
1694 this.add_listener(document, "keydown", this.key_down);
1695 this.add_listener(document, "keypress", this.key_press);
1696 this.add_listener(window, "resize", this.resized);
1697 this.add_listener(window, "scroll", this.scrolled);
1698 this.add_listener(window, "unload", this.unloaded);
1699
1700 // this seems to be a debugging hack
1701 //if (!document.body.onclick)
1702 // document.body.onclick = function () { };
1703
1704 this.single_slide_view();
1705
1706 //this.set_location();
1707
1708 this.resized();
1709
1710 if (this.ie7)
1711 setTimeout(w3c_slidy.ie_hack, 100);
1712
1713 this.show_toolbar();
1714
1715 // for back button detection
1716 setInterval(function () { w3c_slidy.check_location(); }, 200);
1717 w3c_slidy.initialized = true;
1718 },
1719
1720 // create div element with links to each slide
1721 table_of_contents: function () {
1722 var toc = this.create_element("div");
1723 this.add_class(toc, "slidy_toc hidden");
1724 //toc.setAttribute("tabindex", "0");
1725
1726 var heading = this.create_element("div");
1727 this.add_class(heading, "toc-heading");
1728 heading.innerHTML = this.localize("Table of Contents");
1729
1730 toc.appendChild(heading);
1731 var previous = null;
1732
1733 for (var i = 0; i < this.slides.length; ++i)
1734 {
1735 var title = this.has_class(this.slides[i], "title");
1736 var num = document.createTextNode((i + 1) + ". ");
1737
1738 toc.appendChild(num);
1739
1740 var a = this.create_element("a");
1741 a.setAttribute("href", "#(" + (i+1) + ")");
1742
1743 if (title)
1744 this.add_class(a, "titleslide");
1745
1746 var name = document.createTextNode(this.slide_name(i));
1747 a.appendChild(name);
1748 a.onclick = w3c_slidy.toc_click;
1749 a.onkeydown = w3c_slidy.toc_key_down;
1750 a.previous = previous;
1751
1752 if (previous)
1753 previous.next = a;
1754
1755 toc.appendChild(a);
1756
1757 if (i == 0)
1758 toc.first = a;
1759
1760 if (i < this.slides.length - 1)
1761 {
1762 var br = this.create_element("br");
1763 toc.appendChild(br);
1764 }
1765
1766 previous = a;
1767 }
1768
1769 toc.focus = function () {
1770 if (this.first)
1771 this.first.focus();
1772 }
1773
1774 toc.onmouseup = w3c_slidy.mouse_button_up;
1775
1776 toc.onclick = function (e) {
1777 e||(e=window.event);
1778
1779 if (w3c_slidy.selected_text_len <= 0)
1780 w3c_slidy.hide_table_of_contents(true);
1781
1782 w3c_slidy.stop_propagation(e);
1783
1784 if (e.cancel != undefined)
1785 e.cancel = true;
1786
1787 if (e.returnValue != undefined)
1788 e.returnValue = false;
1789
1790 return false;
1791 };
1792
1793 document.body.insertBefore(toc, document.body.firstChild);
1794 return toc;
1795 },
1796
1797 is_shown_toc: function () {
1798 return !w3c_slidy.has_class(w3c_slidy.toc, "hidden");
1799 },
1800
1801 show_table_of_contents: function () {
1802 w3c_slidy.remove_class(w3c_slidy.toc, "hidden");
1803 var toc = w3c_slidy.toc;
1804 toc.focus();
1805
1806 if (w3c_slidy.ie7 && w3c_slidy.slide_number == 0)
1807 setTimeout(w3c_slidy.ie_hack, 100);
1808 },
1809
1810 hide_table_of_contents: function (focus) {
1811 w3c_slidy.add_class(w3c_slidy.toc, "hidden");
1812
1813 if (focus && !w3c_slidy.opera)
1814 w3c_slidy.help_anchor.focus();
1815 },
1816
1817 toggle_table_of_contents: function () {
1818 if (w3c_slidy.is_shown_toc())
1819 w3c_slidy.hide_table_of_contents(true);
1820 else
1821 w3c_slidy.show_table_of_contents();
1822 },
1823
1824 // called on clicking toc entry
1825 toc_click: function (e) {
1826 if (!e)
1827 e = window.event;
1828
1829 var target = w3c_slidy.get_target(e);
1830
1831 if (target && target.nodeType == 1)
1832 {
1833 var uri = target.getAttribute("href");
1834
1835 if (uri)
1836 {
1837 //alert("going to " + uri);
1838 var slide = w3c_slidy.slides[w3c_slidy.slide_number];
1839 w3c_slidy.hide_slide(slide);
1840 w3c_slidy.slide_number = w3c_slidy.find_slide_number(uri);
1841 slide = w3c_slidy.slides[w3c_slidy.slide_number];
1842 w3c_slidy.last_shown = null;
1843 w3c_slidy.set_location();
1844 w3c_slidy.set_visibility_all_incremental("hidden");
1845 w3c_slidy.set_eos_status(!w3c_slidy.next_incremental_item(w3c_slidy.last_shown));
1846 w3c_slidy.show_slide(slide);
1847 //target.focus();
1848
1849 try
1850 {
1851 if (!w3c_slidy.opera)
1852 w3c_slidy.help_anchor.focus();
1853 }
1854 catch (e)
1855 {
1856 }
1857 }
1858 }
1859
1860 w3c_slidy.hide_table_of_contents(true);
1861 if (w3c_slidy.ie7) w3c_slidy.ie_hack();
1862 w3c_slidy.stop_propagation(e);
1863 return w3c_slidy.cancel(e);
1864 },
1865
1866 // called onkeydown for toc entry
1867 toc_key_down: function (event) {
1868 var key;
1869
1870 if (!event)
1871 var event = window.event;
1872
1873 // kludge around NS/IE differences
1874 if (window.event)
1875 key = window.event.keyCode;
1876 else if (event.which)
1877 key = event.which;
1878 else
1879 return true; // Yikes! unknown browser
1880
1881 // ignore event if key value is zero
1882 // as for alt on Opera and Konqueror
1883 if (!key)
1884 return true;
1885
1886 // check for concurrent control/command/alt key
1887 // but are these only present on mouse events?
1888
1889 if (event.ctrlKey || event.altKey)
1890 return true;
1891
1892 if (key == 13)
1893 {
1894 var uri = this.getAttribute("href");
1895
1896 if (uri)
1897 {
1898 //alert("going to " + uri);
1899 var slide = w3c_slidy.slides[w3c_slidy.slide_number];
1900 w3c_slidy.hide_slide(slide);
1901 w3c_slidy.slide_number = w3c_slidy.find_slide_number(uri);
1902 slide = w3c_slidy.slides[w3c_slidy.slide_number];
1903 w3c_slidy.last_shown = null;
1904 w3c_slidy.set_location();
1905 w3c_slidy.set_visibility_all_incremental("hidden");
1906 w3c_slidy.set_eos_status(!w3c_slidy.next_incremental_item(w3c_slidy.last_shown));
1907 w3c_slidy.show_slide(slide);
1908 //target.focus();
1909
1910 try
1911 {
1912 if (!w3c_slidy.opera)
1913 w3c_slidy.help_anchor.focus();
1914 }
1915 catch (e)
1916 {
1917 }
1918 }
1919
1920 w3c_slidy.hide_table_of_contents(true);
1921
1922 if (self.ie7)
1923 w3c_slidy.ie_hack();
1924
1925 return w3c_slidy.cancel(event);
1926 }
1927
1928 if (key == 40 && this.next)
1929 {
1930 this.next.focus();
1931 return w3c_slidy.cancel(event);
1932 }
1933
1934 if (key == 38 && this.previous)
1935 {
1936 this.previous.focus();
1937 return w3c_slidy.cancel(event);
1938 }
1939
1940 return true;
1941 },
1942
1943
1944 // ### OBSOLETE ###
1945 before_print: function () {
1946 this.show_all_slides();
1947 this.hide_toolbar();
1948 alert("before print");
1949 },
1950
1951 // ### OBSOLETE ###
1952 after_print: function () {
1953 if (!this.view_all)
1954 {
1955 this.single_slide_view();
1956 this.show_toolbar();
1957 }
1958 alert("after print");
1959 },
1960
1961 // ### OBSOLETE ###
1962 print_slides: function () {
1963 this.before_print();
1964 window.print();
1965 this.after_print();
1966 },
1967
1968 // ### OBSOLETE ?? ###
1969 toggle_view: function () {
1970 if (this.view_all)
1971 {
1972 this.single_slide_view();
1973 this.show_toolbar();
1974 this.view_all = 0;
1975 }
1976 else
1977 {
1978 this.show_all_slides();
1979 this.hide_toolbar();
1980 this.view_all = 1;
1981 }
1982 },
1983
1984 // prepare for printing ### OBSOLETE ###
1985 show_all_slides: function () {
1986 this.remove_class(document.body, "single_slide");
1987 this.set_visibility_all_incremental("visible");
1988 },
1989
1990 // restore after printing ### OBSOLETE ###
1991 single_slide_view: function () {
1992 this.add_class(document.body, "single_slide");
1993 this.set_visibility_all_incremental("visible");
1994 this.last_shown = this.previous_incremental_item(null);
1995 },
1996
1997 // suppress IE's image toolbar pop up
1998 hide_image_toolbar: function () {
1999 if (!this.ns_pos)
2000 {
2001 var images = document.getElementsByTagName("IMG");
2002
2003 for (var i = 0; i < images.length; ++i)
2004 images[i].setAttribute("galleryimg", "no");
2005 }
2006 },
2007
2008 unloaded: function (e) {
2009 //alert("unloaded");
2010 },
2011
2012 // Safari and Konqueror don't yet support getComputedStyle()
2013 // and they always reload page when location.href is updated
2014 is_KHTML: function () {
2015 var agent = navigator.userAgent;
2016 return (agent.indexOf("KHTML") >= 0 ? true : false);
2017 },
2018
2019 // find slide name from first h1 element
2020 // default to document title + slide number
2021 slide_name: function (index) {
2022 var name = null;
2023 var slide = this.slides[index];
2024
2025 var heading = this.find_heading(slide);
2026
2027 if (heading)
2028 name = this.extract_text(heading);
2029
2030 if (!name)
2031 name = this.title + "(" + (index + 1) + ")";
2032
2033 name.replace(/\&/g, "&amp;");
2034 name.replace(/\</g, "&lt;");
2035 name.replace(/\>/g, "&gt;");
2036
2037 return name;
2038 },
2039
2040 // find first h1 element in DOM tree
2041 find_heading: function (node) {
2042 if (!node || node.nodeType != 1)
2043 return null;
2044
2045 if (node.nodeName == "H1" || node.nodeName == "h1")
2046 return node;
2047
2048 var child = node.firstChild;
2049
2050 while (child)
2051 {
2052 node = this.find_heading(child);
2053
2054 if (node)
2055 return node;
2056
2057 child = child.nextSibling;
2058 }
2059
2060 return null;
2061 },
2062
2063 // recursively extract text from DOM tree
2064 extract_text: function (node) {
2065 if (!node)
2066 return "";
2067
2068 // text nodes
2069 if (node.nodeType == 3)
2070 return node.nodeValue;
2071
2072 // elements
2073 if (node.nodeType == 1)
2074 {
2075 node = node.firstChild;
2076 var text = "";
2077
2078 while (node)
2079 {
2080 text = text + this.extract_text(node);
2081 node = node.nextSibling;
2082 }
2083
2084 return text;
2085 }
2086
2087 return "";
2088 },
2089
2090 // find copyright text from meta element
2091 find_copyright: function () {
2092 var name, content;
2093 var meta = document.getElementsByTagName("meta");
2094
2095 for (var i = 0; i < meta.length; ++i)
2096 {
2097 name = meta[i].getAttribute("name");
2098 content = meta[i].getAttribute("content");
2099
2100 if (name == "copyright")
2101 return content;
2102 }
2103
2104 return null;
2105 },
2106
2107 find_size_adjust: function () {
2108 var name, content, offset;
2109 var meta = document.getElementsByTagName("meta");
2110
2111 for (var i = 0; i < meta.length; ++i)
2112 {
2113 name = meta[i].getAttribute("name");
2114 content = meta[i].getAttribute("content");
2115
2116 if (name == "font-size-adjustment")
2117 return 1 * content;
2118 }
2119
2120 return 1;
2121 },
2122
2123 // <meta name="duration" content="20" /> for 20 minutes
2124 find_duration: function () {
2125 var name, content, offset;
2126 var meta = document.getElementsByTagName("meta");
2127
2128 for (var i = 0; i < meta.length; ++i)
2129 {
2130 name = meta[i].getAttribute("name");
2131 content = meta[i].getAttribute("content");
2132
2133 if (name == "duration")
2134 return 60000 * content;
2135 }
2136
2137 return null;
2138 },
2139
2140 replace_by_non_breaking_space: function (str) {
2141 for (var i = 0; i < str.length; ++i)
2142 str[i] = 160;
2143 },
2144
2145 // ### CHECK ME ### is use of "li" okay for text/html?
2146 // for XHTML do we also need to specify namespace?
2147 init_outliner: function () {
2148 var items = document.getElementsByTagName("li");
2149
2150 for (var i = 0; i < items.length; ++i)
2151 {
2152 var target = items[i];
2153
2154 if (!this.has_class(target.parentNode, "outline"))
2155 continue;
2156
2157 target.onclick = this.outline_click;
2158 /* ### more work needed for IE6
2159 if (!this.ns_pos)
2160 {
2161 target.onmouseover = this.hover_outline;
2162 target.onmouseout = this.unhover_outline;
2163 }
2164 */
2165 if (this.foldable(target))
2166 {
2167 target.foldable = true;
2168 target.onfocus = function () {w3c_slidy.outline = this;};
2169 target.onblur = function () {w3c_slidy.outline = null;};
2170
2171 if (!target.getAttribute("tabindex"))
2172 target.setAttribute("tabindex", "0");
2173
2174 if (this.has_class(target, "expand"))
2175 this.unfold(target);
2176 else
2177 this.fold(target);
2178 }
2179 else
2180 {
2181 this.add_class(target, "nofold");
2182 target.visible = true;
2183 target.foldable = false;
2184 }
2185 }
2186 },
2187
2188 foldable: function (item) {
2189 if (!item || item.nodeType != 1)
2190 return false;
2191
2192 var node = item.firstChild;
2193
2194 while (node)
2195 {
2196 if (node.nodeType == 1 && this.is_block(node))
2197 return true;
2198
2199 node = node.nextSibling;
2200 }
2201
2202 return false;
2203 },
2204
2205 // ### CHECK ME ### switch to add/remove "hidden" class
2206 fold: function (item) {
2207 if (item)
2208 {
2209 this.remove_class(item, "unfolded");
2210 this.add_class(item, "folded");
2211 }
2212
2213 var node = item ? item.firstChild : null;
2214
2215 while (node)
2216 {
2217 if (node.nodeType == 1 && this.is_block(node)) // element
2218 {
2219 w3c_slidy.add_class(node, "hidden");
2220 }
2221
2222 node = node.nextSibling;
2223 }
2224
2225 item.visible = false;
2226 },
2227
2228 // ### CHECK ME ### switch to add/remove "hidden" class
2229 unfold: function (item) {
2230 if (item)
2231 {
2232 this.add_class(item, "unfolded");
2233 this.remove_class(item, "folded");
2234 }
2235
2236 var node = item ? item.firstChild : null;
2237
2238 while (node)
2239 {
2240 if (node.nodeType == 1 && this.is_block(node)) // element
2241 {
2242 w3c_slidy.remove_class(node, "hidden");
2243 }
2244
2245 node = node.nextSibling;
2246 }
2247
2248 item.visible = true;
2249 },
2250
2251 outline_click: function (e) {
2252 if (!e)
2253 e = window.event;
2254
2255 var rightclick = false;
2256 var target = w3c_slidy.get_target(e);
2257
2258 while (target && target.visible == undefined)
2259 target = target.parentNode;
2260
2261 if (!target)
2262 return true;
2263
2264 if (e.which)
2265 rightclick = (e.which == 3);
2266 else if (e.button)
2267 rightclick = (e.button == 2);
2268
2269 if (!rightclick && target.visible != undefined)
2270 {
2271 if (target.foldable)
2272 {
2273 if (target.visible)
2274 w3c_slidy.fold(target);
2275 else
2276 w3c_slidy.unfold(target);
2277 }
2278
2279 w3c_slidy.stop_propagation(e);
2280 e.cancel = true;
2281 e.returnValue = false;
2282 }
2283
2284 return false;
2285 },
2286
2287 add_initial_prompt: function () {
2288 var prompt = this.create_element("div");
2289 prompt.setAttribute("class", "initial_prompt");
2290
2291 var p1 = this.create_element("p");
2292 prompt.appendChild(p1);
2293 p1.setAttribute("class", "help");
2294
2295 if (this.keyboardless)
2296 p1.innerHTML = "Tap footer to move to next slide";
2297 else
2298 p1.innerHTML = "Space or Right Arrow to move to next " +
2299 "slide, M to see keys mapping, click help below for more details";
2300
2301 this.add_listener(prompt, "click", function (e) {
2302 document.body.removeChild(prompt);
2303 w3c_slidy.stop_propagation(e);
2304
2305 if (e.cancel != undefined)
2306 e.cancel = true;
2307
2308 if (e.returnValue != undefined)
2309 e.returnValue = false;
2310
2311 return false;
2312 });
2313
2314 document.body.appendChild(prompt);
2315 this.initial_prompt = prompt;
2316 setTimeout(function() {document.body.removeChild(prompt);}, 5000);
2317 },
2318
2319 add_toolbar: function () {
2320 var counter, page;
2321
2322 this.toolbar = this.create_element("div");
2323 this.toolbar.setAttribute("class", "toolbar");
2324
2325 // a reasonably behaved browser
2326 if (this.ns_pos || !this.ie6)
2327 {
2328 var right = this.create_element("div");
2329 right.setAttribute("style", "float: right; text-align: right");
2330
2331 counter = this.create_element("span")
2332 counter.innerHTML = this.localize("slide") + " n/m";
2333 right.appendChild(counter);
2334 this.toolbar.appendChild(right);
2335
2336 var left = this.create_element("div");
2337 left.setAttribute("style", "text-align: left");
2338
2339 // global end of slide indicator
2340 this.eos = this.create_element("span");
2341 this.eos.innerHTML = "* ";
2342 left.appendChild(this.eos);
2343
2344 var help = this.create_element("a");
2345 help.setAttribute("href", this.help_page);
2346 help.setAttribute("title", this.localize(this.help_text));
2347 help.innerHTML = this.localize("help?");
2348 left.appendChild(help);
2349 this.help_anchor = help; // save for focus hack
2350
2351 var gap1 = document.createTextNode(" ");
2352 left.appendChild(gap1);
2353
2354 var contents = this.create_element("a");
2355 contents.setAttribute("href", "javascript:w3c_slidy.toggle_table_of_contents()");
2356 contents.setAttribute("title", this.localize("table of contents"));
2357 contents.innerHTML = this.localize("contents?");
2358 left.appendChild(contents);
2359
2360 var gap2 = document.createTextNode(" ");
2361 left.appendChild(gap2);
2362
2363 var copyright = this.find_copyright();
2364
2365 if (copyright)
2366 {
2367 var span = this.create_element("span");
2368 span.className = "copyright";
2369 span.innerHTML = copyright;
2370 left.appendChild(span);
2371 }
2372
2373 this.toolbar.setAttribute("tabindex", "0");
2374 this.toolbar.appendChild(left);
2375 }
2376 else // IE6 so need to work around its poor CSS support
2377 {
2378 this.toolbar.style.position = (this.ie7 ? "fixed" : "absolute");
2379 this.toolbar.style.zIndex = "200";
2380 this.toolbar.style.width = "99.9%";
2381 this.toolbar.style.height = "1.2em";
2382 this.toolbar.style.top = "auto";
2383 this.toolbar.style.bottom = "0";
2384 this.toolbar.style.left = "0";
2385 this.toolbar.style.right = "0";
2386 this.toolbar.style.textAlign = "left";
2387 this.toolbar.style.fontSize = "60%";
2388 this.toolbar.style.color = "red";
2389 this.toolbar.borderWidth = 0;
2390 this.toolbar.className = "toolbar";
2391 this.toolbar.style.background = "rgb(240,240,240)";
2392
2393 // would like to have help text left aligned
2394 // and page counter right aligned, floating
2395 // div's don't work, so instead use nested
2396 // absolutely positioned div's.
2397
2398 var sp = this.create_element("span");
2399 sp.innerHTML = "&nbsp;&nbsp;*&nbsp;";
2400 this.toolbar.appendChild(sp);
2401 this.eos = sp; // end of slide indicator
2402
2403 var help = this.create_element("a");
2404 help.setAttribute("href", this.help_page);
2405 help.setAttribute("title", this.localize(this.help_text));
2406 help.innerHTML = this.localize("help?");
2407 this.toolbar.appendChild(help);
2408 this.help_anchor = help; // save for focus hack
2409
2410 var gap1 = document.createTextNode(" ");
2411 this.toolbar.appendChild(gap1);
2412
2413 var contents = this.create_element("a");
2414 contents.setAttribute("href", "javascript:toggleTableOfContents()");
2415 contents.setAttribute("title", this.localize("table of contents".localize));
2416 contents.innerHTML = this.localize("contents?");
2417 this.toolbar.appendChild(contents);
2418
2419 var gap2 = document.createTextNode(" ");
2420 this.toolbar.appendChild(gap2);
2421
2422 var copyright = this.find_copyright();
2423
2424 if (copyright)
2425 {
2426 var span = this.create_element("span");
2427 span.innerHTML = copyright;
2428 span.style.color = "black";
2429 span.style.marginLeft = "0.5em";
2430 this.toolbar.appendChild(span);
2431 }
2432
2433 counter = this.create_element("div")
2434 counter.style.position = "absolute";
2435 counter.style.width = "auto"; //"20%";
2436 counter.style.height = "1.2em";
2437 counter.style.top = "auto";
2438 counter.style.bottom = 0;
2439 counter.style.right = "0";
2440 counter.style.textAlign = "right";
2441 counter.style.color = "red";
2442 counter.style.background = "rgb(240,240,240)";
2443
2444 counter.innerHTML = this.localize("slide") + " n/m";
2445 this.toolbar.appendChild(counter);
2446 }
2447
2448 // ensure that click isn't passed through to the page
2449 this.toolbar.onclick =
2450 function (e) {
2451 if (!e)
2452 e = window.event;
2453
2454 var target = e.target;
2455
2456 if (!target && e.srcElement)
2457 target = e.srcElement;
2458
2459 // work around Safari bug
2460 if (target && target.nodeType == 3)
2461 target = target.parentNode;
2462
2463 w3c_slidy.stop_propagation(e);
2464
2465 if (target && target.nodeName.toLowerCase() != "a")
2466 w3c_slidy.mouse_button_click(e);
2467 };
2468
2469 this.slide_number_element = counter;
2470 this.set_eos_status(false);
2471 document.body.appendChild(this.toolbar);
2472 },
2473
2474 // wysiwyg editors make it hard to use div elements
2475 // e.g. amaya loses the div when you copy and paste
2476 // this function wraps div elements around implicit
2477 // slides which start with an h1 element and continue
2478 // up to the next heading or div element
2479 wrap_implicit_slides: function () {
2480 var i, heading, node, next, div;
2481 var headings = document.getElementsByTagName("h1");
2482
2483 if (!headings)
2484 return;
2485
2486 for (i = 0; i < headings.length; ++i)
2487 {
2488 heading = headings[i];
2489
2490 if (heading.parentNode != document.body)
2491 continue;
2492
2493 node = heading.nextSibling;
2494
2495 div = document.createElement("div");
2496 this.add_class(div, "slide");
2497 document.body.replaceChild(div, heading);
2498 div.appendChild(heading);
2499
2500 while (node)
2501 {
2502 if (node.nodeType == 1 && // an element
2503 (node.nodeName == "H1" ||
2504 node.nodeName == "h1" ||
2505 node.nodeName == "DIV" ||
2506 node.nodeName == "div"))
2507 break;
2508
2509 next = node.nextSibling;
2510 node = document.body.removeChild(node);
2511 div.appendChild(node);
2512 node = next;
2513 }
2514 }
2515 },
2516
2517 // return new array of all slides
2518 collect_slides: function () {
2519 var slides = new Array();
2520 var divs = document.body.getElementsByTagName("div");
2521
2522 for (var i = 0; i < divs.length; ++i)
2523 {
2524 div = divs.item(i);
2525
2526 if (this.has_class(div, "slide"))
2527 {
2528 // add slide to collection
2529 slides[slides.length] = div;
2530
2531 // hide each slide as it is found
2532 this.add_class(div, "hidden");
2533
2534 // add dummy <br/> at end for scrolling hack
2535 var node1 = document.createElement("br");
2536 div.appendChild(node1);
2537 var node2 = document.createElement("br");
2538 div.appendChild(node2);
2539 }
2540 else if (this.has_class(div, "background"))
2541 { // work around for Firefox SVG reload bug
2542 // which otherwise replaces 1st SVG graphic with 2nd
2543 div.style.display = "block";
2544 }
2545 }
2546
2547 this.slides = slides;
2548 },
2549
2550 // return new array of all <div class="handout">
2551 collect_notes: function () {
2552 var notes = new Array();
2553 var divs = document.body.getElementsByTagName("div");
2554
2555 for (var i = 0; i < divs.length; ++i)
2556 {
2557 div = divs.item(i);
2558
2559 if (this.has_class(div, "handout"))
2560 {
2561 // add note to collection
2562 notes[notes.length] = div;
2563
2564 // and hide it
2565 this.add_class(div, "hidden");
2566 }
2567 }
2568
2569 this.notes = notes;
2570 },
2571
2572 // return new array of all <div class="background">
2573 // including named backgrounds e.g. class="background titlepage"
2574 collect_backgrounds: function () {
2575 var backgrounds = new Array();
2576 var divs = document.body.getElementsByTagName("div");
2577
2578 for (var i = 0; i < divs.length; ++i)
2579 {
2580 div = divs.item(i);
2581
2582 if (this.has_class(div, "background"))
2583 {
2584 // add background to collection
2585 backgrounds[backgrounds.length] = div;
2586
2587 // and hide it
2588 this.add_class(div, "hidden");
2589 }
2590 }
2591
2592 this.backgrounds = backgrounds;
2593 },
2594
2595 // set click handlers on all anchors
2596 patch_anchors: function () {
2597 var self = w3c_slidy;
2598 var handler = function (event) {
2599 // compare this.href with location.href
2600 // for link to another slide in this doc
2601
2602 if (self.page_address(this.href) == self.page_address(location.href))
2603 {
2604 // yes, so find new slide number
2605 var newslidenum = self.find_slide_number(this.href);
2606
2607 if (newslidenum != self.slide_number)
2608 {
2609 var slide = self.slides[self.slide_number];
2610 self.hide_slide(slide);
2611 self.slide_number = newslidenum;
2612 slide = self.slides[self.slide_number];
2613 self.show_slide(slide);
2614 self.set_location();
2615 }
2616 }
2617 else
2618 w3c_slidy.stop_propagation(event);
2619
2620 // else if (this.target == null)
2621 // location.href = this.href;
2622
2623 this.blur();
2624 self.disable_slide_click = true;
2625 };
2626
2627 var anchors = document.body.getElementsByTagName("a");
2628
2629 for (var i = 0; i < anchors.length; ++i)
2630 {
2631 if (window.addEventListener)
2632 anchors[i].addEventListener("click", handler, false);
2633 else
2634 anchors[i].attachEvent("onclick", handler);
2635 }
2636 },
2637
2638 // ### CHECK ME ### see which functions are invoked via setTimeout
2639 // either directly or indirectly for use of w3c_slidy vs this
2640 show_slide_number: function () {
2641 var timer = w3c_slidy.get_timer();
2642 w3c_slidy.slide_number_element.innerHTML = timer + w3c_slidy.localize("slide") + " " +
2643 (w3c_slidy.slide_number + 1) + "/" + w3c_slidy.slides.length;
2644 },
2645
2646 // every 200mS check if the location has been changed as a
2647 // result of the user activating the Back button/menu item
2648 // doesn't work for Opera < 9.5
2649 check_location: function () {
2650 var hash = location.hash;
2651
2652 if (w3c_slidy.slide_number > 0 && (hash == "" || hash == "#"))
2653 w3c_slidy.goto_slide(0);
2654 else if (hash.length > 2 && hash != "#("+(w3c_slidy.slide_number+1)+")")
2655 {
2656 var num = parseInt(location.hash.substr(2));
2657
2658 if (!isNaN(num))
2659 w3c_slidy.goto_slide(num-1);
2660 }
2661
2662 if (w3c_slidy.time_left && w3c_slidy.slide_number > 0)
2663 {
2664 w3c_slidy.show_slide_number();
2665
2666 if (w3c_slidy.time_left > 0)
2667 w3c_slidy.time_left -= 200;
2668 }
2669 },
2670
2671 get_timer: function () {
2672 var timer = "";
2673 if (w3c_slidy.time_left)
2674 {
2675 var mins, secs;
2676 secs = Math.floor(w3c_slidy.time_left/1000);
2677 mins = Math.floor(secs / 60);
2678 secs = secs % 60;
2679 timer = (mins ? mins+"m" : "") + secs + "s ";
2680 }
2681
2682 return timer;
2683 },
2684
2685 // this doesn't push location onto history stack for IE
2686 // for which a hidden iframe hack is needed: load page into
2687 // the iframe with script that set's parent's location.hash
2688 // but that won't work for standalone use unless we can
2689 // create the page dynamically via a javascript: URL
2690 set_location: function () {
2691 var uri = w3c_slidy.page_address(location.href);
2692 var hash = "#(" + (w3c_slidy.slide_number+1) + ")";
2693
2694 if (w3c_slidy.slide_number >= 0)
2695 uri = uri + hash;
2696
2697 if (w3c_slidy.ie && !w3c_slidy.ie8)
2698 w3c_slidy.push_hash(hash);
2699
2700 if (uri != location.href) // && !khtml
2701 location.href = uri;
2702
2703 if (this.khtml)
2704 hash = "(" + (w3c_slidy.slide_number+1) + ")";
2705
2706 if (!this.ie && location.hash != hash && location.hash != "")
2707 location.hash = hash;
2708
2709 document.title = w3c_slidy.title + " (" + (w3c_slidy.slide_number+1) + ")";
2710 w3c_slidy.show_slide_number();
2711 },
2712
2713 page_address: function (uri) {
2714 var i = uri.indexOf("#");
2715
2716 if (i < 0)
2717 i = uri.indexOf("%23");
2718
2719 // check if anchor is entire page
2720
2721 if (i < 0)
2722 return uri; // yes
2723
2724 return uri.substr(0, i);
2725 },
2726
2727 // only used for IE6 and IE7
2728 on_frame_loaded: function (hash) {
2729 location.hash = hash;
2730 var uri = w3c_slidy.page_address(location.href);
2731 location.href = uri + hash;
2732 },
2733
2734 // history hack with thanks to Bertrand Le Roy
2735 push_hash: function (hash) {
2736 if (hash == "") hash = "#(1)";
2737 window.location.hash = hash;
2738
2739 var doc = document.getElementById("historyFrame").contentWindow.document;
2740 },
2741
2742 // find current slide based upon location
2743 // first find target anchor and then look
2744 // for associated div element enclosing it
2745 // finally map that to slide number
2746 find_slide_number: function (uri) {
2747 // first get anchor from page location
2748
2749 var i = uri.indexOf("#");
2750
2751 // check if anchor is entire page
2752 if (i < 0)
2753 return 0; // yes
2754
2755 var anchor = unescape(uri.substr(i+1));
2756
2757 // now use anchor as XML ID to find target
2758 var target = document.getElementById(anchor);
2759
2760 if (!target)
2761 {
2762 // does anchor look like "(2)" for slide 2 ??
2763 // where first slide is (1)
2764 var re = /\((\d)+\)/;
2765
2766 if (anchor.match(re))
2767 {
2768 var num = parseInt(anchor.substring(1, anchor.length-1));
2769
2770 if (num > this.slides.length)
2771 num = 1;
2772
2773 if (--num < 0)
2774 num = 0;
2775
2776 return num;
2777 }
2778
2779 // accept [2] for backwards compatibility
2780 re = /\[(\d)+\]/;
2781
2782 if (anchor.match(re))
2783 {
2784 var num = parseInt(anchor.substring(1, anchor.length-1));
2785
2786 if (num > this.slides.length)
2787 num = 1;
2788
2789 if (--num < 0)
2790 num = 0;
2791
2792 return num;
2793 }
2794
2795 // oh dear unknown anchor
2796 return 0;
2797 }
2798
2799 // search for enclosing slide
2800
2801 while (true)
2802 {
2803 // browser coerces html elements to uppercase!
2804 if (target.nodeName.toLowerCase() == "div" &&
2805 this.has_class(target, "slide"))
2806 {
2807 // found the slide element
2808 break;
2809 }
2810
2811 // otherwise try parent element if any
2812
2813 target = target.parentNode;
2814
2815 if (!target)
2816 {
2817 return 0; // no luck!
2818 }
2819 };
2820
2821 for (i = 0; i < slides.length; ++i)
2822 {
2823 if (slides[i] == target)
2824 return i; // success
2825 }
2826
2827 // oh dear still no luck
2828 return 0;
2829 },
2830
2831 previous_slide: function (incremental) {
2832 if (!w3c_slidy.view_all)
2833 {
2834 var slide;
2835
2836 //jmi
2837 if (!w3c_slidy.incremental_display) {incremental = false;}
2838
2839 if ((incremental || w3c_slidy.slide_number == 0) && w3c_slidy.last_shown != null)
2840 {
2841 w3c_slidy.last_shown = w3c_slidy.hide_previous_item(w3c_slidy.last_shown);
2842 w3c_slidy.set_eos_status(false);
2843 }
2844 else if (w3c_slidy.slide_number > 0)
2845 {
2846 slide = w3c_slidy.slides[w3c_slidy.slide_number];
2847 w3c_slidy.hide_slide(slide);
2848
2849 w3c_slidy.slide_number = w3c_slidy.slide_number - 1;
2850 slide = w3c_slidy.slides[w3c_slidy.slide_number];
2851 w3c_slidy.set_visibility_all_incremental("visible");
2852 w3c_slidy.last_shown = w3c_slidy.previous_incremental_item(null);
2853 w3c_slidy.set_eos_status(true);
2854 w3c_slidy.show_slide(slide);
2855 }
2856
2857 w3c_slidy.set_location();
2858
2859 if (!w3c_slidy.ns_pos)
2860 w3c_slidy.refresh_toolbar(200);
2861 }
2862 },
2863
2864 next_slide: function (incremental) {
2865 if (!w3c_slidy.view_all)
2866 {
2867 var slide, last = w3c_slidy.last_shown;
2868 //jmi
2869 if (!w3c_slidy.incremental_display) {incremental = false;}
2870
2871 if (incremental || w3c_slidy.slide_number == w3c_slidy.slides.length - 1)
2872 w3c_slidy.last_shown = w3c_slidy.reveal_next_item(w3c_slidy.last_shown);
2873
2874 if ((!incremental || w3c_slidy.last_shown == null) &&
2875 w3c_slidy.slide_number < w3c_slidy.slides.length - 1)
2876 {
2877 slide = w3c_slidy.slides[w3c_slidy.slide_number];
2878 w3c_slidy.hide_slide(slide);
2879
2880 w3c_slidy.slide_number = w3c_slidy.slide_number + 1;
2881 slide = w3c_slidy.slides[w3c_slidy.slide_number];
2882 w3c_slidy.last_shown = null;
2883 w3c_slidy.set_visibility_all_incremental("hidden");
2884 w3c_slidy.show_slide(slide);
2885 }
2886 else if (!w3c_slidy.last_shown)
2887 {
2888 if (last && incremental)
2889 w3c_slidy.last_shown = last;
2890 }
2891
2892 w3c_slidy.set_location();
2893
2894 w3c_slidy.set_eos_status(!w3c_slidy.next_incremental_item(w3c_slidy.last_shown));
2895
2896 if (!w3c_slidy.ns_pos)
2897 w3c_slidy.refresh_toolbar(200);
2898 }
2899 },
2900
2901 // to first slide with nothing revealed
2902 // i.e. state at start of presentation
2903 first_slide: function () {
2904 if (!w3c_slidy.view_all)
2905 {
2906 var slide;
2907
2908 if (w3c_slidy.slide_number != 0)
2909 {
2910 slide = w3c_slidy.slides[w3c_slidy.slide_number];
2911 w3c_slidy.hide_slide(slide);
2912
2913 w3c_slidy.slide_number = 0;
2914 slide = w3c_slidy.slides[w3c_slidy.slide_number];
2915 w3c_slidy.last_shown = null;
2916 w3c_slidy.set_visibility_all_incremental("hidden");
2917 w3c_slidy.show_slide(slide);
2918 }
2919
2920 w3c_slidy.set_eos_status(
2921 !w3c_slidy.next_incremental_item(w3c_slidy.last_shown));
2922 w3c_slidy.set_location();
2923 }
2924 },
2925
2926 // goto last slide with everything revealed
2927 // i.e. state at end of presentation
2928 last_slide: function () {
2929 if (!w3c_slidy.view_all)
2930 {
2931 var slide;
2932
2933 w3c_slidy.last_shown = null; //revealNextItem(lastShown);
2934
2935 if (w3c_slidy.last_shown == null &&
2936 w3c_slidy.slide_number < w3c_slidy.slides.length - 1)
2937 {
2938 slide = w3c_slidy.slides[w3c_slidy.slide_number];
2939 w3c_slidy.hide_slide(slide);
2940 w3c_slidy.slide_number = w3c_slidy.slides.length - 1;
2941 slide = w3c_slidy.slides[w3c_slidy.slide_number];
2942 w3c_slidy.set_visibility_all_incremental("visible");
2943 w3c_slidy.last_shown = w3c_slidy.previous_incremental_item(null);
2944
2945 w3c_slidy.show_slide(slide);
2946 }
2947 else
2948 {
2949 w3c_slidy.set_visibility_all_incremental("visible");
2950 w3c_slidy.last_shown = w3c_slidy.previous_incremental_item(null);
2951 }
2952
2953 w3c_slidy.set_eos_status(true);
2954 w3c_slidy.set_location();
2955 }
2956 },
2957
2958
2959 // ### check this and consider add/remove class
2960 set_eos_status: function (state) {
2961 if (this.eos)
2962 this.eos.style.color = (state ? "rgb(240,240,240)" : "red");
2963 },
2964
2965 // first slide is 0
2966 goto_slide: function (num) {
2967 //alert("going to slide " + (num+1));
2968 var slide = w3c_slidy.slides[w3c_slidy.slide_number];
2969 w3c_slidy.hide_slide(slide);
2970 w3c_slidy.slide_number = num;
2971 slide = w3c_slidy.slides[w3c_slidy.slide_number];
2972 w3c_slidy.last_shown = null;
2973 w3c_slidy.set_visibility_all_incremental("hidden");
2974 w3c_slidy.set_eos_status(!w3c_slidy.next_incremental_item(w3c_slidy.last_shown));
2975 document.title = w3c_slidy.title + " (" + (w3c_slidy.slide_number+1) + ")";
2976 w3c_slidy.show_slide(slide);
2977 w3c_slidy.show_slide_number();
2978 },
2979
2980
2981 show_slide: function (slide) {
2982 this.sync_background(slide);
2983 window.scrollTo(0,0);
2984 this.remove_class(slide, "hidden");
2985 },
2986
2987 hide_slide: function (slide) {
2988 this.add_class(slide, "hidden");
2989 },
2990
2991 // show just the backgrounds pertinent to this slide
2992 // when slide background-color is transparent
2993 // this should now work with rgba color values
2994 sync_background: function (slide) {
2995 var background;
2996 var bgColor;
2997
2998 if (slide.currentStyle)
2999 bgColor = slide.currentStyle["backgroundColor"];
3000 else if (document.defaultView)
3001 {
3002 var styles = document.defaultView.getComputedStyle(slide,null);
3003
3004 if (styles)
3005 bgColor = styles.getPropertyValue("background-color");
3006 else // broken implementation probably due Safari or Konqueror
3007 {
3008 //alert("defective implementation of getComputedStyle()");
3009 bgColor = "transparent";
3010 }
3011 }
3012 else
3013 bgColor == "transparent";
3014
3015 if (bgColor == "transparent" ||
3016 bgColor.indexOf("rgba") >= 0 ||
3017 bgColor.indexOf("opacity") >= 0)
3018 {
3019 var slideClass = this.get_class_list(slide);
3020
3021 for (var i = 0; i < this.backgrounds.length; i++)
3022 {
3023 background = this.backgrounds[i];
3024
3025 var bgClass = this.get_class_list(background);
3026
3027 if (this.matching_background(slideClass, bgClass))
3028 this.remove_class(background, "hidden");
3029 else
3030 this.add_class(background, "hidden");
3031 }
3032 }
3033 else // forcibly hide all backgrounds
3034 this.hide_backgrounds();
3035 },
3036
3037 hide_backgrounds: function () {
3038 for (var i = 0; i < this.backgrounds.length; i++)
3039 {
3040 background = this.backgrounds[i];
3041 this.add_class(background, "hidden");
3042 }
3043 },
3044
3045 // compare classes for slide and background
3046 matching_background: function (slideClass, bgClass) {
3047 var i, count, pattern, result;
3048
3049 // define pattern as regular expression
3050 pattern = /\w+/g;
3051
3052 // check background class names
3053 result = bgClass.match(pattern);
3054
3055 for (i = count = 0; i < result.length; i++)
3056 {
3057 if (result[i] == "hidden")
3058 continue;
3059
3060 if (result[i] == "background")
3061 continue;
3062
3063 ++count;
3064 }
3065
3066 if (count == 0) // default match
3067 return true;
3068
3069 // check for matches and place result in array
3070 result = slideClass.match(pattern);
3071
3072 // now check if desired name is present for background
3073 for (i = count = 0; i < result.length; i++)
3074 {
3075 if (result[i] == "hidden")
3076 continue;
3077
3078 if (this.has_token(bgClass, result[i]))
3079 return true;
3080 }
3081
3082 return false;
3083 },
3084
3085 resized: function () {
3086 var width = 0;
3087
3088 if ( typeof( window.innerWidth ) == 'number' )
3089 width = window.innerWidth; // Non IE browser
3090 else if (document.documentElement && document.documentElement.clientWidth)
3091 width = document.documentElement.clientWidth; // IE6
3092 else if (document.body && document.body.clientWidth)
3093 width = document.body.clientWidth; // IE4
3094
3095 var height = 0;
3096
3097 if ( typeof( window.innerHeight ) == 'number' )
3098 height = window.innerHeight; // Non IE browser
3099 else if (document.documentElement && document.documentElement.clientHeight)
3100 height = document.documentElement.clientHeight; // IE6
3101 else if (document.body && document.body.clientHeight)
3102 height = document.body.clientHeight; // IE4
3103
3104 if (height && (width/height > 1.05*1024/768))
3105 {
3106 width = height * 1024.0/768;
3107 }
3108
3109 // IE fires onresize even when only font size is changed!
3110 // so we do a check to avoid blocking < and > actions
3111 if (width != w3c_slidy.last_width || height != w3c_slidy.last_height)
3112 {
3113 if (width >= 1100)
3114 w3c_slidy.size_index = 5; // 4
3115 else if (width >= 1000)
3116 w3c_slidy.size_index = 4; // 3
3117 else if (width >= 800)
3118 w3c_slidy.size_index = 3; // 2
3119 else if (width >= 600)
3120 w3c_slidy.size_index = 2; // 1
3121 else if (width)
3122 w3c_slidy.size_index = 0;
3123
3124 // add in font size adjustment from meta element e.g.
3125 // <meta name="font-size-adjustment" content="-2" />
3126 // useful when slides have too much content ;-)
3127
3128 if (0 <= w3c_slidy.size_index + w3c_slidy.size_adjustment &&
3129 w3c_slidy.size_index + w3c_slidy.size_adjustment < w3c_slidy.sizes.length)
3130 w3c_slidy.size_index = w3c_slidy.size_index + w3c_slidy.size_adjustment;
3131
3132 // enables cross browser use of relative width/height
3133 // on object elements for use with SVG and Flash media
3134 w3c_slidy.adjust_object_dimensions(width, height);
3135
3136 if (document.body.style.fontSize != w3c_slidy.sizes[w3c_slidy.size_index])
3137 {
3138 document.body.style.fontSize = w3c_slidy.sizes[w3c_slidy.size_index];
3139 }
3140
3141 w3c_slidy.last_width = width;
3142 w3c_slidy.last_height = height;
3143
3144 // force reflow to work around Mozilla bug
3145 if (w3c_slidy.ns_pos)
3146 {
3147 var slide = w3c_slidy.slides[w3c_slidy.slide_number];
3148 w3c_slidy.hide_slide(slide);
3149 w3c_slidy.show_slide(slide);
3150 }
3151
3152 // force correct positioning of toolbar
3153 w3c_slidy.refresh_toolbar(200);
3154 }
3155 },
3156
3157 scrolled: function () {
3158 if (w3c_slidy.toolbar && !w3c_slidy.ns_pos && !w3c_slidy.ie7)
3159 {
3160 w3c_slidy.hack_offset = w3c_slidy.scroll_x_offset();
3161 // hide toolbar
3162 w3c_slidy.toolbar.style.display = "none";
3163
3164 // make it reappear later
3165 if (w3c_slidy.scrollhack == 0 && !w3c_slidy.view_all)
3166 {
3167 setTimeout(function () {w3c_slidy.show_toolbar(); }, 1000);
3168 w3c_slidy.scrollhack = 1;
3169 }
3170 }
3171 },
3172
3173 hide_toolbar: function () {
3174 w3c_slidy.add_class(w3c_slidy.toolbar, "hidden");
3175 window.focus();
3176 },
3177
3178 // used to ensure IE refreshes toolbar in correct position
3179 refresh_toolbar: function (interval) {
3180 if (!w3c_slidy.ns_pos && !w3c_slidy.ie7)
3181 {
3182 w3c_slidy.hide_toolbar();
3183 setTimeout(function () {w3c_slidy.show_toolbar(); }, interval);
3184 }
3185 },
3186
3187 // restores toolbar after short delay
3188 show_toolbar: function () {
3189 if (w3c_slidy.want_toolbar)
3190 {
3191 w3c_slidy.toolbar.style.display = "block";
3192
3193 if (!w3c_slidy.ns_pos)
3194 {
3195 // adjust position to allow for scrolling
3196 var xoffset = w3c_slidy.scroll_x_offset();
3197 w3c_slidy.toolbar.style.left = xoffset;
3198 w3c_slidy.toolbar.style.right = xoffset;
3199
3200 // determine vertical scroll offset
3201 //var yoffset = scrollYOffset();
3202
3203 // bottom is doc height - window height - scroll offset
3204 //var bottom = documentHeight() - lastHeight - yoffset
3205
3206 //if (yoffset > 0 || documentHeight() > lastHeight)
3207 // bottom += 16; // allow for height of scrollbar
3208
3209 w3c_slidy.toolbar.style.bottom = 0; //bottom;
3210 }
3211
3212 w3c_slidy.remove_class(w3c_slidy.toolbar, "hidden");
3213 }
3214
3215 w3c_slidy.scrollhack = 0;
3216
3217
3218 // set the keyboard focus to the help link on the
3219 // toolbar to ensure that document has the focus
3220 // IE doesn't always work with window.focus()
3221 // and this hack has benefit of Enter for help
3222
3223 try
3224 {
3225 if (!w3c_slidy.opera)
3226 w3c_slidy.help_anchor.focus();
3227 }
3228 catch (e)
3229 {
3230 }
3231 },
3232
3233 // invoked via F key
3234 toggle_toolbar: function () {
3235 if (!w3c_slidy.view_all)
3236 {
3237 if (w3c_slidy.has_class(w3c_slidy.toolbar, "hidden"))
3238 {
3239 w3c_slidy.remove_class(w3c_slidy.toolbar, "hidden")
3240 w3c_slidy.want_toolbar = 1;
3241 }
3242 else
3243 {
3244 w3c_slidy.add_class(w3c_slidy.toolbar, "hidden")
3245 w3c_slidy.want_toolbar = 0;
3246 }
3247 }
3248 },
3249
3250 scroll_x_offset: function () {
3251 if (window.pageXOffset)
3252 return self.pageXOffset;
3253
3254 if (document.documentElement &&
3255 document.documentElement.scrollLeft)
3256 return document.documentElement.scrollLeft;
3257
3258 if (document.body)
3259 return document.body.scrollLeft;
3260
3261 return 0;
3262 },
3263
3264 scroll_y_offset: function () {
3265 if (window.pageYOffset)
3266 return self.pageYOffset;
3267
3268 if (document.documentElement &&
3269 document.documentElement.scrollTop)
3270 return document.documentElement.scrollTop;
3271
3272 if (document.body)
3273 return document.body.scrollTop;
3274
3275 return 0;
3276 },
3277
3278 // looking for a way to determine height of slide content
3279 // the slide itself is set to the height of the window
3280 optimize_font_size: function () {
3281 var slide = w3c_slidy.slides[w3c_slidy.slide_number];
3282
3283 //var dh = documentHeight(); //getDocHeight(document);
3284 var dh = slide.scrollHeight;
3285 var wh = getWindowHeight();
3286 var u = 100 * dh / wh;
3287
3288 alert("window utilization = " + u + "% (doc "
3289 + dh + " win " + wh + ")");
3290 },
3291
3292 // from document object
3293 get_doc_height: function (doc) {
3294 if (!doc)
3295 doc = document;
3296
3297 if (doc && doc.body && doc.body.offsetHeight)
3298 return doc.body.offsetHeight; // ns/gecko syntax
3299
3300 if (doc && doc.body && doc.body.scrollHeight)
3301 return doc.body.scrollHeight;
3302
3303 alert("couldn't determine document height");
3304 },
3305
3306 get_window_height: function () {
3307 if ( typeof( window.innerHeight ) == 'number' )
3308 return window.innerHeight; // Non IE browser
3309
3310 if (document.documentElement && document.documentElement.clientHeight)
3311 return document.documentElement.clientHeight; // IE6
3312
3313 if (document.body && document.body.clientHeight)
3314 return document.body.clientHeight; // IE4
3315 },
3316
3317 document_height: function () {
3318 var sh, oh;
3319
3320 sh = document.body.scrollHeight;
3321 oh = document.body.offsetHeight;
3322
3323 if (sh && oh)
3324 {
3325 return (sh > oh ? sh : oh);
3326 }
3327
3328 // no idea!
3329 return 0;
3330 },
3331
3332 smaller: function () {
3333 if (w3c_slidy.size_index > 0)
3334 {
3335 --w3c_slidy.size_index;
3336 }
3337
3338 w3c_slidy.toolbar.style.display = "none";
3339 document.body.style.fontSize = w3c_slidy.sizes[w3c_slidy.size_index];
3340 var slide = w3c_slidy.slides[w3c_slidy.slide_number];
3341 w3c_slidy.hide_slide(slide);
3342 w3c_slidy.show_slide(slide);
3343 setTimeout(function () {w3c_slidy.show_toolbar(); }, 50);
3344 },
3345
3346 bigger: function () {
3347 if (w3c_slidy.size_index < w3c_slidy.sizes.length - 1)
3348 {
3349 ++w3c_slidy.size_index;
3350 }
3351
3352 w3c_slidy.toolbar.style.display = "none";
3353 document.body.style.fontSize = w3c_slidy.sizes[w3c_slidy.size_index];
3354 var slide = w3c_slidy.slides[w3c_slidy.slide_number];
3355 w3c_slidy.hide_slide(slide);
3356 w3c_slidy.show_slide(slide);
3357 setTimeout(function () {w3c_slidy.show_toolbar(); }, 50);
3358 },
3359
3360 // enables cross browser use of relative width/height
3361 // on object elements for use with SVG and Flash media
3362 // with thanks to Ivan Herman for the suggestion
3363 adjust_object_dimensions: function (width, height) {
3364 for( var i = 0; i < w3c_slidy.objects.length; i++ )
3365 {
3366 var obj = this.objects[i];
3367 var mimeType = obj.getAttribute("type");
3368
3369 if (mimeType == "image/svg+xml" || mimeType == "application/x-shockwave-flash")
3370 {
3371 if ( !obj.initialWidth )
3372 obj.initialWidth = obj.getAttribute("width");
3373
3374 if ( !obj.initialHeight )
3375 obj.initialHeight = obj.getAttribute("height");
3376
3377 if ( obj.initialWidth && obj.initialWidth.charAt(obj.initialWidth.length-1) == "%" )
3378 {
3379 var w = parseInt(obj.initialWidth.slice(0, obj.initialWidth.length-1));
3380 var newW = width * (w/100.0);
3381 obj.setAttribute("width",newW);
3382 }
3383
3384 if ( obj.initialHeight &&
3385 obj.initialHeight.charAt(obj.initialHeight.length-1) == "%" )
3386 {
3387 var h = parseInt(obj.initialHeight.slice(0, obj.initialHeight.length-1));
3388 var newH = height * (h/100.0);
3389 obj.setAttribute("height", newH);
3390 }
3391 }
3392 }
3393 },
3394
3395 // needed for Opera to inhibit default behavior
3396 // since Opera delivers keyPress even if keyDown
3397 // was cancelled
3398 key_press: function (event) {
3399 if (!event)
3400 event = window.event;
3401
3402 if (!w3c_slidy.key_wanted)
3403 return w3c_slidy.cancel(event);
3404
3405 return true;
3406 },
3407
3408 // See e.g. http://www.quirksmode.org/js/events/keys.html for keycodes
3409 key_down: function (event) {
3410 var key, target, tag;
3411
3412 w3c_slidy.key_wanted = true;
3413
3414 if (!event)
3415 event = window.event;
3416
3417 // kludge around NS/IE differences
3418 if (window.event)
3419 {
3420 key = window.event.keyCode;
3421 target = window.event.srcElement;
3422 }
3423 else if (event.which)
3424 {
3425 key = event.which;
3426 target = event.target;
3427 }
3428 else
3429 return true; // Yikes! unknown browser
3430
3431 // ignore event if key value is zero
3432 // as for alt on Opera and Konqueror
3433 if (!key)
3434 return true;
3435
3436 // avoid interfering with keystroke
3437 // behavior for non-slidy chrome elements
3438 if (!w3c_slidy.slidy_chrome(target) &&
3439 w3c_slidy.special_element(target))
3440 return true;
3441
3442 // check for concurrent control/command/alt key
3443 // but are these only present on mouse events?
3444
3445 if (event.ctrlKey || event.altKey || event.metaKey)
3446 return true;
3447
3448 // dismiss table of contents if visible
3449 if (w3c_slidy.is_shown_toc() && key != 9 && key != 16 && key != 38 && key != 40)
3450 {
3451 w3c_slidy.hide_table_of_contents(true);
3452
3453 if (key == 27 || key == 84 || key == 67)
3454 return w3c_slidy.cancel(event);
3455 }
3456
3457 if (key == 34) // Page Down
3458 {
3459 if (w3c_slidy.view_all)
3460 return true;
3461
3462 w3c_slidy.next_slide(false);
3463 return w3c_slidy.cancel(event);
3464 }
3465 else if (key == 33) // Page Up
3466 {
3467 if (w3c_slidy.view_all)
3468 return true;
3469
3470 w3c_slidy.previous_slide(false);
3471 return w3c_slidy.cancel(event);
3472 }
3473 else if (key == 32) // space bar
3474 {
3475 w3c_slidy.next_slide(true);
3476 return w3c_slidy.cancel(event);
3477 }
3478 else if (key == 37) // Left arrow
3479 {
3480 w3c_slidy.previous_slide(!event.shiftKey);
3481 return w3c_slidy.cancel(event);
3482 }
3483 else if (key == 36) // Home
3484 {
3485 w3c_slidy.first_slide();
3486 return w3c_slidy.cancel(event);
3487 }
3488 else if (key == 35) // End
3489 {
3490 w3c_slidy.last_slide();
3491 return w3c_slidy.cancel(event);
3492 }
3493 else if (key == 39) // Right arrow
3494 {
3495 w3c_slidy.next_slide(!event.shiftKey);
3496 return w3c_slidy.cancel(event);
3497 }
3498 else if (key == 13) // Enter
3499 {
3500 if (w3c_slidy.outline)
3501 {
3502 if (w3c_slidy.outline.visible)
3503 w3c_slidy.fold(w3c_slidy.outline);
3504 else
3505 w3c_slidy.unfold(w3c_slidy.outline);
3506
3507 return w3c_slidy.cancel(event);
3508 }
3509 }
3510 else if (key == 188) // < for smaller fonts
3511 {
3512 w3c_slidy.smaller();
3513 return w3c_slidy.cancel(event);
3514 }
3515 else if (key == 190) // > for larger fonts
3516 {
3517 w3c_slidy.bigger();
3518 return w3c_slidy.cancel(event);
3519 }
3520 else if (key == 189 || key == 109) // - for smaller fonts
3521 {
3522 w3c_slidy.smaller();
3523 return w3c_slidy.cancel(event);
3524 }
3525 else if (key == 187 || key == 191 || key == 107) // = + for larger fonts
3526 {
3527 w3c_slidy.bigger();
3528 return w3c_slidy.cancel(event);
3529 }
3530 else if (key == 83) // S for smaller fonts
3531 {
3532 w3c_slidy.smaller();
3533 return w3c_slidy.cancel(event);
3534 }
3535 else if (key == 66) // B for larger fonts
3536 {
3537 w3c_slidy.bigger();
3538 return w3c_slidy.cancel(event);
3539 }
3540 else if (key == 90) // Z for last slide
3541 {
3542 w3c_slidy.last_slide();
3543 return w3c_slidy.cancel(event);
3544 }
3545 else if (key == 70) // F for toggle toolbar
3546 {
3547 w3c_slidy.toggle_toolbar();
3548 return w3c_slidy.cancel(event);
3549 }
3550 else if (key == 65) // A for toggle view single/all slides
3551 {
3552 w3c_slidy.toggle_view();
3553 return w3c_slidy.cancel(event);
3554 }
3555 else if (key == 75) // toggle action of left click for next page
3556 {
3557 w3c_slidy.mouse_click_enabled = !w3c_slidy.mouse_click_enabled;
3558 var alert_msg = (w3c_slidy.mouse_click_enabled ?
3559 "enabled" : "disabled") + " mouse click advance";
3560
3561 alert(w3c_slidy.localize(alert_msg));
3562 return w3c_slidy.cancel(event);
3563 }
3564 else if (key == 84 || key == 67) // T or C for table of contents
3565 {
3566 if (w3c_slidy.toc)
3567 w3c_slidy.toggle_table_of_contents();
3568
3569 return w3c_slidy.cancel(event);
3570 }
3571 else if (key == 72) // H for help
3572 {
3573 window.location = w3c_slidy.help_page;
3574 return w3c_slidy.cancel(event);
3575 }
3576 //jmi
3577 else if (key == 73) // I to toggle incremental display
3578 {
3579 var slide = w3c_slidy.slides[w3c_slidy.slide_number];
3580 w3c_slidy.hide_slide(slide);
3581 if (w3c_slidy.incremental_display) { w3c_slidy.set_visibility_all_incremental("visible"); }
3582 w3c_slidy.incremental_display = !w3c_slidy.incremental_display ;
3583 w3c_slidy.last_shown = null ;
3584 w3c_slidy.set_visibility_all_incremental("hidden");
3585 //this.set_eos_status(true);
3586 w3c_slidy.show_slide(slide);
3587 return w3c_slidy.cancel(event);
3588 }
3589 else if (key == 76) // L to toggle color-set
3590 {
3591 w3c_slidy.toggle_color_set();
3592 return w3c_slidy.cancel(event);
3593 }
3594 else if (key == 77) // display help_keymap
3595 {
3596 alert(w3c_slidy.help_keymap);
3597 return w3c_slidy.cancel(event);
3598 }
3599 //jmi end
3600 //else alert("key code is "+ key);
3601 return true;
3602 },
3603
3604 // safe for both text/html and application/xhtml+xml
3605 create_element: function (name) {
3606 if (this.xhtml && (typeof document.createElementNS != 'undefined'))
3607 return document.createElementNS("http://www.w3.org/1999/xhtml", name)
3608
3609 return document.createElement(name);
3610 },
3611
3612 get_element_style: function (elem, IEStyleProp, CSSStyleProp) {
3613 if (elem.currentStyle)
3614 {
3615 return elem.currentStyle[IEStyleProp];
3616 }
3617 else if (window.getComputedStyle)
3618 {
3619 var compStyle = window.getComputedStyle(elem, "");
3620 return compStyle.getPropertyValue(CSSStyleProp);
3621 }
3622 return "";
3623 },
3624
3625 // the string str is a whitespace separated list of tokens
3626 // test if str contains a particular token, e.g. "slide"
3627 has_token: function (str, token) {
3628 if (str)
3629 {
3630 // define pattern as regular expression
3631 var pattern = /\w+/g;
3632
3633 // check for matches
3634 // place result in array
3635 var result = str.match(pattern);
3636
3637 // now check if desired token is present
3638 for (var i = 0; i < result.length; i++)
3639 {
3640 if (result[i] == token)
3641 return true;
3642 }
3643 }
3644
3645 return false;
3646 },
3647
3648 get_class_list: function (element) {
3649 if (typeof element.className != 'undefined')
3650 return element.className;
3651
3652 return element.getAttribute("class");
3653 },
3654
3655 has_class: function (element, name) {
3656 if (element.nodeType != 1)
3657 return false;
3658
3659 var regexp = new RegExp("(^| )" + name + "\W*");
3660
3661 if (typeof element.className != 'undefined')
3662 return regexp.test(element.className);
3663
3664 return regexp.test(element.getAttribute("class"));
3665 },
3666
3667 remove_class: function (element, name) {
3668 var regexp = new RegExp("(^| )" + name + "\W*");
3669 var clsval = "";
3670
3671 if (typeof element.className != 'undefined')
3672 {
3673 clsval = element.className;
3674
3675 if (clsval)
3676 {
3677 clsval = clsval.replace(regexp, "");
3678 element.className = clsval;
3679 }
3680 }
3681 else
3682 {
3683 clsval = element.getAttribute("class");
3684
3685 if (clsval)
3686 {
3687 clsval = clsval.replace(regexp, "");
3688 element.setAttribute("class", clsval);
3689 }
3690 }
3691 },
3692
3693 add_class: function (element, name) {
3694 if (!this.has_class(element, name))
3695 {
3696 if (typeof element.className != 'undefined')
3697 element.className += " " + name;
3698 else
3699 {
3700 var clsval = element.getAttribute("class");
3701 clsval = clsval ? clsval + " " + name : name;
3702 element.setAttribute("class", clsval);
3703 }
3704 }
3705 },
3706
3707 // HTML elements that can be used with class="incremental"
3708 // note that you can also put the class on containers like
3709 // up, ol, dl, and div to make their contents appear
3710 // incrementally. Upper case is used since this is what
3711 // browsers report for HTML node names (text/html).
3712 incremental_elements: null,
3713 okay_for_incremental: function (name) {
3714 if (!this.incremental_elements)
3715 {
3716 var inclist = new Array();
3717 inclist["p"] = true;
3718 inclist["pre"] = true;
3719 inclist["li"] = true;
3720 inclist["blockquote"] = true;
3721 inclist["dt"] = true;
3722 inclist["dd"] = true;
3723 inclist["h2"] = true;
3724 inclist["h3"] = true;
3725 inclist["h4"] = true;
3726 inclist["h5"] = true;
3727 inclist["h6"] = true;
3728 inclist["span"] = true;
3729 inclist["address"] = true;
3730 inclist["table"] = true;
3731 inclist["tr"] = true;
3732 inclist["th"] = true;
3733 inclist["td"] = true;
3734 inclist["img"] = true;
3735 inclist["object"] = true;
3736 this.incremental_elements = inclist;
3737 }
3738 return this.incremental_elements[name.toLowerCase()];
3739 },
3740
3741 next_incremental_item: function (node) {
3742 var br = this.is_xhtml ? "br" : "BR";
3743 var slide = w3c_slidy.slides[w3c_slidy.slide_number];
3744
3745 for (;;)
3746 {
3747 node = w3c_slidy.next_node(slide, node);
3748
3749 if (node == null || node.parentNode == null)
3750 break;
3751
3752 if (node.nodeType == 1) // ELEMENT
3753 {
3754 if (node.nodeName == br)
3755 continue;
3756
3757 if (w3c_slidy.has_class(node, "incremental")
3758 && w3c_slidy.okay_for_incremental(node.nodeName))
3759 return node;
3760
3761 if (w3c_slidy.has_class(node.parentNode, "incremental")
3762 && !w3c_slidy.has_class(node, "non-incremental"))
3763 return node;
3764 }
3765 }
3766
3767 return node;
3768 },
3769
3770 previous_incremental_item: function (node) {
3771 var br = this.is_xhtml ? "br" : "BR";
3772 var slide = w3c_slidy.slides[w3c_slidy.slide_number];
3773
3774 for (;;)
3775 {
3776 node = w3c_slidy.previous_node(slide, node);
3777
3778 if (node == null || node.parentNode == null)
3779 break;
3780
3781 if (node.nodeType == 1)
3782 {
3783 if (node.nodeName == br)
3784 continue;
3785
3786 if (w3c_slidy.has_class(node, "incremental")
3787 && w3c_slidy.okay_for_incremental(node.nodeName))
3788 return node;
3789
3790 if (w3c_slidy.has_class(node.parentNode, "incremental")
3791 && !w3c_slidy.has_class(node, "non-incremental"))
3792 return node;
3793 }
3794 }
3795
3796 return node;
3797 },
3798
3799 // set visibility for all elements on current slide with
3800 // a parent element with attribute class="incremental"
3801 set_visibility_all_incremental: function (value) {
3802 var node = this.next_incremental_item(null);
3803
3804 //jmi
3805 if (!w3c_slidy.incremental_display) {value = "visible";}
3806
3807 if (value == "hidden")
3808 {
3809 while (node)
3810 {
3811 w3c_slidy.add_class(node, "invisible");
3812 node = w3c_slidy.next_incremental_item(node);
3813 }
3814 }
3815 else // value == "visible"
3816 {
3817 while (node)
3818 {
3819 w3c_slidy.remove_class(node, "invisible");
3820 node = w3c_slidy.next_incremental_item(node);
3821 }
3822 }
3823 },
3824
3825 // reveal the next hidden item on the slide
3826 // node is null or the node that was last revealed
3827 reveal_next_item: function (node) {
3828 node = w3c_slidy.next_incremental_item(node);
3829
3830 if (node && node.nodeType == 1) // an element
3831 w3c_slidy.remove_class(node, "invisible");
3832
3833 return node;
3834 },
3835
3836 // exact inverse of revealNextItem(node)
3837 hide_previous_item: function (node) {
3838 if (node && node.nodeType == 1) // an element
3839 w3c_slidy.add_class(node, "invisible");
3840
3841 return this.previous_incremental_item(node);
3842 },
3843
3844 // left to right traversal of root's content
3845 next_node: function (root, node) {
3846 if (node == null)
3847 return root.firstChild;
3848
3849 if (node.firstChild)
3850 return node.firstChild;
3851
3852 if (node.nextSibling)
3853 return node.nextSibling;
3854
3855 for (;;)
3856 {
3857 node = node.parentNode;
3858
3859 if (!node || node == root)
3860 break;
3861
3862 if (node && node.nextSibling)
3863 return node.nextSibling;
3864 }
3865
3866 return null;
3867 },
3868
3869 // right to left traversal of root's content
3870 previous_node: function (root, node) {
3871 if (node == null)
3872 {
3873 node = root.lastChild;
3874
3875 if (node)
3876 {
3877 while (node.lastChild)
3878 node = node.lastChild;
3879 }
3880
3881 return node;
3882 }
3883
3884 if (node.previousSibling)
3885 {
3886 node = node.previousSibling;
3887
3888 while (node.lastChild)
3889 node = node.lastChild;
3890
3891 return node;
3892 }
3893
3894 if (node.parentNode != root)
3895 return node.parentNode;
3896
3897 return null;
3898 },
3899
3900 previous_sibling_element: function (el) {
3901 el = el.previousSibling;
3902
3903 while (el && el.nodeType != 1)
3904 el = el.previousSibling;
3905
3906 return el;
3907 },
3908
3909 next_sibling_element: function (el) {
3910 el = el.nextSibling;
3911
3912 while (el && el.nodeType != 1)
3913 el = el.nextSibling;
3914
3915 return el;
3916 },
3917
3918 first_child_element: function (el) {
3919 var node;
3920
3921 for (node = el.firstChild; node; node = node.nextSibling)
3922 {
3923 if (node.nodeType == 1)
3924 break;
3925 }
3926
3927 return node;
3928 },
3929
3930 first_tag: function (element, tag) {
3931 var node;
3932
3933 if (!this.is_xhtml)
3934 tag = tag.toUpperCase();
3935
3936 for (node = element.firstChild; node; node = node.nextSibling)
3937 {
3938 if (node.nodeType == 1 && node.nodeName == tag)
3939 break;
3940 }
3941
3942 return node;
3943 },
3944
3945 hide_selection: function () {
3946 if (window.getSelection) // Firefox, Chromium, Safari, Opera
3947 {
3948 var selection = window.getSelection();
3949
3950 if (selection.rangeCount > 0)
3951 {
3952 var range = selection.getRangeAt(0);
3953 range.collapse (false);
3954 }
3955 }
3956 else // Internet Explorer
3957 {
3958 var textRange = document.selection.createRange ();
3959 textRange.collapse (false);
3960 }
3961 },
3962
3963 get_selected_text: function () {
3964 try
3965 {
3966 if (window.getSelection)
3967 return window.getSelection().toString();
3968
3969 if (document.getSelection)
3970 return document.getSelection().toString();
3971
3972 if (document.selection)
3973 return document.selection.createRange().text;
3974 }
3975 catch (e)
3976 {
3977 }
3978
3979 return "";
3980 },
3981
3982 // make note of length of selected text
3983 // as this evaluates to zero in click event
3984 mouse_button_up: function (e) {
3985 w3c_slidy.selected_text_len = w3c_slidy.get_selected_text().length;
3986 },
3987
3988 // right mouse button click is reserved for context menus
3989 // it is more reliable to detect rightclick than leftclick
3990 mouse_button_click: function (e) {
3991 var rightclick = false;
3992 var leftclick = false;
3993 var middleclick = false;
3994 var target;
3995
3996 if (!e)
3997 var e = window.event;
3998
3999 if (e.target)
4000 target = e.target;
4001 else if (e.srcElement)
4002 target = e.srcElement;
4003
4004 // work around Safari bug
4005 if (target.nodeType == 3)
4006 target = target.parentNode;
4007
4008 if (e.which) // all browsers except IE
4009 {
4010 leftclick = (e.which == 1);
4011 middleclick = (e.which == 2);
4012 rightclick = (e.which == 3);
4013 }
4014 else if (e.button)
4015 {
4016 // Konqueror gives 1 for left, 4 for middle
4017 // IE6 gives 0 for left and not 1 as I expected
4018
4019 if (e.button == 4)
4020 middleclick = true;
4021
4022 // all browsers agree on 2 for right button
4023 rightclick = (e.button == 2);
4024 }
4025 else
4026 leftclick = true;
4027
4028 if (w3c_slidy.selected_text_len > 0)
4029 {
4030 w3c_slidy.stop_propagation(e);
4031 e.cancel = true;
4032 e.returnValue = false;
4033 return false;
4034 }
4035
4036 // dismiss table of contents
4037 w3c_slidy.hide_table_of_contents(false);
4038
4039 // check if target is something that probably want's clicks
4040 // e.g. a, embed, object, input, textarea, select, option
4041 var tag = target.nodeName.toLowerCase();
4042
4043 if (w3c_slidy.mouse_click_enabled && leftclick &&
4044 !w3c_slidy.special_element(target) &&
4045 !target.onclick)
4046 {
4047 w3c_slidy.next_slide(true);
4048 w3c_slidy.stop_propagation(e);
4049 e.cancel = true;
4050 e.returnValue = false;
4051 return false;
4052 }
4053
4054 return true;
4055 },
4056
4057 special_element: function (e) {
4058 var tag = e.nodeName.toLowerCase();
4059
4060 return e.onkeydown ||
4061 e.onclick ||
4062 tag == "a" ||
4063 tag == "embed" ||
4064 tag == "object" ||
4065 tag == "video" ||
4066 tag == "audio" ||
4067 tag == "input" ||
4068 tag == "textarea" ||
4069 tag == "select" ||
4070 tag == "option";
4071 },
4072
4073 slidy_chrome: function (el) {
4074 while (el)
4075 {
4076 if (el == w3c_slidy.toc ||
4077 el == w3c_slidy.toolbar ||
4078 w3c_slidy.has_class(el, "outline"))
4079 return true;
4080
4081 el = el.parentNode;
4082 }
4083
4084 return false;
4085 },
4086
4087 get_key: function (e)
4088 {
4089 var key;
4090
4091 // kludge around NS/IE differences
4092 if (typeof window.event != "undefined")
4093 key = window.event.keyCode;
4094 else if (e.which)
4095 key = e.which;
4096
4097 return key;
4098 },
4099
4100 get_target: function (e) {
4101 var target;
4102
4103 if (!e)
4104 e = window.event;
4105
4106 if (e.target)
4107 target = e.target;
4108 else if (e.srcElement)
4109 target = e.srcElement;
4110
4111 if (target.nodeType != 1)
4112 target = target.parentNode;
4113
4114 return target;
4115 },
4116
4117 // does display property provide correct defaults?
4118 is_block: function (elem) {
4119 var tag = elem.nodeName.toLowerCase();
4120
4121 return tag == "ol" || tag == "ul" || tag == "p" ||
4122 tag == "li" || tag == "table" || tag == "pre" ||
4123 tag == "h1" || tag == "h2" || tag == "h3" ||
4124 tag == "h4" || tag == "h5" || tag == "h6" ||
4125 tag == "blockquote" || tag == "address";
4126 },
4127
4128 add_listener: function (element, event, handler) {
4129 if (window.addEventListener)
4130 element.addEventListener(event, handler, false);
4131 else
4132 element.attachEvent("on"+event, handler);
4133 },
4134
4135 // used to prevent event propagation from field controls
4136 stop_propagation: function (event) {
4137 event = event ? event : window.event;
4138 event.cancelBubble = true; // for IE
4139
4140 if (event.stopPropagation)
4141 event.stopPropagation();
4142
4143 return true;
4144 },
4145
4146 cancel: function (event) {
4147 if (event)
4148 {
4149 event.cancel = true;
4150 event.returnValue = false;
4151
4152 if (event.preventDefault)
4153 event.preventDefault();
4154 }
4155
4156 w3c_slidy.key_wanted = false;
4157 return false;
4158 },
4159 // jmi
4160 init_color_sets: function(){
4161 if (this.color_sets.length == 0){
4162 // initialize color_sets array
4163 var tmp = document.styleSheets;
4164 var j = 0;
4165 for (var i=0;i<tmp.length;i++) {
4166 var css_name = null ;
4167 if (tmp[i].title) {
4168 css_name = tmp[i].title ;
4169 }
4170 if ((tmp[i].href) && (tmp[i].href.indexOf('.css') != -1)) {
4171 css_name = tmp[i].href.substring(tmp[i].href.lastIndexOf('/')+1,tmp[i].href.indexOf('.css')) ;
4172 }
4173 if ((css_name) && (css_name.indexOf('color_set') > 0)) {
4174 this.color_sets[j] = tmp[i];
4175 this.color_sets[j++].disabled = true;
4176 }
4177 }
4178 if (this.color_sets.length > 0){ this.color_sets[0].disabled = false; }
4179 }
4180 },
4181 toggle_color_set: function(){
4182 // toggle to the next color_set
4183 if (this.color_sets.length > 0){
4184 var i = 0;
4185 while ((i < this.color_sets.length) && (this.color_sets[i].disabled == true)) { i = i + 1 ; }
4186 if (i == this.color_sets.length) { i = i - 1; }
4187 this.color_sets[i].disabled = true ;
4188 this.color_sets[(i + 1) % (this.color_sets.length)].disabled = false ;
4189 }
4190 },
4191
4192 // for each language define an associative array
4193 // and also the help text which is longer
4194
4195 strings_es: {
4196 "slide":"pág.",
4197 "help?":"Ayuda",
4198 "contents?":"Índice",
4199 "table of contents":"tabla de contenidos",
4200 "Table of Contents":"Tabla de Contenidos",
4201 "restart presentation":"Reiniciar presentación",
4202 "restart?":"Inicio"
4203 },
4204 help_es:
4205 "Utilice el ratón, barra espaciadora, teclas Izda/Dcha, " +
4206 "o Re pág y Av pág. Use S y B para cambiar el tamaño de fuente.",
4207
4208 strings_ca: {
4209 "slide":"pàg..",
4210 "help?":"Ajuda",
4211 "contents?":"Índex",
4212 "table of contents":"taula de continguts",
4213 "Table of Contents":"Taula de Continguts",
4214 "restart presentation":"Reiniciar presentació",
4215 "restart?":"Inici"
4216 },
4217 help_ca:
4218 "Utilitzi el ratolí, barra espaiadora, tecles Esq./Dta. " +
4219 "o Re pàg y Av pàg. Usi S i B per canviar grandària de font.",
4220
4221 strings_cs: {
4222 "slide":"snímek",
4223 "help?":"nápověda",
4224 "contents?":"obsah",
4225 "table of contents":"obsah prezentace",
4226 "Table of Contents":"Obsah prezentace",
4227 "restart presentation":"znovu spustit prezentaci",
4228 "restart?":"restart"
4229 },
4230 help_cs:
4231 "Prezentaci můžete procházet pomocí kliknutí myši, mezerníku, " +
4232 "šipek vlevo a vpravo nebo kláves PageUp a PageDown. Písmo se " +
4233 "dá zvětšit a zmenšit pomocí kláves B a S.",
4234
4235 strings_nl: {
4236 "slide":"pagina",
4237 "help?":"Help?",
4238 "contents?":"Inhoud?",
4239 "table of contents":"inhoudsopgave",
4240 "Table of Contents":"Inhoudsopgave",
4241 "restart presentation":"herstart presentatie",
4242 "restart?":"Herstart?"
4243 },
4244 help_nl:
4245 "Navigeer d.m.v. het muis, spatiebar, Links/Rechts toetsen, " +
4246 "of PgUp en PgDn. Gebruik S en B om de karaktergrootte te veranderen.",
4247
4248 strings_de: {
4249 "slide":"Seite",
4250 "help?":"Hilfe",
4251 "contents?":"Übersicht",
4252 "table of contents":"Inhaltsverzeichnis",
4253 "Table of Contents":"Inhaltsverzeichnis",
4254 "restart presentation":"Präsentation neu starten",
4255 "restart?":"Neustart"
4256 },
4257 help_de:
4258 "Benutzen Sie die Maus, Leerschlag, die Cursortasten links/rechts oder " +
4259 "Page up/Page Down zum Wechseln der Seiten und S und B für die Schriftgrösse.",
4260
4261 strings_pl: {
4262 "slide":"slajd",
4263 "help?":"pomoc?",
4264 "contents?":"spis treści?",
4265 "table of contents":"spis treści",
4266 "Table of Contents":"Spis Treści",
4267 "restart presentation":"Restartuj prezentację",
4268 "restart?":"restart?"
4269 },
4270 help_pl:
4271 "Zmieniaj slajdy klikając myszą, naciskając spację, strzałki lewo/prawo" +
4272 "lub PgUp / PgDn. Użyj klawiszy S i B, aby zmienić rozmiar czczionki.",
4273
4274 strings_fr: {
4275 "slide":"page",
4276 "help?":"Aide",
4277 "contents?":"Index",
4278 "table of contents":"table des matières",
4279 "Table of Contents":"Table des matières",
4280 "restart presentation":"Recommencer l'exposé",
4281 "restart?":"Début"
4282 },
4283 help_fr:
4284 "Naviguez avec la souris, la barre d'espace, les flèches " +
4285 "gauche/droite ou les touches Pg Up, Pg Dn. Utilisez " +
4286 "les touches S et B pour modifier la taille de la police, M pour l'association des touches.",
4287
4288 strings_hu: {
4289 "slide":"oldal",
4290 "help?":"segítség",
4291 "contents?":"tartalom",
4292 "table of contents":"tartalomjegyzék",
4293 "Table of Contents":"Tartalomjegyzék",
4294 "restart presentation":"bemutató újraindítása",
4295 "restart?":"újraindítás"
4296 },
4297 help_hu:
4298 "Az oldalak közti lépkedéshez kattintson az egérrel, vagy " +
4299 "használja a szóköz, a bal, vagy a jobb nyíl, illetve a Page Down, " +
4300 "Page Up billentyűket. Az S és a B billentyűkkel változtathatja " +
4301 "a szöveg méretét.",
4302
4303 strings_it: {
4304 "slide":"pag.",
4305 "help?":"Aiuto",
4306 "contents?":"Indice",
4307 "table of contents":"indice",
4308 "Table of Contents":"Indice",
4309 "restart presentation":"Ricominciare la presentazione",
4310 "restart?":"Inizio"
4311 },
4312 help_it:
4313 "Navigare con mouse, barra spazio, frecce sinistra/destra o " +
4314 "PgUp e PgDn. Usare S e B per cambiare la dimensione dei caratteri.",
4315
4316 strings_el: {
4317 "slide":"σελίδα",
4318 "help?":"βοήθεια;",
4319 "contents?":"περιεχόμενα;",
4320 "table of contents":"πίνακας περιεχομένων",
4321 "Table of Contents":"Πίνακας Περιεχομένων",
4322 "restart presentation":"επανεκκίνηση παρουσίασης",
4323 "restart?":"επανεκκίνηση;"
4324 },
4325 help_el:
4326 "Πλοηγηθείτε με το κλίκ του ποντικιού, το space, τα βέλη αριστερά/δεξιά, " +
4327 "ή Page Up και Page Down. Χρησιμοποιήστε τα πλήκτρα S και B για να αλλάξετε " +
4328 "το μέγεθος της γραμματοσειράς.",
4329
4330 strings_ja: {
4331 "slide":"スライド",
4332 "help?":"ヘルプ",
4333 "contents?":"目次",
4334 "table of contents":"目次を表示",
4335 "Table of Contents":"目次",
4336 "restart presentation":"最初から再生",
4337 "restart?":"最初から"
4338 },
4339 help_ja:
4340 "マウス左クリック ・ スペース ・ 左右キー " +
4341 "または Page Up ・ Page Downで操作, S ・ Bでフォントサイズ変更",
4342
4343 strings_zh: {
4344 "slide":"幻灯片",
4345 "help?":"帮助?",
4346 "contents?":"内容?",
4347 "table of contents":"目录",
4348 "Table of Contents":"目录",
4349 "restart presentation":"重新启动展示",
4350 "restart?":"重新启动?"
4351 },
4352 help_zh:
4353 "用鼠标点击, 空格条, 左右箭头, Pg Up 和 Pg Dn 导航. " +
4354 "用 S, B 改变字体大小.",
4355
4356 strings_ru: {
4357 "slide":"слайд",
4358 "help?":"помощь?",
4359 "contents?":"содержание?",
4360 "table of contents":"оглавление",
4361 "Table of Contents":"Оглавление",
4362 "restart presentation":"перезапустить презентацию",
4363 "restart?":"перезапуск?"
4364 },
4365 help_ru:
4366 "Перемещайтесь кликая мышкой, используя клавишу пробел, стрелки" +
4367 "влево/вправо или Pg Up и Pg Dn. Клавиши S и B меняют размер шрифта.",
4368
4369 strings_sv: {
4370 "slide":"sida",
4371 "help?":"hjälp",
4372 "contents?":"innehåll",
4373 "table of contents":"innehållsförteckning",
4374 "Table of Contents":"Innehållsförteckning",
4375 "restart presentation":"visa presentationen från början",
4376 "restart?":"börja om"
4377 },
4378 help_sv:
4379 "Bläddra med ett klick med vänstra musknappen, mellanslagstangenten, " +
4380 "vänster- och högerpiltangenterna eller tangenterna Pg Up, Pg Dn. " +
4381 "Använd tangenterna S och B för att ändra textens storlek.",
4382
4383 strings: { },
4384
4385 localize: function (src) {
4386 if (src == "")
4387 return src;
4388
4389 // try full language code, e.g. en-US
4390 var s, lookup = w3c_slidy.strings[w3c_slidy.lang];
4391
4392 if (lookup)
4393 {
4394 s = lookup[src];
4395
4396 if (s)
4397 return s;
4398 }
4399
4400 // strip country code suffix, e.g.
4401 // try en if undefined for en-US
4402 var lg = w3c_slidy.lang.split("-");
4403
4404 if (lg.length > 1)
4405 {
4406 lookup = w3c_slidy.strings[lg[0]];
4407
4408 if (lookup)
4409 {
4410 s = lookup[src];
4411
4412 if (s)
4413 return s;
4414 }
4415 }
4416
4417 // otherwise string as is
4418 return src;
4419 },
4420
4421 init_localization: function () {
4422 var i18n = w3c_slidy;
4423 var help_text = w3c_slidy.help_text;
4424
4425 // each such language array is declared in the localize array
4426 // this is used as in w3c_slidy.localize("foo");
4427 this.strings = {
4428 "es":this.strings_es,
4429 "ca":this.strings_ca,
4430 "cs":this.strings_cs,
4431 "nl":this.strings_nl,
4432 "de":this.strings_de,
4433 "pl":this.strings_pl,
4434 "fr":this.strings_fr,
4435 "hu":this.strings_hu,
4436 "it":this.strings_it,
4437 "el":this.strings_el,
4438 "jp":this.strings_ja,
4439 "zh":this.strings_zh,
4440 "ru":this.strings_ru,
4441 "sv":this.strings_sv
4442 },
4443
4444 i18n.strings_es[help_text] = i18n.help_es;
4445 i18n.strings_ca[help_text] = i18n.help_ca;
4446 i18n.strings_cs[help_text] = i18n.help_cs;
4447 i18n.strings_nl[help_text] = i18n.help_nl;
4448 i18n.strings_de[help_text] = i18n.help_de;
4449 i18n.strings_pl[help_text] = i18n.help_pl;
4450 i18n.strings_fr[help_text] = i18n.help_fr;
4451 i18n.strings_hu[help_text] = i18n.help_hu;
4452 i18n.strings_it[help_text] = i18n.help_it;
4453 i18n.strings_el[help_text] = i18n.help_el;
4454 i18n.strings_ja[help_text] = i18n.help_ja;
4455 i18n.strings_zh[help_text] = i18n.help_zh;
4456 i18n.strings_ru[help_text] = i18n.help_ru;
4457 i18n.strings_sv[help_text] = i18n.help_sv;
4458
4459 w3c_slidy.lang = document.body.parentNode.getAttribute("lang");
4460
4461 if (!w3c_slidy.lang)
4462 w3c_slidy.lang = document.body.parentNode.getAttribute("xml:lang");
4463
4464 if (!w3c_slidy.lang)
4465 w3c_slidy.lang = "en";
4466 }
4467 };
4468
4469 // hack for back button behavior
4470 if (w3c_slidy.ie6 || w3c_slidy.ie7)
4471 {
4472 document.write("<iframe id='historyFrame' " +
4473 "src='javascript:\"<html"+"></"+"html>\"' " +
4474 "height='1' width='1' " +
4475 "style='position:absolute;left:-800px'></iframe>");
4476 }
4477
4478 // attach event listeners for initialization
4479 w3c_slidy.set_up();
4480
4481 // hide the slides as soon as body element is available
4482 // to reduce annoying screen mess before the onload event
4483 setTimeout(w3c_slidy.hide_slides, 50);
4484
4485 /*]]>*/
4486 </script>
4487 <script type="text/javascript">
4488 /*<![CDATA[*/
4489 /*
4490 LaTeXMathML.js
4491 ==============
4492
4493 This file, in this form, is due to Douglas Woodall, June 2006.
4494 It contains JavaScript functions to convert (most simple) LaTeX
4495 math notation to Presentation MathML. It was obtained by
4496 downloading the file ASCIIMathML.js from
4497 http://www1.chapman.edu/~jipsen/mathml/asciimathdownload/
4498 and modifying it so that it carries out ONLY those conversions
4499 that would be carried out in LaTeX. A description of the original
4500 file, with examples, can be found at
4501 www1.chapman.edu/~jipsen/mathml/asciimath.html
4502 ASCIIMathML: Math on the web for everyone
4503
4504 Here is the header notice from the original file:
4505
4506 ASCIIMathML.js
4507 ==============
4508 This file contains JavaScript functions to convert ASCII math notation
4509 to Presentation MathML. The conversion is done while the (X)HTML page
4510 loads, and should work with Firefox/Mozilla/Netscape 7+ and Internet
4511 Explorer 6+MathPlayer (http://www.dessci.com/en/products/mathplayer/).
4512 Just add the next line to your (X)HTML page with this file in the same folder:
4513 (script type="text/javascript" src="ASCIIMathML.js")(/script)
4514 This is a convenient and inexpensive solution for authoring MathML.
4515
4516 Version 1.4.7 Dec 15, 2005, (c) Peter Jipsen http://www.chapman.edu/~jipsen
4517 Latest version at http://www.chapman.edu/~jipsen/mathml/ASCIIMathML.js
4518 For changes see http://www.chapman.edu/~jipsen/mathml/asciimathchanges.txt
4519 If you use it on a webpage, please send the URL to jipsen@chapman.edu
4520
4521 This program is free software; you can redistribute it and/or modify
4522 it under the terms of the GNU General Public License as published by
4523 the Free Software Foundation; either version 2 of the License, or (at
4524 your option) any later version.
4525
4526 This program is distributed in the hope that it will be useful,
4527 but WITHOUT ANY WARRANTY; without even the implied warranty of
4528 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
4529 General Public License (at http://www.gnu.org/copyleft/gpl.html)
4530 for more details.
4531
4532 LaTeXMathML.js (ctd)
4533 ==============
4534
4535 The instructions for use are the same as for the original
4536 ASCIIMathML.js, except that of course the line you add to your
4537 file should be
4538 (script type="text/javascript" src="LaTeXMathML.js")(/script)
4539 Or use absolute path names if the file is not in the same folder
4540 as your (X)HTML page.
4541 */
4542
4543 var checkForMathML = true; // check if browser can display MathML
4544 var notifyIfNoMathML = true; // display note if no MathML capability
4545 var alertIfNoMathML = false; // show alert box if no MathML capability
4546 // was "red":
4547 var mathcolor = ""; // change it to "" (to inherit) or any other color
4548 // was "serif":
4549 var mathfontfamily = ""; // change to "" to inherit (works in IE)
4550 // or another family (e.g. "arial")
4551 var showasciiformulaonhover = true; // helps students learn ASCIIMath
4552 /*
4553 // Commented out by DRW -- not now used -- see DELIMITERS (twice) near the end
4554 var displaystyle = false; // puts limits above and below large operators
4555 var decimalsign = "."; // change to "," if you like, beware of `(1,2)`!
4556 var AMdelimiter1 = "`", AMescape1 = "\\\\`"; // can use other characters
4557 var AMdelimiter2 = "$", AMescape2 = "\\\\\\$", AMdelimiter2regexp = "\\$";
4558 var doubleblankmathdelimiter = false; // if true, x+1 is equal to `x+1`
4559 // for IE this works only in <!-- -->
4560 //var separatetokens;// has been removed (email me if this is a problem)
4561 */
4562 var isIE = document.createElementNS==null;
4563
4564 if (document.getElementById==null)
4565 alert("This webpage requires a recent browser such as \nMozilla/Netscape 7+ or Internet Explorer 6+MathPlayer")
4566
4567 // all further global variables start with "AM"
4568
4569 function AMcreateElementXHTML(t) {
4570 if (isIE) return document.createElement(t);
4571 else return document.createElementNS("http://www.w3.org/1999/xhtml",t);
4572 }
4573
4574 function AMnoMathMLNote() {
4575 var nd = AMcreateElementXHTML("h3");
4576 nd.setAttribute("align","center")
4577 nd.appendChild(AMcreateElementXHTML("p"));
4578 nd.appendChild(document.createTextNode("To view the "));
4579 var an = AMcreateElementXHTML("a");
4580 an.appendChild(document.createTextNode("LaTeXMathML"));
4581 an.setAttribute("href","http://www.maths.nott.ac.uk/personal/drw/lm.html");
4582 nd.appendChild(an);
4583 nd.appendChild(document.createTextNode(" notation use Internet Explorer 6+"));
4584 an = AMcreateElementXHTML("a");
4585 an.appendChild(document.createTextNode("MathPlayer"));
4586 an.setAttribute("href","http://www.dessci.com/en/products/mathplayer/download.htm");
4587 nd.appendChild(an);
4588 nd.appendChild(document.createTextNode(" or Netscape/Mozilla/Firefox"));
4589 nd.appendChild(AMcreateElementXHTML("p"));
4590 return nd;
4591 }
4592
4593 function AMisMathMLavailable() {
4594 if (navigator.appName.slice(0,8)=="Netscape")
4595 if (navigator.appVersion.slice(0,1)>="5") return null;
4596 else return AMnoMathMLNote();
4597 else if (navigator.appName.slice(0,9)=="Microsoft")
4598 try {
4599 var ActiveX = new ActiveXObject("MathPlayer.Factory.1");
4600 return null;
4601 } catch (e) {
4602 return AMnoMathMLNote();
4603 }
4604 else return AMnoMathMLNote();
4605 }
4606
4607 // character lists for Mozilla/Netscape fonts
4608 var AMcal = ["\uD835\uDC9C", "\uD835\uDC9D", "\uD835\uDC9E", "\uD835\uDC9F", "\uD835\uDCA0", "\uD835\uDCA1", "\uD835\uDCA2", "\uD835\uDCA3", "\uD835\uDCA4", "\uD835\uDCA5", "\uD835\uDCA6", "\uD835\uDCA7", "\uD835\uDCA8", "\uD835\uDCA9", "\uD835\uDCAA", "\uD835\uDCAB", "\uD835\uDCAC", "\uD835\uDCAD", "\uD835\uDCAE", "\uD835\uDCAF", "\uD835\uDCB0", "\uD835\uDCB1", "\uD835\uDCB2", "\uD835\uDCB3", "\uD835\uDCB4", "\uD835\uDCB5"];
4609 var AMfrk = ["\uD835\uDD04", "\uD835\uDD05", "\uD835\uDD06", "\uD835\uDD07", "\uD835\uDD08", "\uD835\uDD09", "\uD835\uDD0A", "\uD835\uDD0B", "\uD835\uDD0C", "\uD835\uDD0D", "\uD835\uDD0E", "\uD835\uDD0F", "\uD835\uDD10", "\uD835\uDD11", "\uD835\uDD12", "\uD835\uDD13", "\uD835\uDD14", "\uD835\uDD15", "\uD835\uDD16", "\uD835\uDD17", "\uD835\uDD18", "\uD835\uDD19", "\uD835\uDD1A", "\uD835\uDD1B", "\uD835\uDD1C", "\uD835\uDD1D"];
4610 var AMbbb = ["\uD835\uDD38", "\uD835\uDD39", "\uD835\uDD3A", "\uD835\uDD3B", "\uD835\uDD3C", "\uD835\uDD3D", "\uD835\uDD3E", "\uD835\uDD3F", "\uD835\uDD40", "\uD835\uDD41", "\uD835\uDD42", "\uD835\uDD43", "\uD835\uDD44", "\uD835\uDD45", "\uD835\uDD46", "\uD835\uDD47", "\uD835\uDD48", "\uD835\uDD49", "\uD835\uDD4A", "\uD835\uDD4B", "\uD835\uDD4C", "\uD835\uDD4D", "\uD835\uDD4E", "\uD835\uDD4F", "\uD835\uDD50", "\uD835\uDD51"];
4611
4612 var CONST = 0, UNARY = 1, BINARY = 2, INFIX = 3, LEFTBRACKET = 4,
4613 RIGHTBRACKET = 5, SPACE = 6, UNDEROVER = 7, DEFINITION = 8,
4614 TEXT = 9, BIG = 10, LONG = 11, STRETCHY = 12, MATRIX = 13; // token types
4615
4616 var AMsqrt = {input:"\\sqrt", tag:"msqrt", output:"sqrt", ttype:UNARY},
4617 AMnot = {input:"\\not", tag:"mnot", output:"not", ttype:UNARY},
4618 AMroot = {input:"\\root", tag:"mroot", output:"root", ttype:BINARY},
4619 AMfrac = {input:"\\frac", tag:"mfrac", output:"/", ttype:BINARY},
4620 AMover = {input:"\\stackrel", tag:"mover", output:"stackrel", ttype:BINARY},
4621 AMatop = {input:"\\atop", tag:"mfrac", output:"", ttype:INFIX},
4622 AMchoose = {input:"\\choose", tag:"mfrac", output:"", ttype:INFIX},
4623 AMsub = {input:"_", tag:"msub", output:"_", ttype:INFIX},
4624 AMsup = {input:"^", tag:"msup", output:"^", ttype:INFIX},
4625 AMtext = {input:"\\mathrm", tag:"mtext", output:"text", ttype:TEXT},
4626 AMmbox = {input:"\\mbox", tag:"mtext", output:"mbox", ttype:TEXT};
4627
4628 // Commented out by DRW to prevent 1/2 turning into a 2-line fraction
4629 // AMdiv = {input:"/", tag:"mfrac", output:"/", ttype:INFIX},
4630 // Commented out by DRW so that " prints literally in equations
4631 // AMquote = {input:"\"", tag:"mtext", output:"mbox", ttype:TEXT};
4632
4633 // List of negations obtained from http://frodo.elon.edu/tutorial/tutorial.pdf
4634 var AMRelationNegations = {
4635 "\u003C":"\u226E", "\u003E":"\u226F", "\u2264":"\u2270", "\u2265":"\u2271",
4636 "\u003D":"\u2260", "\u2261":"\u2262", "\u227A":"\u2280", "\u227B":"\u2281",
4637 "\u227C":"\u22E0", "\u227D":"\u22E1", "\u223C":"\u2241", "\u2243":"\u2244",
4638 "\u2282":"\u2284", "\u2283":"\u2285", "\u2286":"\u2288", "\u2287":"\u2289",
4639 "\u2248":"\u2249", "\u2245":"\u2247", "\u2291":"\u22E2", "\u2292":"\u22E3",
4640 "\u224D":"\u226D"
4641 }
4642
4643 var AMsymbols = [
4644 //Greek letters
4645 {input:"\\alpha", tag:"mi", output:"\u03B1", ttype:CONST},
4646 {input:"\\beta", tag:"mi", output:"\u03B2", ttype:CONST},
4647 {input:"\\gamma", tag:"mi", output:"\u03B3", ttype:CONST},
4648 {input:"\\delta", tag:"mi", output:"\u03B4", ttype:CONST},
4649 {input:"\\epsilon", tag:"mi", output:"\u03B5", ttype:CONST},
4650 {input:"\\varepsilon", tag:"mi", output:"\u025B", ttype:CONST},
4651 {input:"\\zeta", tag:"mi", output:"\u03B6", ttype:CONST},
4652 {input:"\\eta", tag:"mi", output:"\u03B7", ttype:CONST},
4653 {input:"\\theta", tag:"mi", output:"\u03B8", ttype:CONST},
4654 {input:"\\vartheta", tag:"mi", output:"\u03D1", ttype:CONST},
4655 {input:"\\iota", tag:"mi", output:"\u03B9", ttype:CONST},
4656 {input:"\\kappa", tag:"mi", output:"\u03BA", ttype:CONST},
4657 {input:"\\lambda", tag:"mi", output:"\u03BB", ttype:CONST},
4658 {input:"\\mu", tag:"mi", output:"\u03BC", ttype:CONST},
4659 {input:"\\nu", tag:"mi", output:"\u03BD", ttype:CONST},
4660 {input:"\\xi", tag:"mi", output:"\u03BE", ttype:CONST},
4661 {input:"\\pi", tag:"mi", output:"\u03C0", ttype:CONST},
4662 {input:"\\varpi", tag:"mi", output:"\u03D6", ttype:CONST},
4663 {input:"\\rho", tag:"mi", output:"\u03C1", ttype:CONST},
4664 {input:"\\varrho", tag:"mi", output:"\u03F1", ttype:CONST},
4665 {input:"\\varsigma", tag:"mi", output:"\u03C2", ttype:CONST},
4666 {input:"\\sigma", tag:"mi", output:"\u03C3", ttype:CONST},
4667 {input:"\\tau", tag:"mi", output:"\u03C4", ttype:CONST},
4668 {input:"\\upsilon", tag:"mi", output:"\u03C5", ttype:CONST},
4669 {input:"\\phi", tag:"mi", output:"\u03C6", ttype:CONST},
4670 {input:"\\varphi", tag:"mi", output:"\u03D5", ttype:CONST},
4671 {input:"\\chi", tag:"mi", output:"\u03C7", ttype:CONST},
4672 {input:"\\psi", tag:"mi", output:"\u03C8", ttype:CONST},
4673 {input:"\\omega", tag:"mi", output:"\u03C9", ttype:CONST},
4674 {input:"\\Gamma", tag:"mo", output:"\u0393", ttype:CONST},
4675 {input:"\\Delta", tag:"mo", output:"\u0394", ttype:CONST},
4676 {input:"\\Theta", tag:"mo", output:"\u0398", ttype:CONST},
4677 {input:"\\Lambda", tag:"mo", output:"\u039B", ttype:CONST},
4678 {input:"\\Xi", tag:"mo", output:"\u039E", ttype:CONST},
4679 {input:"\\Pi", tag:"mo", output:"\u03A0", ttype:CONST},
4680 {input:"\\Sigma", tag:"mo", output:"\u03A3", ttype:CONST},
4681 {input:"\\Upsilon", tag:"mo", output:"\u03A5", ttype:CONST},
4682 {input:"\\Phi", tag:"mo", output:"\u03A6", ttype:CONST},
4683 {input:"\\Psi", tag:"mo", output:"\u03A8", ttype:CONST},
4684 {input:"\\Omega", tag:"mo", output:"\u03A9", ttype:CONST},
4685
4686 //fractions
4687 {input:"\\frac12", tag:"mo", output:"\u00BD", ttype:CONST},
4688 {input:"\\frac14", tag:"mo", output:"\u00BC", ttype:CONST},
4689 {input:"\\frac34", tag:"mo", output:"\u00BE", ttype:CONST},
4690 {input:"\\frac13", tag:"mo", output:"\u2153", ttype:CONST},
4691 {input:"\\frac23", tag:"mo", output:"\u2154", ttype:CONST},
4692 {input:"\\frac15", tag:"mo", output:"\u2155", ttype:CONST},
4693 {input:"\\frac25", tag:"mo", output:"\u2156", ttype:CONST},
4694 {input:"\\frac35", tag:"mo", output:"\u2157", ttype:CONST},
4695 {input:"\\frac45", tag:"mo", output:"\u2158", ttype:CONST},
4696 {input:"\\frac16", tag:"mo", output:"\u2159", ttype:CONST},
4697 {input:"\\frac56", tag:"mo", output:"\u215A", ttype:CONST},
4698 {input:"\\frac18", tag:"mo", output:"\u215B", ttype:CONST},
4699 {input:"\\frac38", tag:"mo", output:"\u215C", ttype:CONST},
4700 {input:"\\frac58", tag:"mo", output:"\u215D", ttype:CONST},
4701 {input:"\\frac78", tag:"mo", output:"\u215E", ttype:CONST},
4702
4703 //binary operation symbols
4704 {input:"\\pm", tag:"mo", output:"\u00B1", ttype:CONST},
4705 {input:"\\mp", tag:"mo", output:"\u2213", ttype:CONST},
4706 {input:"\\triangleleft",tag:"mo", output:"\u22B2", ttype:CONST},
4707 {input:"\\triangleright",tag:"mo",output:"\u22B3", ttype:CONST},
4708 {input:"\\cdot", tag:"mo", output:"\u22C5", ttype:CONST},
4709 {input:"\\star", tag:"mo", output:"\u22C6", ttype:CONST},
4710 {input:"\\ast", tag:"mo", output:"\u002A", ttype:CONST},
4711 {input:"\\times", tag:"mo", output:"\u00D7", ttype:CONST},
4712 {input:"\\div", tag:"mo", output:"\u00F7", ttype:CONST},
4713 {input:"\\circ", tag:"mo", output:"\u2218", ttype:CONST},
4714 //{input:"\\bullet", tag:"mo", output:"\u2219", ttype:CONST},
4715 {input:"\\bullet", tag:"mo", output:"\u2022", ttype:CONST},
4716 {input:"\\oplus", tag:"mo", output:"\u2295", ttype:CONST},
4717 {input:"\\ominus", tag:"mo", output:"\u2296", ttype:CONST},
4718 {input:"\\otimes", tag:"mo", output:"\u2297", ttype:CONST},
4719 {input:"\\bigcirc", tag:"mo", output:"\u25CB", ttype:CONST},
4720 {input:"\\oslash", tag:"mo", output:"\u2298", ttype:CONST},
4721 {input:"\\odot", tag:"mo", output:"\u2299", ttype:CONST},
4722 {input:"\\land", tag:"mo", output:"\u2227", ttype:CONST},
4723 {input:"\\wedge", tag:"mo", output:"\u2227", ttype:CONST},
4724 {input:"\\lor", tag:"mo", output:"\u2228", ttype:CONST},
4725 {input:"\\vee", tag:"mo", output:"\u2228", ttype:CONST},
4726 {input:"\\cap", tag:"mo", output:"\u2229", ttype:CONST},
4727 {input:"\\cup", tag:"mo", output:"\u222A", ttype:CONST},
4728 {input:"\\sqcap", tag:"mo", output:"\u2293", ttype:CONST},
4729 {input:"\\sqcup", tag:"mo", output:"\u2294", ttype:CONST},
4730 {input:"\\uplus", tag:"mo", output:"\u228E", ttype:CONST},
4731 {input:"\\amalg", tag:"mo", output:"\u2210", ttype:CONST},
4732 {input:"\\bigtriangleup",tag:"mo",output:"\u25B3", ttype:CONST},
4733 {input:"\\bigtriangledown",tag:"mo",output:"\u25BD", ttype:CONST},
4734 {input:"\\dag", tag:"mo", output:"\u2020", ttype:CONST},
4735 {input:"\\dagger", tag:"mo", output:"\u2020", ttype:CONST},
4736 {input:"\\ddag", tag:"mo", output:"\u2021", ttype:CONST},
4737 {input:"\\ddagger", tag:"mo", output:"\u2021", ttype:CONST},
4738 {input:"\\lhd", tag:"mo", output:"\u22B2", ttype:CONST},
4739 {input:"\\rhd", tag:"mo", output:"\u22B3", ttype:CONST},
4740 {input:"\\unlhd", tag:"mo", output:"\u22B4", ttype:CONST},
4741 {input:"\\unrhd", tag:"mo", output:"\u22B5", ttype:CONST},
4742
4743
4744 //BIG Operators
4745 {input:"\\sum", tag:"mo", output:"\u2211", ttype:UNDEROVER},
4746 {input:"\\prod", tag:"mo", output:"\u220F", ttype:UNDEROVER},
4747 {input:"\\bigcap", tag:"mo", output:"\u22C2", ttype:UNDEROVER},
4748 {input:"\\bigcup", tag:"mo", output:"\u22C3", ttype:UNDEROVER},
4749 {input:"\\bigwedge", tag:"mo", output:"\u22C0", ttype:UNDEROVER},
4750 {input:"\\bigvee", tag:"mo", output:"\u22C1", ttype:UNDEROVER},
4751 {input:"\\bigsqcap", tag:"mo", output:"\u2A05", ttype:UNDEROVER},
4752 {input:"\\bigsqcup", tag:"mo", output:"\u2A06", ttype:UNDEROVER},
4753 {input:"\\coprod", tag:"mo", output:"\u2210", ttype:UNDEROVER},
4754 {input:"\\bigoplus", tag:"mo", output:"\u2A01", ttype:UNDEROVER},
4755 {input:"\\bigotimes", tag:"mo", output:"\u2A02", ttype:UNDEROVER},
4756 {input:"\\bigodot", tag:"mo", output:"\u2A00", ttype:UNDEROVER},
4757 {input:"\\biguplus", tag:"mo", output:"\u2A04", ttype:UNDEROVER},
4758 {input:"\\int", tag:"mo", output:"\u222B", ttype:CONST},
4759 {input:"\\oint", tag:"mo", output:"\u222E", ttype:CONST},
4760
4761 //binary relation symbols
4762 {input:":=", tag:"mo", output:":=", ttype:CONST},
4763 {input:"\\lt", tag:"mo", output:"<", ttype:CONST},
4764 {input:"\\gt", tag:"mo", output:">", ttype:CONST},
4765 {input:"\\ne", tag:"mo", output:"\u2260", ttype:CONST},
4766 {input:"\\neq", tag:"mo", output:"\u2260", ttype:CONST},
4767 {input:"\\le", tag:"mo", output:"\u2264", ttype:CONST},
4768 {input:"\\leq", tag:"mo", output:"\u2264", ttype:CONST},
4769 {input:"\\leqslant", tag:"mo", output:"\u2264", ttype:CONST},
4770 {input:"\\ge", tag:"mo", output:"\u2265", ttype:CONST},
4771 {input:"\\geq", tag:"mo", output:"\u2265", ttype:CONST},
4772 {input:"\\geqslant", tag:"mo", output:"\u2265", ttype:CONST},
4773 {input:"\\equiv", tag:"mo", output:"\u2261", ttype:CONST},
4774 {input:"\\ll", tag:"mo", output:"\u226A", ttype:CONST},
4775 {input:"\\gg", tag:"mo", output:"\u226B", ttype:CONST},
4776 {input:"\\doteq", tag:"mo", output:"\u2250", ttype:CONST},
4777 {input:"\\prec", tag:"mo", output:"\u227A", ttype:CONST},
4778 {input:"\\succ", tag:"mo", output:"\u227B", ttype:CONST},
4779 {input:"\\preceq", tag:"mo", output:"\u227C", ttype:CONST},
4780 {input:"\\succeq", tag:"mo", output:"\u227D", ttype:CONST},
4781 {input:"\\subset", tag:"mo", output:"\u2282", ttype:CONST},
4782 {input:"\\supset", tag:"mo", output:"\u2283", ttype:CONST},
4783 {input:"\\subseteq", tag:"mo", output:"\u2286", ttype:CONST},
4784 {input:"\\supseteq", tag:"mo", output:"\u2287", ttype:CONST},
4785 {input:"\\subsetneq", tag:"mo", output:"\u228A", ttype:CONST},
4786 {input:"\\supsetneq", tag:"mo", output:"\u228B", ttype:CONST},
4787 {input:"\\sqsubset", tag:"mo", output:"\u228F", ttype:CONST},
4788 {input:"\\sqsupset", tag:"mo", output:"\u2290", ttype:CONST},
4789 {input:"\\sqsubseteq", tag:"mo", output:"\u2291", ttype:CONST},
4790 {input:"\\sqsupseteq", tag:"mo", output:"\u2292", ttype:CONST},
4791 {input:"\\sim", tag:"mo", output:"\u223C", ttype:CONST},
4792 {input:"\\simeq", tag:"mo", output:"\u2243", ttype:CONST},
4793 {input:"\\approx", tag:"mo", output:"\u2248", ttype:CONST},
4794 {input:"\\cong", tag:"mo", output:"\u2245", ttype:CONST},
4795 {input:"\\Join", tag:"mo", output:"\u22C8", ttype:CONST},
4796 {input:"\\bowtie", tag:"mo", output:"\u22C8", ttype:CONST},
4797 {input:"\\in", tag:"mo", output:"\u2208", ttype:CONST},
4798 {input:"\\ni", tag:"mo", output:"\u220B", ttype:CONST},
4799 {input:"\\owns", tag:"mo", output:"\u220B", ttype:CONST},
4800 {input:"\\propto", tag:"mo", output:"\u221D", ttype:CONST},
4801 {input:"\\vdash", tag:"mo", output:"\u22A2", ttype:CONST},
4802 {input:"\\dashv", tag:"mo", output:"\u22A3", ttype:CONST},
4803 {input:"\\models", tag:"mo", output:"\u22A8", ttype:CONST},
4804 {input:"\\perp", tag:"mo", output:"\u22A5", ttype:CONST},
4805 {input:"\\smile", tag:"mo", output:"\u2323", ttype:CONST},
4806 {input:"\\frown", tag:"mo", output:"\u2322", ttype:CONST},
4807 {input:"\\asymp", tag:"mo", output:"\u224D", ttype:CONST},
4808 {input:"\\notin", tag:"mo", output:"\u2209", ttype:CONST},
4809
4810 //matrices
4811 {input:"\\begin{eqnarray}", output:"X", ttype:MATRIX, invisible:true},
4812 {input:"\\begin{array}", output:"X", ttype:MATRIX, invisible:true},
4813 {input:"\\\\", output:"}&{", ttype:DEFINITION},
4814 {input:"\\end{eqnarray}", output:"}}", ttype:DEFINITION},
4815 {input:"\\end{array}", output:"}}", ttype:DEFINITION},
4816
4817 //grouping and literal brackets -- ieval is for IE
4818 {input:"\\big", tag:"mo", output:"X", atval:"1.2", ieval:"2.2", ttype:BIG},
4819 {input:"\\Big", tag:"mo", output:"X", atval:"1.6", ieval:"2.6", ttype:BIG},
4820 {input:"\\bigg", tag:"mo", output:"X", atval:"2.2", ieval:"3.2", ttype:BIG},
4821 {input:"\\Bigg", tag:"mo", output:"X", atval:"2.9", ieval:"3.9", ttype:BIG},
4822 {input:"\\left", tag:"mo", output:"X", ttype:LEFTBRACKET},
4823 {input:"\\right", tag:"mo", output:"X", ttype:RIGHTBRACKET},
4824 {input:"{", output:"{", ttype:LEFTBRACKET, invisible:true},
4825 {input:"}", output:"}", ttype:RIGHTBRACKET, invisible:true},
4826
4827 {input:"(", tag:"mo", output:"(", atval:"1", ttype:STRETCHY},
4828 {input:"[", tag:"mo", output:"[", atval:"1", ttype:STRETCHY},
4829 {input:"\\lbrack", tag:"mo", output:"[", atval:"1", ttype:STRETCHY},
4830 {input:"\\{", tag:"mo", output:"{", atval:"1", ttype:STRETCHY},
4831 {input:"\\lbrace", tag:"mo", output:"{", atval:"1", ttype:STRETCHY},
4832 {input:"\\langle", tag:"mo", output:"\u2329", atval:"1", ttype:STRETCHY},
4833 {input:"\\lfloor", tag:"mo", output:"\u230A", atval:"1", ttype:STRETCHY},
4834 {input:"\\lceil", tag:"mo", output:"\u2308", atval:"1", ttype:STRETCHY},
4835
4836 // rtag:"mi" causes space to be inserted before a following sin, cos, etc.
4837 // (see function AMparseExpr() )
4838 {input:")", tag:"mo",output:")", rtag:"mi",atval:"1",ttype:STRETCHY},
4839 {input:"]", tag:"mo",output:"]", rtag:"mi",atval:"1",ttype:STRETCHY},
4840 {input:"\\rbrack",tag:"mo",output:"]", rtag:"mi",atval:"1",ttype:STRETCHY},
4841 {input:"\\}", tag:"mo",output:"}", rtag:"mi",atval:"1",ttype:STRETCHY},
4842 {input:"\\rbrace",tag:"mo",output:"}", rtag:"mi",atval:"1",ttype:STRETCHY},
4843 {input:"\\rangle",tag:"mo",output:"\u232A", rtag:"mi",atval:"1",ttype:STRETCHY},
4844 {input:"\\rfloor",tag:"mo",output:"\u230B", rtag:"mi",atval:"1",ttype:STRETCHY},
4845 {input:"\\rceil", tag:"mo",output:"\u2309", rtag:"mi",atval:"1",ttype:STRETCHY},
4846
4847 // "|", "\\|", "\\vert" and "\\Vert" modified later: lspace = rspace = 0em
4848 {input:"|", tag:"mo", output:"\u2223", atval:"1", ttype:STRETCHY},
4849 {input:"\\|", tag:"mo", output:"\u2225", atval:"1", ttype:STRETCHY},
4850 {input:"\\vert", tag:"mo", output:"\u2223", atval:"1", ttype:STRETCHY},
4851 {input:"\\Vert", tag:"mo", output:"\u2225", atval:"1", ttype:STRETCHY},
4852 {input:"\\mid", tag:"mo", output:"\u2223", atval:"1", ttype:STRETCHY},
4853 {input:"\\parallel", tag:"mo", output:"\u2225", atval:"1", ttype:STRETCHY},
4854 {input:"/", tag:"mo", output:"/", atval:"1.01", ttype:STRETCHY},
4855 {input:"\\backslash", tag:"mo", output:"\u2216", atval:"1", ttype:STRETCHY},
4856 {input:"\\setminus", tag:"mo", output:"\\", ttype:CONST},
4857
4858 //miscellaneous symbols
4859 {input:"\\!", tag:"mspace", atname:"width", atval:"-0.167em", ttype:SPACE},
4860 {input:"\\,", tag:"mspace", atname:"width", atval:"0.167em", ttype:SPACE},
4861 {input:"\\>", tag:"mspace", atname:"width", atval:"0.222em", ttype:SPACE},
4862 {input:"\\:", tag:"mspace", atname:"width", atval:"0.222em", ttype:SPACE},
4863 {input:"\\;", tag:"mspace", atname:"width", atval:"0.278em", ttype:SPACE},
4864 {input:"~", tag:"mspace", atname:"width", atval:"0.333em", ttype:SPACE},
4865 {input:"\\quad", tag:"mspace", atname:"width", atval:"1em", ttype:SPACE},
4866 {input:"\\qquad", tag:"mspace", atname:"width", atval:"2em", ttype:SPACE},
4867 //{input:"{}", tag:"mo", output:"\u200B", ttype:CONST}, // zero-width
4868 {input:"\\prime", tag:"mo", output:"\u2032", ttype:CONST},
4869 {input:"'", tag:"mo", output:"\u02B9", ttype:CONST},
4870 {input:"''", tag:"mo", output:"\u02BA", ttype:CONST},
4871 {input:"'''", tag:"mo", output:"\u2034", ttype:CONST},
4872 {input:"''''", tag:"mo", output:"\u2057", ttype:CONST},
4873 {input:"\\ldots", tag:"mo", output:"\u2026", ttype:CONST},
4874 {input:"\\cdots", tag:"mo", output:"\u22EF", ttype:CONST},
4875 {input:"\\vdots", tag:"mo", output:"\u22EE", ttype:CONST},
4876 {input:"\\ddots", tag:"mo", output:"\u22F1", ttype:CONST},
4877 {input:"\\forall", tag:"mo", output:"\u2200", ttype:CONST},
4878 {input:"\\exists", tag:"mo", output:"\u2203", ttype:CONST},
4879 {input:"\\Re", tag:"mo", output:"\u211C", ttype:CONST},
4880 {input:"\\Im", tag:"mo", output:"\u2111", ttype:CONST},
4881 {input:"\\aleph", tag:"mo", output:"\u2135", ttype:CONST},
4882 {input:"\\hbar", tag:"mo", output:"\u210F", ttype:CONST},
4883 {input:"\\ell", tag:"mo", output:"\u2113", ttype:CONST},
4884 {input:"\\wp", tag:"mo", output:"\u2118", ttype:CONST},
4885 {input:"\\emptyset", tag:"mo", output:"\u2205", ttype:CONST},
4886 {input:"\\infty", tag:"mo", output:"\u221E", ttype:CONST},
4887 {input:"\\surd", tag:"mo", output:"\\sqrt{}", ttype:DEFINITION},
4888 {input:"\\partial", tag:"mo", output:"\u2202", ttype:CONST},
4889 {input:"\\nabla", tag:"mo", output:"\u2207", ttype:CONST},
4890 {input:"\\triangle", tag:"mo", output:"\u25B3", ttype:CONST},
4891 {input:"\\therefore", tag:"mo", output:"\u2234", ttype:CONST},
4892 {input:"\\angle", tag:"mo", output:"\u2220", ttype:CONST},
4893 //{input:"\\\\ ", tag:"mo", output:"\u00A0", ttype:CONST},
4894 {input:"\\diamond", tag:"mo", output:"\u22C4", ttype:CONST},
4895 //{input:"\\Diamond", tag:"mo", output:"\u25CA", ttype:CONST},
4896 {input:"\\Diamond", tag:"mo", output:"\u25C7", ttype:CONST},
4897 {input:"\\neg", tag:"mo", output:"\u00AC", ttype:CONST},
4898 {input:"\\lnot", tag:"mo", output:"\u00AC", ttype:CONST},
4899 {input:"\\bot", tag:"mo", output:"\u22A5", ttype:CONST},
4900 {input:"\\top", tag:"mo", output:"\u22A4", ttype:CONST},
4901 {input:"\\square", tag:"mo", output:"\u25AB", ttype:CONST},
4902 {input:"\\Box", tag:"mo", output:"\u25A1", ttype:CONST},
4903 {input:"\\wr", tag:"mo", output:"\u2240", ttype:CONST},
4904
4905 //standard functions
4906 //Note UNDEROVER *must* have tag:"mo" to work properly
4907 {input:"\\arccos", tag:"mi", output:"arccos", ttype:UNARY, func:true},
4908 {input:"\\arcsin", tag:"mi", output:"arcsin", ttype:UNARY, func:true},
4909 {input:"\\arctan", tag:"mi", output:"arctan", ttype:UNARY, func:true},
4910 {input:"\\arg", tag:"mi", output:"arg", ttype:UNARY, func:true},
4911 {input:"\\cos", tag:"mi", output:"cos", ttype:UNARY, func:true},
4912 {input:"\\cosh", tag:"mi", output:"cosh", ttype:UNARY, func:true},
4913 {input:"\\cot", tag:"mi", output:"cot", ttype:UNARY, func:true},
4914 {input:"\\coth", tag:"mi", output:"coth", ttype:UNARY, func:true},
4915 {input:"\\csc", tag:"mi", output:"csc", ttype:UNARY, func:true},
4916 {input:"\\deg", tag:"mi", output:"deg", ttype:UNARY, func:true},
4917 {input:"\\det", tag:"mi", output:"det", ttype:UNARY, func:true},
4918 {input:"\\dim", tag:"mi", output:"dim", ttype:UNARY, func:true}, //CONST?
4919 {input:"\\exp", tag:"mi", output:"exp", ttype:UNARY, func:true},
4920 {input:"\\gcd", tag:"mi", output:"gcd", ttype:UNARY, func:true}, //CONST?
4921 {input:"\\hom", tag:"mi", output:"hom", ttype:UNARY, func:true},
4922 {input:"\\inf", tag:"mo", output:"inf", ttype:UNDEROVER},
4923 {input:"\\ker", tag:"mi", output:"ker", ttype:UNARY, func:true},
4924 {input:"\\lg", tag:"mi", output:"lg", ttype:UNARY, func:true},
4925 {input:"\\lim", tag:"mo", output:"lim", ttype:UNDEROVER},
4926 {input:"\\liminf", tag:"mo", output:"liminf", ttype:UNDEROVER},
4927 {input:"\\limsup", tag:"mo", output:"limsup", ttype:UNDEROVER},
4928 {input:"\\ln", tag:"mi", output:"ln", ttype:UNARY, func:true},
4929 {input:"\\log", tag:"mi", output:"log", ttype:UNARY, func:true},
4930 {input:"\\max", tag:"mo", output:"max", ttype:UNDEROVER},
4931 {input:"\\min", tag:"mo", output:"min", ttype:UNDEROVER},
4932 {input:"\\Pr", tag:"mi", output:"Pr", ttype:UNARY, func:true},
4933 {input:"\\sec", tag:"mi", output:"sec", ttype:UNARY, func:true},
4934 {input:"\\sin", tag:"mi", output:"sin", ttype:UNARY, func:true},
4935 {input:"\\sinh", tag:"mi", output:"sinh", ttype:UNARY, func:true},
4936 {input:"\\sup", tag:"mo", output:"sup", ttype:UNDEROVER},
4937 {input:"\\tan", tag:"mi", output:"tan", ttype:UNARY, func:true},
4938 {input:"\\tanh", tag:"mi", output:"tanh", ttype:UNARY, func:true},
4939
4940 //arrows
4941 {input:"\\gets", tag:"mo", output:"\u2190", ttype:CONST},
4942 {input:"\\leftarrow", tag:"mo", output:"\u2190", ttype:CONST},
4943 {input:"\\to", tag:"mo", output:"\u2192", ttype:CONST},
4944 {input:"\\rightarrow", tag:"mo", output:"\u2192", ttype:CONST},
4945 {input:"\\leftrightarrow", tag:"mo", output:"\u2194", ttype:CONST},
4946 {input:"\\uparrow", tag:"mo", output:"\u2191", ttype:CONST},
4947 {input:"\\downarrow", tag:"mo", output:"\u2193", ttype:CONST},
4948 {input:"\\updownarrow", tag:"mo", output:"\u2195", ttype:CONST},
4949 {input:"\\Leftarrow", tag:"mo", output:"\u21D0", ttype:CONST},
4950 {input:"\\Rightarrow", tag:"mo", output:"\u21D2", ttype:CONST},
4951 {input:"\\Leftrightarrow", tag:"mo", output:"\u21D4", ttype:CONST},
4952 {input:"\\iff", tag:"mo", output:"~\\Longleftrightarrow~", ttype:DEFINITION},
4953 {input:"\\Uparrow", tag:"mo", output:"\u21D1", ttype:CONST},
4954 {input:"\\Downarrow", tag:"mo", output:"\u21D3", ttype:CONST},
4955 {input:"\\Updownarrow", tag:"mo", output:"\u21D5", ttype:CONST},
4956 {input:"\\mapsto", tag:"mo", output:"\u21A6", ttype:CONST},
4957 {input:"\\longleftarrow", tag:"mo", output:"\u2190", ttype:LONG},
4958 {input:"\\longrightarrow", tag:"mo", output:"\u2192", ttype:LONG},
4959 {input:"\\longleftrightarrow", tag:"mo", output:"\u2194", ttype:LONG},
4960 {input:"\\Longleftarrow", tag:"mo", output:"\u21D0", ttype:LONG},
4961 {input:"\\Longrightarrow", tag:"mo", output:"\u21D2", ttype:LONG},
4962 {input:"\\Longleftrightarrow", tag:"mo", output:"\u21D4", ttype:LONG},
4963 {input:"\\longmapsto", tag:"mo", output:"\u21A6", ttype:CONST},
4964 // disaster if LONG
4965
4966 //commands with argument
4967 AMsqrt, AMnot, AMroot, AMfrac, AMover, AMsub, AMsup, AMtext, AMmbox, AMatop, AMchoose,
4968
4969 //AMdiv, AMquote,
4970
4971 //diacritical marks
4972 {input:"\\acute", tag:"mover", output:"\u00B4", ttype:UNARY, acc:true},
4973 //{input:"\\acute", tag:"mover", output:"\u0317", ttype:UNARY, acc:true},
4974 //{input:"\\acute", tag:"mover", output:"\u0301", ttype:UNARY, acc:true},
4975 //{input:"\\grave", tag:"mover", output:"\u0300", ttype:UNARY, acc:true},
4976 //{input:"\\grave", tag:"mover", output:"\u0316", ttype:UNARY, acc:true},
4977 {input:"\\grave", tag:"mover", output:"\u0060", ttype:UNARY, acc:true},
4978 {input:"\\breve", tag:"mover", output:"\u02D8", ttype:UNARY, acc:true},
4979 {input:"\\check", tag:"mover", output:"\u02C7", ttype:UNARY, acc:true},
4980 {input:"\\dot", tag:"mover", output:".", ttype:UNARY, acc:true},
4981 {input:"\\ddot", tag:"mover", output:"..", ttype:UNARY, acc:true},
4982 //{input:"\\ddot", tag:"mover", output:"\u00A8", ttype:UNARY, acc:true},
4983 {input:"\\mathring", tag:"mover", output:"\u00B0", ttype:UNARY, acc:true},
4984 {input:"\\vec", tag:"mover", output:"\u20D7", ttype:UNARY, acc:true},
4985 {input:"\\overrightarrow",tag:"mover",output:"\u20D7", ttype:UNARY, acc:true},
4986 {input:"\\overleftarrow",tag:"mover", output:"\u20D6", ttype:UNARY, acc:true},
4987 {input:"\\hat", tag:"mover", output:"\u005E", ttype:UNARY, acc:true},
4988 {input:"\\widehat", tag:"mover", output:"\u0302", ttype:UNARY, acc:true},
4989 {input:"\\tilde", tag:"mover", output:"~", ttype:UNARY, acc:true},
4990 //{input:"\\tilde", tag:"mover", output:"\u0303", ttype:UNARY, acc:true},
4991 {input:"\\widetilde", tag:"mover", output:"\u02DC", ttype:UNARY, acc:true},
4992 {input:"\\bar", tag:"mover", output:"\u203E", ttype:UNARY, acc:true},
4993 {input:"\\overbrace", tag:"mover", output:"\uFE37", ttype:UNARY, acc:true}, //Changed unicode overbrace
4994 {input:"\\overbracket", tag:"mover", output:"\u23B4", ttype:UNARY, acc:true}, //old overbrace = overbracket
4995 {input:"\\overline", tag:"mover", output:"\u00AF", ttype:UNARY, acc:true},
4996 {input:"\\underbrace", tag:"munder", output:"\uFE38", ttype:UNARY, acc:true}, //Changed unicode underbrace
4997 {input:"\\underbracket",tag:"munder", output:"\u23B5", ttype:UNARY, acc:true}, //old underbrace = underbracket
4998 {input:"\\underline", tag:"munder", output:"\u00AF", ttype:UNARY, acc:true},
4999 //{input:"underline", tag:"munder", output:"\u0332", ttype:UNARY, acc:true},
5000
5001 //typestyles and fonts
5002 {input:"\\displaystyle",tag:"mstyle",atname:"displaystyle",atval:"true", ttype:UNARY},
5003 {input:"\\textstyle",tag:"mstyle",atname:"displaystyle",atval:"false", ttype:UNARY},
5004 {input:"\\scriptstyle",tag:"mstyle",atname:"scriptlevel",atval:"1", ttype:UNARY},
5005 {input:"\\scriptscriptstyle",tag:"mstyle",atname:"scriptlevel",atval:"2", ttype:UNARY},
5006 {input:"\\textrm", tag:"mstyle", output:"\\mathrm", ttype: DEFINITION},
5007 {input:"\\mathbf", tag:"mstyle", atname:"mathvariant", atval:"bold", ttype:UNARY},
5008 {input:"\\textbf", tag:"mstyle", atname:"mathvariant", atval:"bold", ttype:UNARY},
5009 {input:"\\mathit", tag:"mstyle", atname:"mathvariant", atval:"italic", ttype:UNARY},
5010 {input:"\\textit", tag:"mstyle", atname:"mathvariant", atval:"italic", ttype:UNARY},
5011 {input:"\\mathtt", tag:"mstyle", atname:"mathvariant", atval:"monospace", ttype:UNARY},
5012 {input:"\\texttt", tag:"mstyle", atname:"mathvariant", atval:"monospace", ttype:UNARY},
5013 {input:"\\mathsf", tag:"mstyle", atname:"mathvariant", atval:"sans-serif", ttype:UNARY},
5014 {input:"\\mathbb", tag:"mstyle", atname:"mathvariant", atval:"double-struck", ttype:UNARY, codes:AMbbb},
5015 {input:"\\mathcal",tag:"mstyle", atname:"mathvariant", atval:"script", ttype:UNARY, codes:AMcal},
5016 {input:"\\mathfrak",tag:"mstyle",atname:"mathvariant", atval:"fraktur",ttype:UNARY, codes:AMfrk},
5017 {input:"\\textcolor",tag:"mstyle",atname:"mathvariant", atval:"mathcolor", ttype:BINARY},
5018 {input:"\\colorbox",tag:"mstyle",atname:"mathvariant", atval:"background", ttype:BINARY}
5019 ];
5020
5021 function compareNames(s1,s2) {
5022 if (s1.input > s2.input) return 1
5023 else return -1;
5024 }
5025
5026 var AMnames = []; //list of input symbols
5027
5028 function AMinitSymbols() {
5029 AMsymbols.sort(compareNames);
5030 for (i=0; i<AMsymbols.length; i++) AMnames[i] = AMsymbols[i].input;
5031 }
5032
5033 var AMmathml = "http://www.w3.org/1998/Math/MathML";
5034
5035 function AMcreateElementMathML(t) {
5036 if (isIE) return document.createElement("m:"+t);
5037 else return document.createElementNS(AMmathml,t);
5038 }
5039
5040 function AMcreateMmlNode(t,frag) {
5041 // var node = AMcreateElementMathML(name);
5042 if (isIE) var node = document.createElement("m:"+t);
5043 else var node = document.createElementNS(AMmathml,t);
5044 node.appendChild(frag);
5045 return node;
5046 }
5047
5048 function newcommand(oldstr,newstr) {
5049 AMsymbols = AMsymbols.concat([{input:oldstr, tag:"mo", output:newstr,
5050 ttype:DEFINITION}]);
5051 }
5052
5053 function AMremoveCharsAndBlanks(str,n) {
5054 //remove n characters and any following blanks
5055 var st;
5056 st = str.slice(n);
5057 for (var i=0; i<st.length && st.charCodeAt(i)<=32; i=i+1);
5058 return st.slice(i);
5059 }
5060
5061 function AMposition(arr, str, n) {
5062 // return position >=n where str appears or would be inserted
5063 // assumes arr is sorted
5064 if (n==0) {
5065 var h,m;
5066 n = -1;
5067 h = arr.length;
5068 while (n+1<h) {
5069 m = (n+h) >> 1;
5070 if (arr[m]<str) n = m; else h = m;
5071 }
5072 return h;
5073 } else
5074 for (var i=n; i<arr.length && arr[i]<str; i++);
5075 return i; // i=arr.length || arr[i]>=str
5076 }
5077
5078 function AMgetSymbol(str) {
5079 //return maximal initial substring of str that appears in names
5080 //return null if there is none
5081 var k = 0; //new pos
5082 var j = 0; //old pos
5083 var mk; //match pos
5084 var st;
5085 var tagst;
5086 var match = "";
5087 var more = true;
5088 for (var i=1; i<=str.length && more; i++) {
5089 st = str.slice(0,i); //initial substring of length i
5090 j = k;
5091 k = AMposition(AMnames, st, j);
5092 if (k<AMnames.length && str.slice(0,AMnames[k].length)==AMnames[k]){
5093 match = AMnames[k];
5094 mk = k;
5095 i = match.length;
5096 }
5097 more = k<AMnames.length && str.slice(0,AMnames[k].length)>=AMnames[k];
5098 }
5099 AMpreviousSymbol=AMcurrentSymbol;
5100 if (match!=""){
5101 AMcurrentSymbol=AMsymbols[mk].ttype;
5102 return AMsymbols[mk];
5103 }
5104 AMcurrentSymbol=CONST;
5105 k = 1;
5106 st = str.slice(0,1); //take 1 character
5107 if ("0"<=st && st<="9") tagst = "mn";
5108 else tagst = (("A">st || st>"Z") && ("a">st || st>"z")?"mo":"mi");
5109 /*
5110 // Commented out by DRW (not fully understood, but probably to do with
5111 // use of "/" as an INFIX version of "\\frac", which we don't want):
5112 //}
5113 //if (st=="-" && AMpreviousSymbol==INFIX) {
5114 // AMcurrentSymbol = INFIX; //trick "/" into recognizing "-" on second parse
5115 // return {input:st, tag:tagst, output:st, ttype:UNARY, func:true};
5116 //}
5117 */
5118 return {input:st, tag:tagst, output:st, ttype:CONST};
5119 }
5120
5121
5122 /*Parsing ASCII math expressions with the following grammar
5123 v ::= [A-Za-z] | greek letters | numbers | other constant symbols
5124 u ::= sqrt | text | bb | other unary symbols for font commands
5125 b ::= frac | root | stackrel binary symbols
5126 l ::= { | \left left brackets
5127 r ::= } | \right right brackets
5128 S ::= v | lEr | uS | bSS Simple expression
5129 I ::= S_S | S^S | S_S^S | S Intermediate expression
5130 E ::= IE | I/I Expression
5131 Each terminal symbol is translated into a corresponding mathml node.*/
5132
5133 var AMpreviousSymbol,AMcurrentSymbol;
5134
5135 function AMparseSexpr(str) { //parses str and returns [node,tailstr,(node)tag]
5136 var symbol, node, result, result2, i, st,// rightvert = false,
5137 newFrag = document.createDocumentFragment();
5138 str = AMremoveCharsAndBlanks(str,0);
5139 symbol = AMgetSymbol(str); //either a token or a bracket or empty
5140 if (symbol == null || symbol.ttype == RIGHTBRACKET)
5141 return [null,str,null];
5142 if (symbol.ttype == DEFINITION) {
5143 str = symbol.output+AMremoveCharsAndBlanks(str,symbol.input.length);
5144 symbol = AMgetSymbol(str);
5145 if (symbol == null || symbol.ttype == RIGHTBRACKET)
5146 return [null,str,null];
5147 }
5148 str = AMremoveCharsAndBlanks(str,symbol.input.length);
5149 switch (symbol.ttype) {
5150 case SPACE:
5151 node = AMcreateElementMathML(symbol.tag);
5152 node.setAttribute(symbol.atname,symbol.atval);
5153 return [node,str,symbol.tag];
5154 case UNDEROVER:
5155 if (isIE) {
5156 if (symbol.input.substr(0,4) == "\\big") { // botch for missing symbols
5157 str = "\\"+symbol.input.substr(4)+str; // make \bigcup = \cup etc.
5158 symbol = AMgetSymbol(str);
5159 symbol.ttype = UNDEROVER;
5160 str = AMremoveCharsAndBlanks(str,symbol.input.length);
5161 }
5162 }
5163 return [AMcreateMmlNode(symbol.tag,
5164 document.createTextNode(symbol.output)),str,symbol.tag];
5165 case CONST:
5166 var output = symbol.output;
5167 if (isIE) {
5168 if (symbol.input == "'")
5169 output = "\u2032";
5170 else if (symbol.input == "''")
5171 output = "\u2033";
5172 else if (symbol.input == "'''")
5173 output = "\u2033\u2032";
5174 else if (symbol.input == "''''")
5175 output = "\u2033\u2033";
5176 else if (symbol.input == "\\square")
5177 output = "\u25A1"; // same as \Box
5178 else if (symbol.input.substr(0,5) == "\\frac") {
5179 // botch for missing fractions
5180 var denom = symbol.input.substr(6,1);
5181 if (denom == "5" || denom == "6") {
5182 str = symbol.input.replace(/\\frac/,"\\frac ")+str;
5183 return [node,str,symbol.tag];
5184 }
5185 }
5186 }
5187 node = AMcreateMmlNode(symbol.tag,document.createTextNode(output));
5188 return [node,str,symbol.tag];
5189 case LONG: // added by DRW
5190 node = AMcreateMmlNode(symbol.tag,document.createTextNode(symbol.output));
5191 node.setAttribute("minsize","1.5");
5192 node.setAttribute("maxsize","1.5");
5193 node = AMcreateMmlNode("mover",node);
5194 node.appendChild(AMcreateElementMathML("mspace"));
5195 return [node,str,symbol.tag];
5196 case STRETCHY: // added by DRW
5197 if (isIE && symbol.input == "\\backslash")
5198 symbol.output = "\\"; // doesn't expand, but then nor does "\u2216"
5199 node = AMcreateMmlNode(symbol.tag,document.createTextNode(symbol.output));
5200 if (symbol.input == "|" || symbol.input == "\\vert" ||
5201 symbol.input == "\\|" || symbol.input == "\\Vert") {
5202 node.setAttribute("lspace","0em");
5203 node.setAttribute("rspace","0em");
5204 }
5205 node.setAttribute("maxsize",symbol.atval); // don't allow to stretch here
5206 if (symbol.rtag != null)
5207 return [node,str,symbol.rtag];
5208 else
5209 return [node,str,symbol.tag];
5210 case BIG: // added by DRW
5211 var atval = symbol.atval;
5212 if (isIE)
5213 atval = symbol.ieval;
5214 symbol = AMgetSymbol(str);
5215 if (symbol == null)
5216 return [null,str,null];
5217 str = AMremoveCharsAndBlanks(str,symbol.input.length);
5218 node = AMcreateMmlNode(symbol.tag,document.createTextNode(symbol.output));
5219 if (isIE) { // to get brackets to expand
5220 var space = AMcreateElementMathML("mspace");
5221 space.setAttribute("height",atval+"ex");
5222 node = AMcreateMmlNode("mrow",node);
5223 node.appendChild(space);
5224 } else { // ignored in IE
5225 node.setAttribute("minsize",atval);
5226 node.setAttribute("maxsize",atval);
5227 }
5228 return [node,str,symbol.tag];
5229 case LEFTBRACKET: //read (expr+)
5230 if (symbol.input == "\\left") { // left what?
5231 symbol = AMgetSymbol(str);
5232 if (symbol != null) {
5233 if (symbol.input == ".")
5234 symbol.invisible = true;
5235 str = AMremoveCharsAndBlanks(str,symbol.input.length);
5236 }
5237 }
5238 result = AMparseExpr(str,true,false);
5239 if (symbol==null ||
5240 (typeof symbol.invisible == "boolean" && symbol.invisible))
5241 node = AMcreateMmlNode("mrow",result[0]);
5242 else {
5243 node = AMcreateMmlNode("mo",document.createTextNode(symbol.output));
5244 node = AMcreateMmlNode("mrow",node);
5245 node.appendChild(result[0]);
5246 }
5247 return [node,result[1],result[2]];
5248 case MATRIX: //read (expr+)
5249 if (symbol.input == "\\begin{array}") {
5250 var mask = "";
5251 symbol = AMgetSymbol(str);
5252 str = AMremoveCharsAndBlanks(str,0);
5253 if (symbol == null)
5254 mask = "l";
5255 else {
5256 str = AMremoveCharsAndBlanks(str,symbol.input.length);
5257 if (symbol.input != "{")
5258 mask = "l";
5259 else do {
5260 symbol = AMgetSymbol(str);
5261 if (symbol != null) {
5262 str = AMremoveCharsAndBlanks(str,symbol.input.length);
5263 if (symbol.input != "}")
5264 mask = mask+symbol.input;
5265 }
5266 } while (symbol != null && symbol.input != "" && symbol.input != "}");
5267 }
5268 result = AMparseExpr("{"+str,true,true);
5269 // if (result[0]==null) return [AMcreateMmlNode("mo",
5270 // document.createTextNode(symbol.input)),str];
5271 node = AMcreateMmlNode("mtable",result[0]);
5272 mask = mask.replace(/l/g,"left ");
5273 mask = mask.replace(/r/g,"right ");
5274 mask = mask.replace(/c/g,"center ");
5275 node.setAttribute("columnalign",mask);
5276 node.setAttribute("displaystyle","false");
5277 if (isIE)
5278 return [node,result[1],null];
5279 // trying to get a *little* bit of space around the array
5280 // (IE already includes it)
5281 var lspace = AMcreateElementMathML("mspace");
5282 lspace.setAttribute("width","0.167em");
5283 var rspace = AMcreateElementMathML("mspace");
5284 rspace.setAttribute("width","0.167em");
5285 var node1 = AMcreateMmlNode("mrow",lspace);
5286 node1.appendChild(node);
5287 node1.appendChild(rspace);
5288 return [node1,result[1],null];
5289 } else { // eqnarray
5290 result = AMparseExpr("{"+str,true,true);
5291 node = AMcreateMmlNode("mtable",result[0]);
5292 if (isIE)
5293 node.setAttribute("columnspacing","0.25em"); // best in practice?
5294 else
5295 node.setAttribute("columnspacing","0.167em"); // correct (but ignored?)
5296 node.setAttribute("columnalign","right center left");
5297 node.setAttribute("displaystyle","true");
5298 node = AMcreateMmlNode("mrow",node);
5299 return [node,result[1],null];
5300 }
5301 case TEXT:
5302 if (str.charAt(0)=="{") i=str.indexOf("}");
5303 else i = 0;
5304 if (i==-1)
5305 i = str.length;
5306 st = str.slice(1,i);
5307 if (st.charAt(0) == " ") {
5308 node = AMcreateElementMathML("mspace");
5309 node.setAttribute("width","0.33em"); // was 1ex
5310 newFrag.appendChild(node);
5311 }
5312 newFrag.appendChild(
5313 AMcreateMmlNode(symbol.tag,document.createTextNode(st)));
5314 if (st.charAt(st.length-1) == " ") {
5315 node = AMcreateElementMathML("mspace");
5316 node.setAttribute("width","0.33em"); // was 1ex
5317 newFrag.appendChild(node);
5318 }
5319 str = AMremoveCharsAndBlanks(str,i+1);
5320 return [AMcreateMmlNode("mrow",newFrag),str,null];
5321 case UNARY:
5322 result = AMparseSexpr(str);
5323 if (result[0]==null) return [AMcreateMmlNode(symbol.tag,document.createTextNode(symbol.output)),str];
5324 if (typeof symbol.func == "boolean" && symbol.func) { // functions hack
5325 st = str.charAt(0);
5326 // if (st=="^" || st=="_" || st=="/" || st=="|" || st==",") {
5327 if (st=="^" || st=="_" || st==",") {
5328 return [AMcreateMmlNode(symbol.tag,document.createTextNode(symbol.output)),str,symbol.tag];
5329 } else {
5330 node = AMcreateMmlNode("mrow",AMcreateMmlNode(symbol.tag,document.createTextNode(symbol.output)));
5331 if (isIE) {
5332 var space = AMcreateElementMathML("mspace");
5333 space.setAttribute("width","0.167em");
5334 node.appendChild(space);
5335 }
5336 node.appendChild(result[0]);
5337 return [node,result[1],symbol.tag];
5338 }
5339 }
5340 if (symbol.input == "\\sqrt") { // sqrt
5341 if (isIE) { // set minsize, for \surd
5342 var space = AMcreateElementMathML("mspace");
5343 space.setAttribute("height","1.2ex");
5344 space.setAttribute("width","0em"); // probably no effect
5345 node = AMcreateMmlNode(symbol.tag,result[0])
5346 // node.setAttribute("minsize","1"); // ignored
5347 // node = AMcreateMmlNode("mrow",node); // hopefully unnecessary
5348 node.appendChild(space);
5349 return [node,result[1],symbol.tag];
5350 } else
5351 return [AMcreateMmlNode(symbol.tag,result[0]),result[1],symbol.tag];
5352 } else if (typeof symbol.acc == "boolean" && symbol.acc) { // accent
5353 node = AMcreateMmlNode(symbol.tag,result[0]);
5354 var output = symbol.output;
5355 if (isIE) {
5356 if (symbol.input == "\\hat")
5357 output = "\u0302";
5358 else if (symbol.input == "\\widehat")
5359 output = "\u005E";
5360 else if (symbol.input == "\\bar")
5361 output = "\u00AF";
5362 else if (symbol.input == "\\grave")
5363 output = "\u0300";
5364 else if (symbol.input == "\\tilde")
5365 output = "\u0303";
5366 }
5367 var node1 = AMcreateMmlNode("mo",document.createTextNode(output));
5368 if (symbol.input == "\\vec" || symbol.input == "\\check")
5369 // don't allow to stretch
5370 node1.setAttribute("maxsize","1.2");
5371 // why doesn't "1" work? \vec nearly disappears in firefox
5372 if (isIE && symbol.input == "\\bar")
5373 node1.setAttribute("maxsize","0.5");
5374 if (symbol.input == "\\underbrace" || symbol.input == "\\underline")
5375 node1.setAttribute("accentunder","true");
5376 else
5377 node1.setAttribute("accent","true");
5378 node.appendChild(node1);
5379 if (symbol.input == "\\overbrace" || symbol.input == "\\underbrace")
5380 node.ttype = UNDEROVER;
5381 return [node,result[1],symbol.tag];
5382 } else if (symbol.input == "\\not") { // not
5383 // added by infinity0 on 2009-12-15 to implement \not command
5384 text = result[0].childNodes[0].nodeValue;
5385 if (typeof text == "string" && text.length == 1 && text in AMRelationNegations) {
5386 result[0].childNodes[0].nodeValue = AMRelationNegations[text];
5387 return [AMcreateMmlNode(symbol.tag,result[0]),result[1],symbol.tag];
5388 }
5389 return [AMcreateMmlNode("mo",document.createTextNode("\\")),"not " + str,symbol.tag];
5390 } else { // font change or displaystyle command
5391 if (!isIE && typeof symbol.codes != "undefined") {
5392 for (i=0; i<result[0].childNodes.length; i++)
5393 if (result[0].childNodes[i].nodeName=="mi" || result[0].nodeName=="mi") {
5394 st = (result[0].nodeName=="mi"?result[0].firstChild.nodeValue:
5395 result[0].childNodes[i].firstChild.nodeValue);
5396 var newst = [];
5397 for (var j=0; j<st.length; j++)
5398 if (st.charCodeAt(j)>64 && st.charCodeAt(j)<91)
5399 { newst = newst + symbol.codes[st.charCodeAt(j)-65] }
5400 // String.fromCharCode(symbol.codes[st.charCodeAt(j)-65]); alert(newst); }
5401 else newst = newst + st.charAt(j);
5402 if (result[0].nodeName=="mi")
5403 result[0]=AMcreateElementMathML("mo").
5404 appendChild(document.createTextNode(newst));
5405 else result[0].replaceChild(AMcreateElementMathML("mo").
5406 appendChild(document.createTextNode(newst)),result[0].childNodes[i]);
5407 }
5408 }
5409 node = AMcreateMmlNode(symbol.tag,result[0]);
5410 node.setAttribute(symbol.atname,symbol.atval);
5411 if (symbol.input == "\\scriptstyle" ||
5412 symbol.input == "\\scriptscriptstyle")
5413 node.setAttribute("displaystyle","false");
5414 return [node,result[1],symbol.tag];
5415 }
5416 case BINARY:
5417 result = AMparseSexpr(str);
5418 if (result[0]==null) return [AMcreateMmlNode("mo",document.createTextNode(symbol.input)),str,null];
5419 result2 = AMparseSexpr(result[1]);
5420 if (result2[0]==null) return [AMcreateMmlNode("mo",document.createTextNode(symbol.input)),str,null];
5421 //added by J. Knisley to allow \textcolor and \colorbox within equations
5422 if (symbol.input=="\\textcolor" || symbol.input=="\\colorbox") {
5423 var tclr = str.match(/\{s*([#\w]+)\s*\}/); //get's color from beginning of str
5424 str = str.replace(/\{s*[#\w]+\s*\}/,"");
5425 if(tclr!=null) {
5426 if(IsColorName.test(tclr[1].toLowerCase())) {
5427 tclr=LaTeXColor[tclr[1].toLowerCase()];
5428 } else {
5429 tclr=tclr[1]; // no checking for valid color!!
5430 }
5431 node = AMcreateElementMathML("mstyle");
5432 node.setAttribute(symbol.atval,tclr);
5433 node.appendChild(result2[0]);
5434 return [node,result2[1],symbol.tag];
5435 }
5436 }
5437 if (symbol.input=="\\root" || symbol.input=="\\stackrel") newFrag.appendChild(result2[0]);
5438 newFrag.appendChild(result[0]);
5439 if (symbol.input=="\\frac") newFrag.appendChild(result2[0]);
5440 return [AMcreateMmlNode(symbol.tag,newFrag),result2[1],symbol.tag];
5441 case INFIX:
5442 str = AMremoveCharsAndBlanks(str,symbol.input.length);
5443 return [AMcreateMmlNode("mo",document.createTextNode(symbol.output)),
5444 str,symbol.tag];
5445 default:
5446 return [AMcreateMmlNode(symbol.tag, //its a constant
5447 document.createTextNode(symbol.output)),str,symbol.tag];
5448 }
5449 }
5450
5451 function AMparseIexpr(str) {
5452 var symbol, sym1, sym2, node, result, tag, underover;
5453 str = AMremoveCharsAndBlanks(str,0);
5454 sym1 = AMgetSymbol(str);
5455 result = AMparseSexpr(str);
5456 node = result[0];
5457 str = result[1];
5458 tag = result[2];
5459 symbol = AMgetSymbol(str);
5460 if (symbol.ttype == INFIX) {
5461 str = AMremoveCharsAndBlanks(str,symbol.input.length);
5462 result = AMparseSexpr(str);
5463 if (result[0] == null) // show box in place of missing argument
5464 result[0] = AMcreateMmlNode("mo",document.createTextNode("\u25A1"));
5465 str = result[1];
5466 tag = result[2];
5467 if (symbol.input == "_" || symbol.input == "^") {
5468 sym2 = AMgetSymbol(str);
5469 tag = null; // no space between x^2 and a following sin, cos, etc.
5470 // This is for \underbrace and \overbrace
5471 underover = ((sym1.ttype == UNDEROVER) || (node.ttype == UNDEROVER));
5472 // underover = (sym1.ttype == UNDEROVER);
5473 if (symbol.input == "_" && sym2.input == "^") {
5474 str = AMremoveCharsAndBlanks(str,sym2.input.length);
5475 var res2 = AMparseSexpr(str);
5476 str = res2[1];
5477 tag = res2[2]; // leave space between x_1^2 and a following sin etc.
5478 node = AMcreateMmlNode((underover?"munderover":"msubsup"),node);
5479 node.appendChild(result[0]);
5480 node.appendChild(res2[0]);
5481 } else if (symbol.input == "_") {
5482 node = AMcreateMmlNode((underover?"munder":"msub"),node);
5483 node.appendChild(result[0]);
5484 } else {
5485 node = AMcreateMmlNode((underover?"mover":"msup"),node);
5486 node.appendChild(result[0]);
5487 }
5488 node = AMcreateMmlNode("mrow",node); // so sum does not stretch
5489 } else {
5490 node = AMcreateMmlNode(symbol.tag,node);
5491 if (symbol.input == "\\atop" || symbol.input == "\\choose")
5492 node.setAttribute("linethickness","0ex");
5493 node.appendChild(result[0]);
5494 if (symbol.input == "\\choose")
5495 node = AMcreateMmlNode("mfenced",node);
5496 }
5497 }
5498 return [node,str,tag];
5499 }
5500
5501 function AMparseExpr(str,rightbracket,matrix) {
5502 var symbol, node, result, i, tag,
5503 newFrag = document.createDocumentFragment();
5504 do {
5505 str = AMremoveCharsAndBlanks(str,0);
5506 result = AMparseIexpr(str);
5507 node = result[0];
5508 str = result[1];
5509 tag = result[2];
5510 symbol = AMgetSymbol(str);
5511 if (node!=undefined) {
5512 if ((tag == "mn" || tag == "mi") && symbol!=null &&
5513 typeof symbol.func == "boolean" && symbol.func) {
5514 // Add space before \sin in 2\sin x or x\sin x
5515 var space = AMcreateElementMathML("mspace");
5516 space.setAttribute("width","0.167em");
5517 node = AMcreateMmlNode("mrow",node);
5518 node.appendChild(space);
5519 }
5520 newFrag.appendChild(node);
5521 }
5522 } while ((symbol.ttype != RIGHTBRACKET)
5523 && symbol!=null && symbol.output!="");
5524 tag = null;
5525 if (symbol.ttype == RIGHTBRACKET) {
5526 if (symbol.input == "\\right") { // right what?
5527 str = AMremoveCharsAndBlanks(str,symbol.input.length);
5528 symbol = AMgetSymbol(str);
5529 if (symbol != null && symbol.input == ".")
5530 symbol.invisible = true;
5531 if (symbol != null)
5532 tag = symbol.rtag;
5533 }
5534 if (symbol!=null)
5535 str = AMremoveCharsAndBlanks(str,symbol.input.length); // ready to return
5536 var len = newFrag.childNodes.length;
5537 if (matrix &&
5538 len>0 && newFrag.childNodes[len-1].nodeName == "mrow" && len>1 &&
5539 newFrag.childNodes[len-2].nodeName == "mo" &&
5540 newFrag.childNodes[len-2].firstChild.nodeValue == "&") { //matrix
5541 var pos = []; // positions of ampersands
5542 var m = newFrag.childNodes.length;
5543 for (i=0; matrix && i<m; i=i+2) {
5544 pos[i] = [];
5545 node = newFrag.childNodes[i];
5546 for (var j=0; j<node.childNodes.length; j++)
5547 if (node.childNodes[j].firstChild.nodeValue=="&")
5548 pos[i][pos[i].length]=j;
5549 }
5550 var row, frag, n, k, table = document.createDocumentFragment();
5551 for (i=0; i<m; i=i+2) {
5552 row = document.createDocumentFragment();
5553 frag = document.createDocumentFragment();
5554 node = newFrag.firstChild; // <mrow> -&-&...&-&- </mrow>
5555 n = node.childNodes.length;
5556 k = 0;
5557 for (j=0; j<n; j++) {
5558 if (typeof pos[i][k] != "undefined" && j==pos[i][k]){
5559 node.removeChild(node.firstChild); //remove &
5560 row.appendChild(AMcreateMmlNode("mtd",frag));
5561 k++;
5562 } else frag.appendChild(node.firstChild);
5563 }
5564 row.appendChild(AMcreateMmlNode("mtd",frag));
5565 if (newFrag.childNodes.length>2) {
5566 newFrag.removeChild(newFrag.firstChild); //remove <mrow> </mrow>
5567 newFrag.removeChild(newFrag.firstChild); //remove <mo>&</mo>
5568 }
5569 table.appendChild(AMcreateMmlNode("mtr",row));
5570 }
5571 return [table,str];
5572 }
5573 if (typeof symbol.invisible != "boolean" || !symbol.invisible) {
5574 node = AMcreateMmlNode("mo",document.createTextNode(symbol.output));
5575 newFrag.appendChild(node);
5576 }
5577 }
5578 return [newFrag,str,tag];
5579 }
5580
5581 function AMparseMath(str) {
5582 var result, node = AMcreateElementMathML("mstyle");
5583 //added by J. Knisley to allow limited implementation of \color
5584 var cclr = str.match(/\\color\s*\{s*([#\w]+)\s*\}/);
5585 str = str.replace(/\\color\s*\{s*[#\w]+\s*\}/g,"");
5586 if(cclr!=null) {
5587 if(IsColorName.test(cclr[1].toLowerCase())) {
5588 cclr=LaTeXColor[cclr[1].toLowerCase()];
5589 } else {
5590 cclr=cclr[1]; // no checking for valid color!!
5591 }
5592 node.setAttribute("mathcolor",cclr);
5593 } else {
5594 if (mathcolor != "") node.setAttribute("mathcolor",mathcolor);
5595 };
5596 if (mathfontfamily != "") node.setAttribute("fontfamily",mathfontfamily);
5597 node.appendChild(AMparseExpr(str.replace(/^\s+/g,""),false,false)[0]);
5598 node = AMcreateMmlNode("math",node);
5599 if (showasciiformulaonhover) //fixed by djhsu so newline
5600 node.setAttribute("title",str.replace(/\s+/g," "));//does not show in Gecko
5601 if (false ) { //&& mathfontfamily != "" && (isIE || mathfontfamily != "serif")) {
5602 var fnode = AMcreateElementXHTML("font");
5603 fnode.setAttribute("face",mathfontfamily);
5604 fnode.appendChild(node);
5605 return fnode;
5606 }
5607 return node;
5608 }
5609
5610 function AMstrarr2docFrag(arr, linebreaks) {
5611 var newFrag=document.createDocumentFragment();
5612 var expr = false;
5613 for (var i=0; i<arr.length; i++) {
5614 if (expr) newFrag.appendChild(AMparseMath(arr[i]));
5615 else {
5616 var arri = (linebreaks ? arr[i].split("\n\n") : [arr[i]]);
5617 newFrag.appendChild(AMcreateElementXHTML("span").
5618 appendChild(document.createTextNode(arri[0])));
5619 for (var j=1; j<arri.length; j++) {
5620 newFrag.appendChild(AMcreateElementXHTML("p"));
5621 newFrag.appendChild(AMcreateElementXHTML("span").
5622 appendChild(document.createTextNode(arri[j])));
5623 }
5624 }
5625 expr = !expr;
5626 }
5627 return newFrag;
5628 }
5629
5630 function AMprocessNodeR(n, linebreaks) {
5631 var mtch, str, arr, frg, i;
5632 if (n.childNodes.length == 0) {
5633 if ((n.nodeType!=8 || linebreaks) &&
5634 n.parentNode.nodeName!="form" && n.parentNode.nodeName!="FORM" &&
5635 n.parentNode.nodeName!="textarea" && n.parentNode.nodeName!="TEXTAREA" &&
5636 n.parentNode.nodeName!="pre" && n.parentNode.nodeName!="PRE") {
5637 str = n.nodeValue;
5638 if (!(str == null)) {
5639 str = str.replace(/\r\n\r\n/g,"\n\n");
5640 str = str.replace(/\x20+/g," ");
5641 str = str.replace(/\s*\r\n/g," ");
5642 // DELIMITERS:
5643 mtch = (str.indexOf("\$")==-1 ? false : true);
5644 str = str.replace(/([^\\])\$/g,"$1 \$");
5645 str = str.replace(/^\$/," \$"); // in case \$ at start of string
5646 arr = str.split(" \$");
5647 for (i=0; i<arr.length; i++)
5648 arr[i]=arr[i].replace(/\\\$/g,"\$");
5649 if (arr.length>1 || mtch) {
5650 if (checkForMathML) {
5651 checkForMathML = false;
5652 var nd = AMisMathMLavailable();
5653 AMnoMathML = nd != null;
5654 if (AMnoMathML && notifyIfNoMathML)
5655 if (alertIfNoMathML)
5656 alert("To view the ASCIIMathML notation use Internet Explorer 6 +\nMathPlayer (free from www.dessci.com)\n\
5657 or Firefox/Mozilla/Netscape");
5658 else AMbody.insertBefore(nd,AMbody.childNodes[0]);
5659 }
5660 if (!AMnoMathML) {
5661 frg = AMstrarr2docFrag(arr,n.nodeType==8);
5662 var len = frg.childNodes.length;
5663 n.parentNode.replaceChild(frg,n);
5664 return len-1;
5665 } else return 0;
5666 }
5667 }
5668 } else return 0;
5669 } else if (n.nodeName!="math") {
5670 for (i=0; i<n.childNodes.length; i++)
5671 i += AMprocessNodeR(n.childNodes[i], linebreaks);
5672 }
5673 return 0;
5674 }
5675
5676 function AMprocessNode(n, linebreaks, spanclassAM) {
5677 var frag,st;
5678 if (spanclassAM!=null) {
5679 frag = document.getElementsByTagName("span")
5680 for (var i=0;i<frag.length;i++)
5681 if (frag[i].className == "AM")
5682 AMprocessNodeR(frag[i],linebreaks);
5683 } else {
5684 try {
5685 st = n.innerHTML;
5686 } catch(err) {}
5687 // DELIMITERS:
5688 if (st==null || st.indexOf("\$")!=-1)
5689 AMprocessNodeR(n,linebreaks);
5690 }
5691 if (isIE) { //needed to match size and font of formula to surrounding text
5692 frag = document.getElementsByTagName('math');
5693 for (var i=0;i<frag.length;i++) frag[i].update()
5694 }
5695 }
5696
5697 /* Below is LaTeX pre-processing to produce CSS supported */
5698 /* standard latex structures*/
5699 /* Jeff Knisley (knisleyj@etsu.edu)
5700 /* Supported in part by the Howard Hughes Medical Institute */
5701 /* as part of the Symbiosis Project: HHMI #52005872 */
5702
5703 var inAppendix = false;
5704 var sectionCntr = 0;
5705 var IEcommentWarning = true;
5706 var biblist = [];
5707 var bibcntr = 0;
5708
5709 var LaTeXCounter = [];
5710 LaTeXCounter["definition"] = 0;
5711 LaTeXCounter["proposition"] = 0;
5712 LaTeXCounter["lemma"] = 0;
5713 LaTeXCounter["theorem"] = 0;
5714 LaTeXCounter["corollary"] = 0;
5715 LaTeXCounter["example"] = 0;
5716 LaTeXCounter["exercise"] = 0;
5717 LaTeXCounter["subsection"] = 0;
5718 LaTeXCounter["subsubsection"] = 0;
5719 LaTeXCounter["figure"] = 0;
5720 LaTeXCounter["equation"] = 0;
5721 LaTeXCounter["table"] = 0;
5722 LaTeXCounter["label"] = 0;
5723
5724 var LaTeXColor = [];
5725 LaTeXColor["greenyellow"] = "#D9FF4F";
5726 LaTeXColor["yellow"] = "#FFFF00";
5727 LaTeXColor["goldenrod"] = "#FFE529";
5728 LaTeXColor["dandelion"] = "#FFB529";
5729 LaTeXColor["apricot"] = "#FFAD7A";
5730 LaTeXColor["peach"] = "#FF804D";
5731 LaTeXColor["melon"] = "#FF8A80";
5732 LaTeXColor["yelloworange"] = "#FF9400";
5733 LaTeXColor["orange"] = "#FF6321";
5734 LaTeXColor["burntorange"] = "#FF7D00";
5735 LaTeXColor["bittersweet"] = "#C20300";
5736 LaTeXColor["redorange"] = "#FF3B21";
5737 LaTeXColor["mahogany"] = "#A60000";
5738 LaTeXColor["maroon"] = "#AD0000";
5739 LaTeXColor["brickred"] = "#B80000";
5740 LaTeXColor["red"] = "#FF0000";
5741 LaTeXColor["orangered"] = "#FF0080";
5742 LaTeXColor["rubinered"] = "#FF00DE";
5743 LaTeXColor["wildstrawberry"] = "#FF0A9C";
5744 LaTeXColor["salmon"] = "#FF789E";
5745 LaTeXColor["carnationpink"] = "#FF5EFF";
5746 LaTeXColor["magenta"] = "#FF00FF";
5747 LaTeXColor["violetred"] = "#FF30FF";
5748 LaTeXColor["rhodamine"] = "#FF2EFF";
5749 LaTeXColor["mulberry"] = "#A314FA";
5750 LaTeXColor["redviolet"] = "#9600A8";
5751 LaTeXColor["fuchsia"] = "#7303EB";
5752 LaTeXColor["lavender"] = "#FF85FF";
5753 LaTeXColor["thistle"] = "#E069FF";
5754 LaTeXColor["orchid"] = "#AD5CFF";
5755 LaTeXColor["darkorchid"] = "#9933CC";
5756 LaTeXColor["purple"] = "#8C24FF";
5757 LaTeXColor["plum"] = "#8000FF";
5758 LaTeXColor["violet"] = "#361FFF";
5759 LaTeXColor["royalpurple"] = "#401AFF";
5760 LaTeXColor["blueviolet"] = "#1A0DF5";
5761 LaTeXColor["periwinkle"] = "#6E73FF";
5762 LaTeXColor["cadetblue"] = "#616EC4";
5763 LaTeXColor["cornflowerblue"] = "#59DEFF";
5764 LaTeXColor["midnightblue"] = "#007091";
5765 LaTeXColor["navyblue"] = "#0F75FF";
5766 LaTeXColor["royalblue"] = "#0080FF";
5767 LaTeXColor["blue"] = "#0000FF";
5768 LaTeXColor["cerulean"] = "#0FE3FF";
5769 LaTeXColor["cyan"] = "#00FFFF";
5770 LaTeXColor["processblue"] = "#0AFFFF";
5771 LaTeXColor["skyblue"] = "#61FFE0";
5772 LaTeXColor["turquoise"] = "#26FFCC";
5773 LaTeXColor["tealblue"] = "#1FFAA3";
5774 LaTeXColor["aquamarine"] = "#2EFFB2";
5775 LaTeXColor["bluegreen"] = "#26FFAB";
5776 LaTeXColor["emerald"] = "#00FF80";
5777 LaTeXColor["junglegreen"] = "#03FF7A";
5778 LaTeXColor["seagreen"] = "#4FFF80";
5779 LaTeXColor["green"] = "#00FF00";
5780 LaTeXColor["forestgreen"] = "#00E000";
5781 LaTeXColor["pinegreen"] = "#00BF29";
5782 LaTeXColor["limegreen"] = "#80FF00";
5783 LaTeXColor["yellowgreen"] = "#8FFF42";
5784 LaTeXColor["springgreen"] = "#BDFF3D";
5785 LaTeXColor["olivegreen"] = "#009900";
5786 LaTeXColor["rawsienna"] = "#8C0000";
5787 LaTeXColor["sepia"] = "#4D0000";
5788 LaTeXColor["brown"] = "#660000";
5789 LaTeXColor["tan"] = "#DB9470";
5790 LaTeXColor["gray"] = "#808080";
5791 LaTeXColor["grey"] = "#808080";
5792 LaTeXColor["black"] = "#000000";
5793 LaTeXColor["white"] = "#FFFFFF";
5794
5795 var IsColorName = /^(?:greenyellow|yellow|goldenrod|dandelion|apricot|peach|melon|yelloworange|orange|burntorange|bittersweet|redorange|mahogany|maroon|brickred|red|orangered|rubinered|wildstrawberry|salmon|carnationpink|magenta|violetred|rhodamine|mulberry|redviolet|fuchsia|lavender|thistle|orchid|darkorchid|purple|plum|violet|royalpurple|blueviolet|periwinkle|cadetblue|cornflowerblue|midnightblue|navyblue|royalblue|blue|cerulean|cyan|processblue|skyblue|turquoise|tealblue|aquamarine|bluegreen|emerald|junglegreen|seagreen|green|forestgreen|pinegreen|limegreen|yellowgreen|springgreen|olivegreen|rawsienna|sepia|brown|tan|gray|grey|black|white)$/;
5796 var IsCounter = /^(?:definition|proposition|lemma|theorem|corollary|example|exercise|subsection|subsubsection|figure|equation|table)$/ ;
5797 var IsLaTeXElement = /^(?:displayequation|title|author|address|date|abstract|keyword|section|subsection|subsubsection|ref|cite|thebibliography|definition|proposition|lemma|theorem|corollary|example|exercise|itemize|enumerate|enddefinition|endproposition|endlemma|endtheorem|endcorollary|endexample|endexercise|enditemize|endenumerate|LaTeXMathMLlabel|LaTeXMathML|smallskip|medskip|bigskip|quote|quotation|endquote|endquotation|center|endcenter|description|enddescription|inlinemath)$/;
5798 var IsTextOnlyArea = /^(?:form|textarea|pre)$/i;
5799 var tableid = 0;
5800
5801 function makeNumberString(cntr) {
5802 if(sectionCntr > 0) {
5803 if(inAppendix) {
5804 return "A"+sectionCntr+"."+cntr;
5805 } else {
5806 return sectionCntr+"."+cntr;
5807 }
5808 } else {
5809 return ""+cntr;
5810 }
5811 };
5812
5813
5814 function LaTeXpreProcess(thebody) {
5815 var TheBody = thebody;
5816 if(TheBody.hasChildNodes()) {
5817 if(!(IsLaTeXElement.test(TheBody.className)))
5818 {
5819 for(var i=0; i<TheBody.childNodes.length; i++) {
5820 LaTeXpreProcess(TheBody.childNodes[i]) }
5821 }
5822 }
5823 else {
5824 if( TheBody.nodeType==3 &&
5825 !(IsTextOnlyArea.test(TheBody.parentNode.nodeName) ) )
5826 {
5827 var str = TheBody.nodeValue;
5828 if( !(str==null)) {
5829
5830 str = str.replace(/\\%/g, "<per>"); // % sign
5831 str = str.replace(/%[^\n]*(?=\n)/g,"");
5832 str = str.replace(/%[^\r]*(?=\r)/g,""); //Used by Explorer
5833 str = str.replace(/%[^\n]*$/,"") // End of text segment comment
5834
5835 if(isIE && str.match(/%/g) != null && IEcommentWarning) {
5836 alert("Comments may not have parsed properly. Try putting in <pre class='LaTeX><div>..</div></pre> structure.");
5837 IEcommentWarning = false;
5838 }
5839 str = str.replace(/<per>/g,"%");
5840
5841 //if(str.match(/XXX[\s\S]*/)!=null) {
5842 // var tmp = str.match(/XXX[\s\S]*/)[0];
5843 // var tmpstr = tmp.charCodeAt(7)+"::"+tmp.charCodeAt(8)+"::"+tmp.charCodeAt(9)+"::"+tmp.charCodeAt(10)+"::"+tmp.charCodeAt(11)+"::"+tmp.charCodeAt(12)+"::"+tmp.charCodeAt(13);
5844 // alert(tmpstr);
5845 //}
5846
5847 //spacing that in LaTeXMathML may cause problems because of our approach. We use purely unicode
5848 // First we remove singleton / symbols
5849 str = str.replace(/([^\\])\\(\s)/g,"$1\u00A0$2"); // must be a space after \ for it to make an nbsp
5850
5851 str = str.replace(/\\quad/g,"\u2001");
5852 str = str.replace(/\\qquad/g,"\u2001\u2001");
5853 str = str.replace(/\\enspace/g,"\u2002");
5854 str = str.replace(/\\;/g,"\u2004");
5855 str = str.replace(/\\:/g,"\u2005");
5856 str = str.replace(/\\,/g,"\u2006");
5857 str = str.replace(/\\thinspace/g,"\u200A");
5858 str = str.replace(/([^\\])~/g,"$1\u00A0");
5859 str = str.replace(/\\~/g,"~");
5860
5861 //Added \[ ... \] and $$..$$ functionality.
5862 str = str.replace(/\\\[/g," <DEQ> $\\displaystyle{");
5863 str = str.replace(/\\\]/g,"}$ <DEQ> ");
5864 str = str.replace(/\$\$/g,"${$<DEQ>$}$");
5865
5866 // Separate replacements for begin .. end to (eventually) allow LaTeX equations with html codes mixed in
5867 // (as is the case for theorem, etc.
5868 // all variations of spaces with \begin{array} .. \end{array} -- not displayed, however
5869 str = str.replace(/\\begin\s*\{s*array\s*\}/g,"\\begin{array}");
5870 str = str.replace(/\\end\s*\{s*array\s*\}/g,"\\end{array}");
5871
5872 // all variations of spaces with \begin{eqnarray} .. \end{eqnarray}
5873 str = str.replace(/\\begin\s*\{s*eqnarray\s*\}/g," <DEQ>eqno$\\begin{eqnarray}");
5874 str = str.replace(/\\end\s*\{s*eqnarray\s*\}/g,"\\end{eqnarray}$<DEQ> ");
5875
5876 // all variations of spaces with \begin{eqnarray*} .. \end{eqnarray*}
5877 str = str.replace(/\\begin\s*\{s*eqnarray\*\s*\}/g," <DEQ>$\\begin{eqnarray}");
5878 str = str.replace(/\\end\s*\{s*eqnarray\*\s*\}/g,"\\end{eqnarray}$<DEQ> ");
5879
5880 // all variations of spaces with \begin{displaymath} .. \end{displaymath}
5881 str = str.replace(/\\begin\s*\{s*displaymath\s*\}/g," <DEQ> $\\displaystyle{");
5882 str = str.replace(/\\end\s*\{s*displaymath\s*\}/g,"}$ <DEQ> ");
5883
5884 // all variations of spaces with \begin{equation*} .. \end{equation*}
5885 str = str.replace(/\\begin\s*\{s*equation\s*\*\s*\}/g," <DEQ> $\\displaystyle{");
5886 str = str.replace(/\\end\s*\{s*equation\s*\*\s*\}/g,"}$ <DEQ> ");
5887
5888 // all variations of spaces with \begin{equation} .. \end{equation}
5889 str = str.replace(/\\begin\s*\{s*equation\s*\}/g," <DEQ>eqno$\\displaystyle{");
5890 str = str.replace(/\\end\s*\{s*equation\s*\}/g,"}$ <DEQ> ");
5891
5892
5893
5894 //now parse to translate <DEQ> structures to <table class = 'dispeq'> stuff
5895 //and to identify non-display math content (sections, etc).
5896
5897 str = str.split("<DEQ>");
5898 // var ntype = TheBody.nodeType;
5899 var newFrag = document.createDocumentFragment();
5900
5901 for(var i=0;i<str.length;i++) {
5902 if(i % 2) {
5903 //odd = table of type displayequation
5904 var DEQtable = document.createElement("table");
5905 DEQtable.className='displayequation';
5906 var DEQtbody = document.createElement("tbody");
5907
5908 var DEQtr = document.createElement("tr");
5909 var DEQtdeq = document.createElement("td");
5910 DEQtdeq.className='eq';
5911
5912 // AfterFix to repair for $$...$$
5913 str[i] = str[i].replace(/\$\}$/g,"$\\displaystyle{");
5914 str[i] = str[i].replace(/\$\{$/g,"}");
5915
5916 //check for equation number via either label or eqno at beginning -- \nonumber is removed
5917 var lbl = str[i].match(/\\label\s*\{s*(\w+)\s*\}/);
5918 var ISeqno = str[i].match(/^eqno/);
5919
5920 // append nodes into row
5921 str[i] = str[i].replace(/^eqno/," ");
5922 str[i] = str[i].replace(/\\label\s*\{s*\w+\s*\}/," ");
5923 DEQtdeq.appendChild(document.createTextNode( str[i] ) );
5924 DEQtr.appendChild(DEQtdeq);
5925
5926 str[i] = str[i].replace(/\\nonumber/g,"");
5927
5928 if(ISeqno!=null || lbl !=null) {
5929 var DEQtdno = document.createElement("td");
5930 DEQtdno.className='eqno';
5931 LaTeXCounter["equation"]++;
5932 var eqnoString = makeNumberString(LaTeXCounter["equation"]);
5933
5934 var DEQanchor = document.createElement("a");
5935 if(lbl!=null) { DEQanchor.id = lbl[1] };
5936 DEQanchor.className = "eqno";
5937 var anchorSpan = document.createElement("span");
5938 anchorSpan.className = "eqno";
5939 anchorSpan.style.display = "none";
5940 anchorSpan.appendChild(document.createTextNode(eqnoString));
5941 DEQanchor.appendChild(anchorSpan);
5942 DEQtdno.appendChild(DEQanchor);
5943 var DEQspan = document.createElement("span");
5944 DEQspan.className = "eqno";
5945 DEQspan.appendChild(document.createTextNode("("+eqnoString+")" ));
5946 DEQtdno.appendChild(DEQspan);
5947 DEQtr.appendChild(DEQtdno);
5948 }
5949 DEQtbody.appendChild(DEQtr);
5950 DEQtable.appendChild(DEQtbody);
5951 newFrag.appendChild(DEQtable);
5952 }
5953 else {
5954 //even = this is text, where we may have sections, labels, subsections, and so on
5955
5956 // AfterFix to repair for $$...$$
5957 str[i] = str[i].replace(/\$\}$/g,"");
5958 str[i] = str[i].replace(/\$\{$/g,"");
5959
5960 //Some stuff we just want to remove
5961 str[i] = str[i].replace(/\\maketitle/g,"");
5962 str[i] = str[i].replace(/\\begin\s*\{s*document\s*\}/g,"");
5963 str[i] = str[i].replace(/\\end\s*\{s*document\s*\}/g,"");
5964 str[i] = str[i].replace(/\\documentclass[^\}]*?\}/g,"");
5965 str[i] = str[i].replace(/\\usepackage[^\}]*?\}/g,""); //ignores packages and their options
5966 str[i] = str[i].replace(/\\noindent/g,"");
5967 str[i] = str[i].replace(/\\notag/g,"");
5968
5969 //Next: labels, ref's, hrefs, urls, and cites
5970 str[i] = str[i].replace(/\\ref\s*\{s*(\w+)\}/g," \\[ref\\]$1\\[ ");
5971 str[i] = str[i].replace (/\\url\s*\{s*([^\}n]+)\}/g," \\[url\\]$1\\[ ");
5972 str[i] = str[i].replace(/\\href\s*\{s*([^\}]+)\}s*\{s*([^\}]+)\}/g," \\[href\\]$1\\]$2\\[ ");
5973 str[i] = str[i].replace(/\\cite\s*\{s*(\w+)\}/g," \\[cite\\]$1\\[ ");
5974
5975 //Miscellaneous stuff!!
5976 str[i] = str[i].replace(/\\qed/g,"\u220E");
5977 str[i] = str[i].replace(/\\endproof/g,"\u220E");
5978 str[i] = str[i].replace(/\\proof/g,"\\textbf{Proof: }");
5979
5980 //breaks and skips
5981 str[i] = str[i].replace(/\\n(?=\s)/g, " \\[br\\] \\[ ");
5982 str[i] = str[i].replace(/\\newline/g," \\[br\\] \\[ ");
5983 str[i] = str[i].replace(/\\linebreak/g," \\[br\\] \\[ ");
5984 str[i] = str[i].replace(/\\smallskip/g," \\[logicalbreak\\]smallskip\\[ ");
5985 str[i] = str[i].replace(/\\medskip/g," \\[logicalbreak\\]medskip\\[ ");
5986 str[i] = str[i].replace(/\\bigskip/g," \\[logicalbreak\\]bigskip\\[ ");
5987 str[i] = str[i].replace(/[\n\r]+[ \f\n\r\t\v\u2028\u2029]*[\n\r]+/g," \\[logicalbreak\\]LaTeXMathML\\[ "); // extra return replaced by <p>
5988 if(isIE) {
5989 str[i] = str[i].replace(/\r/g," "); // replace \r by a space to aid spacing!
5990 }
5991
5992
5993 //items and appendix
5994 str[i] = str[i].replace(/\\bibitem\s*([^\{]*\{s*\w*\s*\})/g," \\[bibitem\\]$1\\[ ");
5995 str[i] = str[i].replace(/\\bibitem\s*/g," \\[bibitem\\] \\[ ");
5996 str[i] = str[i].replace(/\\item\s*\[\s*(\w+)\s*\]/g," \\[alistitem\\]$1\\[ ");
5997 str[i] = str[i].replace(/\\item\s*/g," \\[alistitem\\] \\[ ");
5998 str[i] = str[i].replace(/\\appendix/g," \\[appendix\\] \\[ ");
5999
6000
6001 // \includegraphics[][]{image} -- no processing of options. This treatment is DANGEROUS. It assumes no html will be
6002 // placed within the \begin{figure} ... \end{figure} structure, and the [\s\S] character class could lead to strange matches
6003 str[i] = str[i].replace(/\\begin\s*\{s*figure\s*\}([\s\S]+?)\\end\s*\{s*figure\s*\}/g," \\[figure\\]$1\\[ ");
6004 str[i] = str[i].replace(/\\begin\s*\{s*table\s*\}([\s\S]+?)\\end\s*\{s*table\s*\}/g," \\[table\\]$1\\[ ");
6005 //str[i] = str[i].replace(/\\begin\s*\{s*array\s*\}([\s\S]+?)\\end\s*\{s*array\s*\}/g," \\[array\\]$1\\[ ");
6006 //goal is to protect array \\ from being converted into linebreaks
6007
6008 //This construction allows css classes for divs for these elements, but the CSS will have to be supplied through a
6009 //css file or (script) .. (/script) in the header. (It makes sense to me that style files in LaTeX should correspond
6010 //to css and/or xslt when translating to mathml, but \ref's are a problem).
6011 str[i] = str[i].replace(/\\begin\s*\{s*theorem\s*\}/g," \\[theorem\\]Theorem \\[ ");
6012 str[i] = str[i].replace(/\\end\s*\{s*theorem\s*\}/g," \\[endtheorem\\] \\[ ");
6013
6014 str[i] = str[i].replace(/\\begin\s*\{s*definition\s*\}/g," \\[definition\\]Definition \\[ ");
6015 str[i] = str[i].replace(/\\end\s*\{s*definition\s*\}/g," \\[enddefinition\\] \\[ ");
6016
6017 str[i] = str[i].replace(/\\begin\s*\{s*lemma\s*\}/g," \\[lemma\\]Lemma \\[ ");
6018 str[i] = str[i].replace(/\\end\s*\{s*lemma\s*\}/g," \\[endlemma\\] \\[ ");
6019
6020 str[i] = str[i].replace(/\\begin\s*\{s*corollary\s*\}/g," \\[corollary\\]Corollary \\[ ");
6021 str[i] = str[i].replace(/\\end\s*\{s*corollary\s*\}/g," \\[endcorollary\\] \\[ ");
6022
6023 str[i] = str[i].replace(/\\begin\s*\{s*proposition\s*\}/g," \\[proposition\\]Proposition \\[ ");
6024 str[i] = str[i].replace(/\\end\s*\{s*proposition\s*\}/g," \\[endproposition\\] \\[ ");
6025
6026 str[i] = str[i].replace(/\\begin\s*\{s*example\s*\}/g," \\[example\\]Example \\[ ");
6027 str[i] = str[i].replace(/\\end\s*\{s*example\s*\}/g," \\[endexample\\] \\[ ");
6028
6029 str[i] = str[i].replace(/\\begin\s*\{s*exercise\s*\}/g," \\[exercise\\]Exercise \\[ ");
6030 str[i] = str[i].replace(/\\end\s*\{s*exercise\s*\}/g," \\[endexercise\\] \\[ ");
6031
6032 str[i] = str[i].replace(/\\begin\s*\{s*thebibliography\s*\}s*\{s*\w+\s*\}/g," \\[thebibliography\\]References \\[ ");
6033 str[i] = str[i].replace(/\\begin\s*\{s*thebibliography\s*\}/g," \\[thebibliography\\]References \\[ ");
6034 str[i] = str[i].replace(/\\end\s*\{s*thebibliography\s*\}/g," \\[endthebibliography\\]References \\[ ");
6035
6036
6037 str[i] = str[i].replace(/\\begin\s*\{s*proof\s*\}/g," \\[proof\\]Proof: \\[ ");
6038 if(isIE) { //IE is just so weird
6039 str[i] = str[i].replace(/\\end\s*\{s*proof\s*\}/g,"\u220E \\[endproof\\] \\[ ");
6040 } else {
6041 str[i] = str[i].replace(/\\end\s*\{s*proof\s*\}/g," \\[endproof\\] \\[ ");
6042 }
6043
6044 //The frontmatter -- all translated to div's to be handled by CSS
6045 str[i] = str[i].replace(/\\title\s*\{s*([^\}]+)\}/g," \\[title\\] \\[$1 \\[endtitle\\] \\[ ");
6046 str[i] = str[i].replace(/\\author\s*\{s*([^\}]+)\}/g," \\[author\\] \\[$1 \\[endauthor\\] \\[ ");
6047 str[i] = str[i].replace(/\\address\s*\{s*([^\}]+)\}/g," \\[address\\] \\[$1 \\[endaddress\\] \\[ ");
6048 str[i] = str[i].replace(/\\date\s*\{s*([^\}]+)\}/g," \\[date\\] \\[$1 \\[enddate\\] \\[ ");
6049 str[i] = str[i].replace(/\\begin\s*\{s*keyword\s*\}/g," \\[keyword\\] \\[ ");
6050 str[i] = str[i].replace(/\\end\s*\{s*keyword\s*\}/g," \\[endkeyword\\] \\[ ");
6051 str[i] = str[i].replace(/\\begin\s*\{s*abstract\s*\}/g," \\[abstract\\] \\[ ");
6052 str[i] = str[i].replace(/\\end\s*\{s*abstract\s*\}/g," \\[endabstract\\] \\[ ");
6053
6054 //The rest of the environments -- Users can even "make up their own" -- but it avoids the array and tabular environments
6055 str[i] = str[i].replace(/\\begin\s*\{s*(?!array|tabular)(\w+)\s*\}/g," \\[$1\\] \\[ ");
6056 str[i] = str[i].replace(/\\end\s*\{s*(?!array|tabular)(\w+)\s*\}/g," \\[end$1\\] \\[ ");
6057
6058 //Next, we look at section--subsection stuff. This is nested -- this would be so much better if LaTeX used
6059 //some type of \begin{sectionhead}...\end{sectionhead} structure
6060 var sectionIndex = str[i].search(/\\section\s*\{s*[\s\S]+\}/);
6061
6062 while(sectionIndex >= 0) {
6063 str[i] = str[i].replace(/\\section\s*\{/ ," \\[section\\]");
6064 var delimcnt = 1;
6065 for(var ii=sectionIndex;ii<str[i].length;ii++) {
6066 if(str[i].charAt(ii) == "{") { delimcnt++ };
6067 if(str[i].charAt(ii) == "}") { delimcnt-- };
6068 if(delimcnt == 0) {
6069 str[i] = str[i].substring(0,ii)+"\\[ "+str[i].substring(ii+1,str[i].length) ;
6070 break;
6071 }
6072 };
6073 sectionIndex = str[i].search(/\\section\s*\{s*[\s\S]+\}/); //look for next
6074 }
6075
6076 sectionIndex = str[i].search(/\\subsection\s*\{s*[\s\S]+\}/);
6077
6078 while(sectionIndex >= 0) {
6079 str[i] = str[i].replace(/\\subsection\s*\{/ ," \\[subsection\\]");
6080 var delimcnt = 1;
6081 for(var ii=sectionIndex;ii<str[i].length;ii++) {
6082 if(str[i].charAt(ii) == "{") { delimcnt++ };
6083 if(str[i].charAt(ii) == "}") { delimcnt-- };
6084 if(delimcnt == 0) {
6085 str[i] = str[i].substring(0,ii)+"\\[ "+str[i].substring(ii+1,str[i].length) ;
6086 break;
6087 }
6088 };
6089 sectionIndex = str[i].search(/\\subsection\s*\{s*[\s\S]+\}/); //look for next
6090 }
6091
6092 sectionIndex = str[i].search(/\\subsubsection\s*\{s*[\s\S]+\}/);
6093
6094 while(sectionIndex >= 0) {
6095 str[i] = str[i].replace(/\\subsubsection\s*\{/ ," \\[subsubsection\\]");
6096 var delimcnt = 1;
6097 for(var ii=sectionIndex;ii<str[i].length;ii++) {
6098 if(str[i].charAt(ii) == "{") { delimcnt++ };
6099 if(str[i].charAt(ii) == "}") { delimcnt-- };
6100 if(delimcnt == 0) {
6101 str[i] = str[i].substring(0,ii)+"\\[ "+str[i].substring(ii+1,str[i].length) ;
6102 break;
6103 }
6104 };
6105 sectionIndex = str[i].search(/\\subsubsection\s*\{s*[\s\S]+\}/); //look for next
6106 }
6107
6108 var CatToNextEven = "";
6109 //split into alternating text elements and "marked" elements
6110 var strtmp = str[i].split("\\[");
6111 //document.write(strtmp[0]);
6112
6113 for(var j=0;j<strtmp.length;j++) {
6114 if(j % 2) {
6115 //odd = split on \\]
6116 var strtmparray = strtmp[j].split("\\]");
6117 switch (strtmparray[0]) {
6118 case "section":
6119 var nodeTmp = document.createElement("H2");
6120 nodeTmp.className = 'section';
6121 //reset counters
6122 sectionCntr++;
6123 for (var div in LaTeXCounter) { LaTeXCounter[div] = 0 };
6124 //Create Title of section
6125 var nodeAnchor = document.createElement("a");
6126 if(inAppendix) {
6127 nodeAnchor.className='appendixsection';
6128 } else {
6129 nodeAnchor.className='section';
6130 }
6131 var nodeNumString = makeNumberString("");
6132 var anchorSpan = document.createElement("span");
6133 anchorSpan.className = "section";
6134 anchorSpan.style.display = "none";
6135 anchorSpan.appendChild(document.createTextNode(nodeNumString));
6136 nodeAnchor.appendChild(anchorSpan);
6137 nodeTmp.appendChild(nodeAnchor);
6138
6139 var nodeSpan = document.createElement("span");
6140 nodeSpan.className = 'section';
6141 nodeSpan.appendChild(document.createTextNode(nodeNumString+" "));
6142 nodeTmp.appendChild(nodeSpan);
6143 nodeTmp.appendChild(document.createTextNode( strtmparray[1] ) );
6144 newFrag.appendChild(nodeTmp);
6145 break;
6146 case "subsection":
6147 var nodeTmp = document.createElement("H3");
6148 nodeTmp.className = 'subsection';
6149 //counters
6150 LaTeXCounter["subsection"]++;
6151 LaTeXCounter["subsubsection"]=0;
6152 //Create Title of section
6153 var nodeAnchor = document.createElement("a");
6154 nodeAnchor.className = 'subsection';
6155 var nodeNumString = makeNumberString(LaTeXCounter["subsection"]);
6156 var anchorSpan = document.createElement("span");
6157 anchorSpan.className = "subsection";
6158 anchorSpan.style.display = "none";
6159 anchorSpan.appendChild(document.createTextNode(nodeNumString));
6160 nodeAnchor.appendChild(anchorSpan);
6161 nodeTmp.appendChild(nodeAnchor);
6162 var nodeSpan = document.createElement("span");
6163 nodeSpan.className = 'subsection';
6164 nodeSpan.appendChild(document.createTextNode(nodeNumString+". "));
6165 nodeTmp.appendChild(nodeSpan);
6166 nodeTmp.appendChild(document.createTextNode( strtmparray[1] ) );
6167 newFrag.appendChild(nodeTmp);
6168 break;
6169 case "subsubsection":
6170 var nodeTmp = document.createElement("H4");
6171 nodeTmp.className = 'subsubsection';
6172 //counters
6173 LaTeXCounter["subsubsection"]++;
6174 //Create Title of section
6175 var nodeAnchor = document.createElement("a");
6176 nodeAnchor.className = 'subsubsection';
6177 var nodeNumString = makeNumberString(LaTeXCounter["subsection"]+"."+LaTeXCounter["subsubsection"]);
6178 var anchorSpan = document.createElement("span");
6179 anchorSpan.className = "subsubsection";
6180 anchorSpan.style.display = "none";
6181 anchorSpan.appendChild(document.createTextNode(nodeNumString));
6182 nodeAnchor.appendChild(anchorSpan);
6183 nodeTmp.appendChild(nodeAnchor);
6184 var nodeSpan = document.createElement("span");
6185 nodeSpan.className = 'subsubsection';
6186 nodeSpan.appendChild(document.createTextNode(nodeNumString+". "));
6187 nodeTmp.appendChild(nodeSpan);
6188 nodeTmp.appendChild(document.createTextNode( strtmparray[1] ) );
6189 newFrag.appendChild(nodeTmp);
6190 break;
6191 case "href":
6192 var nodeTmp = document.createElement("a");
6193 nodeTmp.className = 'LaTeXMathML';
6194 nodeTmp.href = strtmparray[1];
6195 nodeTmp.appendChild(document.createTextNode( strtmparray[2]));
6196 newFrag.appendChild(nodeTmp);
6197 break;
6198 case "url":
6199 var nodeTmp = document.createElement("a");
6200 nodeTmp.className = 'LaTeXMathML';
6201 nodeTmp.href = strtmparray[1];
6202 nodeTmp.appendChild(document.createTextNode( strtmparray[1]));
6203 newFrag.appendChild(nodeTmp);
6204 break;
6205 case "figure":
6206 var nodeTmp = document.createElement("table");
6207 nodeTmp.className = 'figure';
6208 var FIGtbody = document.createElement("tbody");
6209
6210 var FIGlbl = strtmparray[1].match(/\\label\s*\{s*(\w+)\s*\}/);
6211 strtmparray[1]=strtmparray[1].replace(/\\label\s*\{w+\}/g,"");
6212
6213 var capIndex = strtmparray[1].search(/\\caption\s*\{[\s\S]+\}/);
6214 var FIGcap = "";
6215
6216 if(capIndex >= 0) { // caption may contain other { } structures -- but not displaymath!!
6217 var tmp = strtmparray[1];
6218 var delimcnt = 0;
6219 var capstart = -1;
6220 for(var pos=capIndex;pos<tmp.length;pos++) {
6221 if(tmp.charAt(pos) == "{") { delimcnt++ };
6222 if(tmp.charAt(pos) == "}") { delimcnt-- };
6223 if(delimcnt == 1 && capstart<0) { capstart = pos+1 };
6224 if(delimcnt == 0 && capstart>0) {
6225 capend = pos-1;
6226 FIGcap = tmp.substring(capstart,pos);
6227 break
6228 }
6229 }
6230 }
6231
6232 var FIGtr2 = document.createElement("tr");
6233 var FIGtd2 = document.createElement("td");
6234 FIGtd2.className="caption";
6235
6236
6237 var FIGanchor = document.createElement("a");
6238 FIGanchor.className = "figure";
6239 if(FIGlbl!=null) { FIGanchor.id = FIGlbl[1]; }
6240 LaTeXCounter["figure"]++;
6241 var fignmbr = makeNumberString(LaTeXCounter["figure"]);
6242 var anchorSpan = document.createElement("span");
6243 anchorSpan.className = "figure";
6244 anchorSpan.style.display = "none";
6245 anchorSpan.appendChild(document.createTextNode(fignmbr));
6246 FIGanchor.appendChild(anchorSpan);
6247 FIGtd2.appendChild(FIGanchor);
6248
6249 var FIGspan = document.createElement("span");
6250 FIGspan.className = "figure"; //For CSS counters, comment this line
6251 FIGspan.appendChild(document.createTextNode("Figure "+fignmbr+". " ) );
6252 FIGtd2.appendChild(FIGspan);
6253 FIGtd2.appendChild(document.createTextNode(""+FIGcap));
6254 FIGtr2.appendChild(FIGtd2);
6255 FIGtbody.appendChild(FIGtr2);
6256 var IsSpecial = false;
6257
6258 var FIGinfo = strtmparray[1].match(/\\includegraphics\s*\{([^\}]+)\}/);
6259 if(FIGinfo==null) { //options not processed, for now
6260 FIGinfo = strtmparray[1].match(/\\includegraphics\s*\[[^\]]*\]\s*\{s*([^\}]+)\s*\}/);
6261 }
6262 if(FIGinfo==null) {
6263 FIGinfo = strtmparray[1].match(/\\special\s*\{s*([^\}]+)\}/);
6264 IsSpecial=true //Hook: Later can include "special" graphics commands
6265 };
6266
6267 if(FIGinfo!=null) { //Caption will be above the image
6268 var FIGtr1 = document.createElement("tr");
6269 var FIGtd1 = document.createElement("td");
6270 FIGtd1.className="image";
6271 var FIGimg = document.createElement("img");
6272 var FIGsrc = FIGinfo[1]; //options not processed, for now
6273 FIGimg.src = FIGsrc;
6274 FIGimg.alt = "Figure "+FIGsrc+" did not load";
6275 FIGimg.title = "Figure "+fignmbr+". "+FIGcap;
6276 FIGimg.id = "figure"+fignmbr;
6277 FIGtd1.appendChild(FIGimg);
6278 FIGtr1.appendChild(FIGtd1);
6279 FIGtbody.appendChild(FIGtr1);
6280 }
6281 nodeTmp.appendChild(FIGtbody);
6282 newFrag.appendChild(nodeTmp);
6283 break;
6284 case "table":
6285 var nodeTmp = document.createElement("table");
6286 if(strtmparray[1].search(/\\centering/) >= 0) {
6287 nodeTmp.className = 'LaTeXtable centered';
6288 nodeTmp.align = "center";
6289 } else {
6290 nodeTmp.className = 'LaTeXtable';
6291 };
6292 tableid++;
6293 nodeTmp.id = "LaTeXtable"+tableid; //unique id for each table
6294
6295 var TABlbl = strtmparray[1].match(/\\label\s*\{s*(\w+)\s*\}/);
6296 strtmparray[1]=strtmparray[1].replace(/\\label\s*\{w+\}/g,"");
6297
6298 var capIndex = strtmparray[1].search(/\\caption\s*\{[\s\S]+\}/);
6299 var TABcap = "";
6300
6301 if(capIndex >= 0) { // caption may contain other { } structures -- but not displaymath!!
6302 var tmp = strtmparray[1];
6303 var delimcnt = 0;
6304 var capstart = -1;
6305 for(var pos=capIndex;pos<tmp.length;pos++) {
6306 if(tmp.charAt(pos) == "{") { delimcnt++ };
6307 if(tmp.charAt(pos) == "}") { delimcnt-- };
6308 if(delimcnt == 1 && capstart<0) { capstart = pos+1 };
6309 if(delimcnt == 0 && capstart>0) {
6310 capend = pos-1;
6311 TABcap = tmp.substring(capstart,pos);
6312 break
6313 }
6314 }
6315 }
6316
6317 if(TABcap!="") {
6318 var TABtbody = document.createElement("tbody");
6319 var TABcaption = document.createElement("caption");
6320 TABcaption.className="LaTeXtable centered";
6321 var TABanchor = document.createElement("a");
6322 TABanchor.className = "LaTeXtable";
6323 if(TABlbl!=null) { TABanchor.id = TABlbl[1]; }
6324 LaTeXCounter["table"]++;
6325 var tabnmbr = makeNumberString(LaTeXCounter["table"]);
6326 var anchorSpan = document.createElement("span");
6327 anchorSpan.className = "LaTeXtable";
6328 anchorSpan.style.display = "none";
6329 anchorSpan.appendChild(document.createTextNode(tabnmbr));
6330 TABanchor.appendChild(anchorSpan);
6331 TABcaption.appendChild(TABanchor);
6332
6333 var TABspan = document.createElement("span");
6334 TABspan.className = "LaTeXtable"; //For CSS counters, comment this line
6335 TABspan.appendChild(document.createTextNode("Table "+tabnmbr+". " ) );
6336 TABcaption.appendChild(TABspan);
6337 TABcaption.appendChild(document.createTextNode(""+TABcap));
6338 nodeTmp.appendChild(TABcaption);
6339 }
6340 var TABinfo = strtmparray[1].match(/\\begin\s*\{s*tabular\s*\}([\s\S]+)\\end\s*\{s*tabular\s*\}/);
6341 if(TABinfo!=null) {
6342 var TABtbody = document.createElement('tbody');
6343 var TABrow = null;
6344 var TABcell = null;
6345 var row=0;
6346 var col=0;
6347
6348 var TABalign = TABinfo[1].match(/^\s*\{([^\}]+)\}/);
6349 TABinfo = TABinfo[1].replace(/^\s*\{[^\}]+\}/,"");
6350 TABinfo = TABinfo.replace(/\\hline/g,""); //no horizontal bars
6351 TABalign[1] = TABalign[1].replace(/\|/g,""); //no vertical bars
6352 TABalign[1] = TABalign[1].replace(/\s/g,"");
6353 TABinfo = TABinfo.split("\\\\"); // into rows
6354 for(row=0;row<TABinfo.length;row++) {
6355 TABrow = document.createElement("tr");
6356 TABinfo[row] = TABinfo[row].split("&");
6357 for(col=0;col<TABinfo[row].length;col++) {
6358 TABcell = document.createElement("td");
6359 switch (TABalign[1].charAt(col)) {
6360 case "l":
6361 TABcell.style.textAlign = "left";
6362 break;
6363 case "c":
6364 TABcell.style.textAlign = "center";
6365 break;
6366 case "r":
6367 TABcell.style.textAlign = "right";
6368 break;
6369 default :
6370 TABcell.style.textAlign = "left";
6371 };
6372 TABcell.appendChild(document.createTextNode(TABinfo[row][col]));
6373 TABrow.appendChild(TABcell);
6374 }
6375 TABtbody.appendChild(TABrow);
6376 }
6377 nodeTmp.appendChild(TABtbody);
6378 }
6379 newFrag.appendChild(nodeTmp);
6380 break;
6381 case "logicalbreak":
6382 var nodeTmp = document.createElement("p");
6383 nodeTmp.className = strtmparray[1];
6384 nodeTmp.appendChild(document.createTextNode("\u00A0"));
6385 newFrag.appendChild(nodeTmp);
6386 break;
6387 case "appendix":
6388 inAppendix=true;
6389 sectionCntr=0;
6390 break;
6391 case "alistitem":
6392 var EndDiv = document.createElement("div");
6393 EndDiv.className = "endlistitem";
6394 newFrag.appendChild(EndDiv);
6395 var BegDiv = document.createElement("div");
6396 BegDiv.className = "listitem";
6397 if(strtmparray[1]!=" ") {
6398 var BegSpan = document.createElement("span");
6399 BegSpan.className="listitemmarker";
6400 var boldBegSpan = document.createElement("b");
6401 boldBegSpan.appendChild(document.createTextNode(strtmparray[1]+" "));
6402 BegSpan.appendChild(boldBegSpan);
6403 BegDiv.appendChild(BegSpan);
6404 }
6405 newFrag.appendChild(BegDiv);
6406 break;
6407 case "br":
6408 newFrag.appendChild(document.createElement("br"));
6409 break;
6410 case "bibitem":
6411 newFrag.appendChild(document.createElement("br"));
6412 var nodeTmp = document.createElement("a");
6413 nodeTmp.className = 'bibitem';
6414 var nodeSpan = document.createElement("span");
6415 nodeSpan.className = 'bibitem';
6416
6417 bibcntr++;
6418
6419 var lbl = strtmparray[1].match(/\{s*(\w+)\s*\}/);
6420 strtmparray[1] = strtmparray[1].replace(/\s*\{s*\w+\s*\}/g,"");
6421 strtmparray[1] = strtmparray[1].replace(/^\s*\[/,"");
6422 strtmparray[1] = strtmparray[1].replace(/\s*\]$/,"");
6423 strtmparray[1] = strtmparray[1].replace(/^\s+|\s+$/g,"");
6424 //We create a list of id's for the bibitems -- it seemed important at one time??
6425 if(lbl==null) {
6426 biblist[bibcntr] = "bibitem"+bibcntr
6427 } else {
6428 biblist[bibcntr] = lbl[1];
6429 };
6430 nodeTmp.name = biblist[bibcntr];
6431 nodeTmp.id = biblist[bibcntr];
6432 // We place content into <a> -- access it with \cite, thus allowing appropriate labels!
6433 if(strtmparray[1]!="") {
6434 nodeSpan.appendChild(document.createTextNode(strtmparray[1]));
6435 } else {
6436 nodeSpan.appendChild(document.createTextNode("["+bibcntr+"]"));
6437 }
6438 nodeTmp.appendChild(nodeSpan);
6439 newFrag.appendChild(nodeTmp);
6440 break;
6441 case "cite":
6442 var nodeTmp = document.createElement("a");
6443 nodeTmp.className = 'cite';
6444 nodeTmp.name = 'cite';
6445 nodeTmp.href = "#"+strtmparray[1];
6446 newFrag.appendChild(nodeTmp);
6447 break;
6448 case "ref":
6449 var nodeTmp = document.createElement("a");
6450 nodeTmp.className = 'ref';
6451 nodeTmp.name = 'ref';
6452 nodeTmp.href = "#"+strtmparray[1];
6453 newFrag.appendChild(nodeTmp);
6454 break;
6455 default :
6456 var nodeTmp = document.createElement("div");
6457 nodeTmp.className = strtmparray[0];
6458 if( IsCounter.test(strtmparray[0]) ) {
6459 LaTeXCounter[strtmparray[0]]++;
6460 var nodeAnchor = document.createElement("a");
6461 nodeAnchor.className = strtmparray[0];
6462 var divnum = makeNumberString(LaTeXCounter[strtmparray[0]]);
6463 var anchorSpan = document.createElement("span");
6464 anchorSpan.className = strtmparray[0];
6465 anchorSpan.appendChild(document.createTextNode(divnum));
6466 anchorSpan.style.display="none";
6467 nodeAnchor.appendChild(anchorSpan);
6468 nodeTmp.appendChild(nodeAnchor);
6469
6470 var nodeSpan = document.createElement("span");
6471 nodeSpan.className = strtmparray[0];
6472 nodeSpan.appendChild(document.createTextNode(strtmparray[1]+" "+divnum+". "));
6473 nodeTmp.appendChild(nodeSpan);
6474 }
6475 if(isIE) { //remove if IE supports :before and :after
6476 if(strtmparray[0]==("thebibliography"||"abstract"||"keyword"||"proof")) {
6477 var nodeSpan = document.createElement("span");
6478 nodeSpan.className = strtmparray[0];
6479 nodeSpan.appendChild(document.createTextNode(strtmparray[1]));
6480 nodeTmp.appendChild(nodeSpan);
6481 }
6482 } //end of IE :before and :after fixes
6483 if(strtmparray[0]=="endenumerate" || strtmparray[0]=="enditemize" || strtmparray[0]=="enddescription") {
6484 var endDiv = document.createElement("div");
6485 endDiv.className = "endlistitem";
6486 newFrag.appendChild(endDiv);
6487 }
6488 newFrag.appendChild(nodeTmp);
6489 if(strtmparray[0]=="enumerate" || strtmparray[0]=="itemize" || strtmparray[0]=="description") {
6490 var endDiv = document.createElement("div");
6491 endDiv.className = "listitem";
6492 newFrag.appendChild(endDiv);
6493 }
6494 }
6495 } else {
6496 //even = text, labels, bf, and italics, and linebreaks, and math -- we now remove the math
6497 strtmp[j] = strtmp[j].replace(/\\\$/g,"<per>");
6498 strtmp[j] = strtmp[j].replace(/\$([^\$]+)\$/g," \\[$1\\[ ");
6499 strtmp[j] = strtmp[j].replace(/<per>/g,"\\$");
6500 strtmp[j] = strtmp[j].replace(/\\begin\s*\{s*math\s*\}([\s\S]+?)\\end\s*\{s*math\s*\}/g," \\[$1\\[ ");
6501
6502 var strtmptmp = strtmp[j].split("\\[");
6503
6504 for(var jjj=0;jjj<strtmptmp.length;jjj++) {
6505 if(jjj % 2) { //odd = math
6506 var nodeTmp = document.createElement("span");
6507 nodeTmp.className = 'inlinemath';
6508 nodeTmp.appendChild(document.createTextNode("$"+strtmptmp[jjj]+"$"));
6509 newFrag.appendChild(nodeTmp);
6510 } else {
6511 //all other tags will be mapped to span's (most should be font-face tags) with class-names matching the tag name.
6512 //Exceptions will be textcolor, colorbox, textbf, textit, and emph. These cannot include any html tags.
6513 var TagIndex = strtmptmp[jjj].search(/\\\w+/);
6514 var tmpIndex = TagIndex;
6515 while(tmpIndex>-1) {
6516 if(/^\\textcolor/.test(strtmptmp[jjj].substring(TagIndex,strtmptmp[jjj].length))) {
6517 strtmptmp[jjj] = strtmptmp[jjj].replace(/\\textcolor\s*\{s*(\w+)\s*\}s*/," \\[textcolor\\]$1\\]|");
6518 } else {
6519 if(/^\\colorbox/.test(strtmptmp[jjj].substring(TagIndex,strtmptmp[jjj].length))) {
6520 strtmptmp[jjj] = strtmptmp[jjj].replace(/\\colorbox\s*\{s*(\w+)\s*\}s*/," \\[colorbox\\]$1\\]|");
6521 } else {
6522 strtmptmp[jjj] = strtmptmp[jjj].substring(0,TagIndex)+strtmptmp[jjj].substring(TagIndex,strtmptmp[jjj].length).replace(/\\\s*(\w+)\s*/," \\[$1\\]|");
6523 }
6524 }
6525 TagIndex +=strtmptmp[jjj].substring(TagIndex,strtmptmp[jjj].length).search(/\|/);
6526 TagIndex++;
6527 strtmptmp[jjj] = strtmptmp[jjj].replace(/\\\]\|/,"\\] ");
6528 if(strtmptmp[jjj].charAt(TagIndex) == "{") {
6529 strtmptmp[jjj] = strtmptmp[jjj].substring(0,TagIndex)+strtmptmp[jjj].substring(TagIndex+1,strtmptmp[jjj].length);
6530 var delimcnt = 1;
6531 for(var kk = TagIndex;kk<strtmptmp[jjj].length;kk++) {
6532 if(strtmptmp[jjj].charAt(kk) == "{") { delimcnt++ };
6533 if(strtmptmp[jjj].charAt(kk) == "}") { delimcnt-- };
6534 if(delimcnt==0) { break; }
6535 }
6536 strtmptmp[jjj] = strtmptmp[jjj].substring(0,kk)+"\\[ "+strtmptmp[jjj].substring(kk+1,strtmptmp[jjj].length);
6537 TagIndex = kk+3;
6538 } else {
6539 strtmptmp[jjj] = strtmptmp[jjj].substring(0,TagIndex)+"\\[ "+strtmptmp[jjj].substring(TagIndex+1,strtmptmp[jjj].length);
6540 TagIndex = TagIndex + 3;
6541 }
6542 if(TagIndex<strtmptmp[jjj].length) {
6543 tmpIndex = strtmptmp[jjj].substring(TagIndex,strtmptmp[jjj].length).search(/\\\w+/);
6544 }
6545 else {
6546 tmpIndex = -1 };
6547 TagIndex += tmpIndex;
6548 }
6549
6550
6551 strtmptmp[jjj] = strtmptmp[jjj].replace(/\\\\\s*\\\\/g,"\\\\");
6552 strtmptmp[jjj] = strtmptmp[jjj].replace(/\\\\/g," \\[br\\] \\[ ");
6553 strtmptmp[jjj] = strtmptmp[jjj].replace(/\\label\s*\{s*(\w+)\s*\}/g," \\[label\\]$1\\[ ");
6554 var strlbls = strtmptmp[jjj].split("\\[");
6555
6556 for(var jj=0;jj<strlbls.length;jj++) {
6557 if(jj % 2) { //odd = labels, boldface, and breaks
6558 var strtmparray = strlbls[jj].split("\\]");
6559 switch(strtmparray[0]) {
6560 case "textcolor":
6561 var nodeTmp = document.createElement("span");
6562 nodeTmp.className = 'LaTeXColor';
6563 if(IsColorName.test(strtmparray[1].toLowerCase())) {
6564 nodeTmp.style.color=LaTeXColor[strtmparray[1].toLowerCase()];
6565 } else {
6566 nodeTmp.style.color=strtmparray[1];
6567 };
6568 nodeTmp.appendChild(document.createTextNode(strtmparray[2]));
6569 newFrag.appendChild(nodeTmp);
6570 break;
6571 case "colorbox":
6572 var nodeTmp = document.createElement("span");
6573 nodeTmp.className = 'LaTeXColor';
6574 if(IsColorName.test(strtmparray[1].toLowerCase())) {
6575 nodeTmp.style.background=LaTeXColor[strtmparray[1].toLowerCase()];
6576 } else {
6577 nodeTmp.style.background=strtmparray[1];
6578 };
6579 nodeTmp.appendChild(document.createTextNode(strtmparray[2]));
6580 newFrag.appendChild(nodeTmp);
6581 break;
6582 case "br":
6583 newFrag.appendChild(document.createElement("br"));
6584 break;
6585 case "label" :
6586 var nodeTmp = document.createElement("a");
6587 nodeTmp.className = 'LaTeXMathMLlabel';
6588 var lblid = strtmparray[1].match(/\s*(\w+)\s*/);
6589 if(lblid != null) { nodeTmp.id = lblid[1] };
6590 nodeTmp.style.display = "none";
6591
6592 LaTeXCounter['label']++;
6593 var lblnum = makeNumberString(LaTeXCounter['label']);
6594
6595 var anchorSpan = document.createElement("span");
6596 anchorSpan.className = 'LaTeXMathMLlabel';
6597 anchorSpan.appendChild(document.createTextNode(lblnum));
6598 anchorSpan.style.display="none";
6599 nodeTmp.appendChild(anchorSpan);
6600 newFrag.appendChild(nodeTmp);
6601 break;
6602 default :
6603 var nodeTmp = document.createElement("span");
6604 nodeTmp.className = strtmparray[0];
6605 nodeTmp.appendChild(document.createTextNode(strtmparray[1]))
6606 newFrag.appendChild(nodeTmp);
6607 }
6608 } else {
6609 newFrag.appendChild(document.createTextNode(strlbls[jj]));
6610 }
6611 }
6612 }
6613 }
6614 } // end else for even splits of strtmp
6615 }
6616 }
6617 }; //else sections and labels
6618 TheBody.parentNode.replaceChild(newFrag,TheBody);
6619 } //str nodevalue is not empty
6620 }
6621 } // split off recursion
6622 return TheBody;
6623 }
6624
6625 function LaTeXDivsAndRefs(thebody) {
6626 var TheBody = thebody;
6627
6628 var EndDivClass = null;
6629 var AllDivs = TheBody.getElementsByTagName("div");
6630 var lbl2id = "";
6631 var lblnode = null;
6632 for(var i=AllDivs.length-1;i>=0;i--) {
6633 EndDivClass = AllDivs[i].className.match(/end\w+/ );
6634 if(EndDivClass!=null) {
6635 EndDivClass = EndDivClass[0];
6636 var DivClass = EndDivClass.substring(3,EndDivClass.length);
6637 var EndDivNode = AllDivs[i];
6638 break;
6639 }
6640 }
6641 while(EndDivClass!=null) {
6642 // TrackBack to Beginning, appending to newfrag as we go
6643 var newFrag = document.createDocumentFragment();
6644 var RootNode = EndDivNode.parentNode;
6645 var ClassCount = 1; // because of EndDivNode
6646 while(EndDivNode.previousSibling!=null && ClassCount>0) {
6647 switch(EndDivNode.previousSibling.className) {
6648 case EndDivClass:
6649 ClassCount++;
6650 newFrag.insertBefore(EndDivNode.previousSibling,newFrag.firstChild);
6651 break;
6652 case DivClass:
6653 if(EndDivNode.previousSibling.nodeName=="DIV") {
6654 ClassCount-- ;
6655 //Must check to see if we need a label here!
6656 if(lbl2id !="" ) {
6657 EndDivNode.previousSibling.id = lbl2id;
6658 lbl2id = ""
6659 }
6660 if(ClassCount==0) {
6661 RootNode = EndDivNode.previousSibling;
6662 } else {
6663 newFrag.insertBefore(EndDivNode.previousSibling,newFrag.firstChild);
6664 }
6665 };
6666 break;
6667 case 'LaTeXMathMLlabel':
6668 lbl2id = EndDivNode.previousSibling.id;
6669 EndDivNode.parentNode.removeChild(EndDivNode.previousSibling);
6670 break;
6671 default:
6672 newFrag.insertBefore(EndDivNode.previousSibling,newFrag.firstChild);
6673 }
6674 }
6675 RootNode.appendChild(newFrag);
6676 EndDivNode.parentNode.removeChild(EndDivNode);
6677
6678 //Look for more end div items
6679 AllDivs = TheBody.getElementsByTagName("DIV");
6680 for(i=AllDivs.length-1;i>=0;i--) {
6681 EndDivClass = AllDivs[i].className.match(/end\w+/ );
6682 if(EndDivClass!=null) {
6683 ClassCount = 0;
6684 EndDivClass = EndDivClass[0];
6685 DivClass = EndDivClass.substring(3,EndDivClass.length);
6686 EndDivNode = AllDivs[i];
6687 RootNode = EndDivNode.parentNode;
6688 break;
6689 }
6690 }
6691 } // end while!
6692
6693
6694
6695
6696 var AllDivs = TheBody.getElementsByTagName("div"); //Convert itemize and enumerate to html lists:
6697 var DIV2LI = null;
6698
6699 for(var i=0;i<AllDivs.length;i++) {
6700 if( AllDivs[i].className=="itemize" || AllDivs[i].className=="enumerate" || AllDivs[i].className=="description") {
6701 if(AllDivs[i].className=="itemize") {
6702 RootNode = document.createElement("UL");
6703 } else {
6704 RootNode = document.createElement("OL");
6705 }
6706 RootNode.className = 'LaTeXMathML';
6707 if(AllDivs[i].hasChildNodes()) { AllDivs[i].removeChild(AllDivs[i].firstChild) };
6708 while(AllDivs[i].hasChildNodes()) {
6709 if(AllDivs[i].firstChild.hasChildNodes()) {
6710 DIV2LI = document.createElement("LI");
6711 while(AllDivs[i].firstChild.hasChildNodes()) {
6712 DIV2LI.appendChild(AllDivs[i].firstChild.firstChild);
6713 }
6714 if(DIV2LI.firstChild.className=="listitemmarker") {
6715 DIV2LI.style.listStyleType = "none";
6716 }
6717 RootNode.appendChild(DIV2LI)
6718 }
6719 AllDivs[i].removeChild(AllDivs[i].firstChild);
6720 }
6721 AllDivs[i].appendChild(RootNode);
6722 }
6723 }
6724
6725 // From here to 'end for AllAnchors is necessary only because CSS3 is not implemented yet.
6726 // Once CSS3 target-text is available, this can be done using CSS
6727 var AllAnchors = TheBody.getElementsByTagName("a");
6728 for(var i=0;i<AllAnchors.length;i++) {
6729 if(AllAnchors[i].className == "ref" || AllAnchors[i].className == "cite" ) {
6730 var label = AllAnchors[i].href.match(/\#(\w+)/);
6731 if(label!=null) {
6732 var labelNode = document.getElementById(label[1]);
6733 if(labelNode!=null) {
6734 var TheSpans = labelNode.getElementsByTagName("SPAN");
6735 if(TheSpans!=null) {
6736 var refNode = TheSpans[0].cloneNode(true);
6737 refNode.style.display="inline"
6738 refNode.className = AllAnchors[i].className;
6739 AllAnchors[i].appendChild(refNode);
6740 //break;
6741 }
6742 }
6743 }
6744 }
6745 } // end for AllAnchors
6746
6747 // Eventually: Collapsible Sections
6748
6749 return TheBody;
6750 }
6751
6752 var AMbody;
6753 var AMnoMathML = false, AMtranslated = false;
6754
6755 function translate(spanclassAM) {
6756 if (!AMtranslated) { // run this only once
6757 AMtranslated = true;
6758 AMinitSymbols();
6759 var LaTeXContainers = [];
6760 var AllContainers = document.getElementsByTagName('*');
6761 var ExtendName = "";
6762
6763 for (var k = 0,l=0; k < AllContainers.length; k++) {
6764 ExtendName = " "+AllContainers[k].className+" ";
6765 if(ExtendName.match(/\sLaTeX\s/)!=null) {
6766 LaTeXContainers[l] = AllContainers[k];
6767 l++;
6768 }
6769 };
6770 if(LaTeXContainers.length>0) {
6771 for(var m=0;m<LaTeXContainers.length;m++) {
6772 AMbody = LaTeXContainers[m];
6773 try {
6774 AMbody = LaTeXDivsAndRefs(LaTeXpreProcess(AMbody)); //
6775 } catch(err) {
6776 alert("Unknown Error: Defaulting to Original LaTeXMathML");
6777 }
6778 if(AMbody.tagName=="PRE") {
6779 var PreChilds = document.createDocumentFragment();
6780 var DivChilds = document.createElement("DIV");
6781 while(AMbody.hasChildNodes()) {
6782 DivChilds.appendChild(AMbody.firstChild);
6783 }
6784 PreChilds.appendChild(DivChilds);
6785 AMbody.parentNode.replaceChild(PreChilds,AMbody);
6786 AMbody = DivChilds; //Leaves empty pre -- may be useful??
6787
6788 }
6789 AMprocessNode(AMbody, false, spanclassAM);
6790 }
6791 } else { //Default to entire page
6792 AMbody = document.getElementsByTagName("body")[0];
6793 try {
6794 AMbody = LaTeXDivsAndRefs(LaTeXpreProcess(AMbody)); //
6795 } catch(err) {
6796 alert("Unknown Error: Defaulting to Original LaTeXMathML");
6797 }
6798 AMprocessNode(AMbody, false, spanclassAM);
6799 }
6800 }
6801 }
6802
6803 if (isIE) {
6804 // avoid adding MathPlayer info explicitly to each webpage
6805 document.write("<object id=\"mathplayer\"\
6806 classid=\"clsid:32F66A20-7614-11D4-BD11-00104BD3F987\"></object>");
6807 document.write("<?import namespace=\"m\" implementation=\"#mathplayer\"?>");
6808 }
6809
6810 // GO1.1 Generic onload by Brothercake
6811 // http://www.brothercake.com/
6812 //onload function (replaces the onload="translate()" in the <body> tag)
6813 function generic()
6814 {
6815 translate();
6816 };
6817 //setup onload function
6818 if(typeof window.addEventListener != 'undefined')
6819 {
6820 //.. gecko, safari, konqueror and standard
6821 window.addEventListener('load', generic, false);
6822 }
6823 else if(typeof document.addEventListener != 'undefined')
6824 {
6825 //.. opera 7
6826 document.addEventListener('load', generic, false);
6827 }
6828 else if(typeof window.attachEvent != 'undefined')
6829 {
6830 //.. win/ie
6831 window.attachEvent('onload', generic);
6832 }
6833 //** remove this condition to degrade older browsers
6834 else
6835 {
6836 //.. mac/ie5 and anything else that gets this far
6837 //if there's an existing onload function
6838 if(typeof window.onload == 'function')
6839 {
6840 //store it
6841 var existing = onload;
6842 //add new onload handler
6843 window.onload = function()
6844 {
6845 //call existing onload function
6846 existing();
6847 //call generic onload function
6848 generic();
6849 };
6850 }
6851 else
6852 {
6853 //setup onload function
6854 window.onload = generic;
6855 }
6856 }
6857 /*]]>*/
6858 </script>
6859 </head>
6860 <body class="article">
6861 <div id="header" class="slide hledgersplash">
6862 <h1>Informatiser une comptabilité avec confiance</h1>
6863 <span id="author">git://git.autogeree.net/tool/hledger</span><br />
6864 <span id="revnumber">version 6ca58eb</span>
6865 <br /><span id="revremark"></span>
6866 </div>
6867 </div></div>
6868 <script type="text/javascript">/*<![CDATA[*/if (slidefootnotes != ''){document.write("<hr/><p>"+slidefootnotes+"</p>");}/*]]>*/</script>
6869 </div><div class="slide">
6870
6871 <div class="sect1">
6872 <h1 id="_le_code_ledger_code_un_format_de_em_grand_livre_em_ouvert_et_simple">1. Le <code>.ledger</code> : un format de <em>Grand Livre</em> ouvert.. et simple</h1>
6873 <script type="text/javascript">/*<![CDATA[*/subslide=1;nextclass="sect1";nexttitle="1. Le <code>.ledger</code> : un format de <em>Grand Livre</em> ouvert.. et simple";slidefootnotes="";/*]]>*/</script>
6874 <div class="sectionbody">
6875 <div class="listingblock incremental">
6876 <div class="content"><pre>
6877 <span class="hledgerTransactionDate">2014/05/01</span> <span class="hledgerTransactionDescription">Stand manif</span>
6878 <span class="hledgerPostingAccount"> Don</span><span class="hledgerAccountSeparator">:</span><span class="hledgerPostingAccount">Anonyme</span><span class="hledgerPostingAmount"> -</span><span class="hledgerNumber">42</span>
6879 <span class="hledgerPostingAccountOdd"> Caisse</span><span class="hledgerAccountSeparatorOdd">:</span><span class="hledgerPostingAccountOdd">Grève</span><span class="hledgerPostingAmountOdd"> </span><span class="hledgerNumberOdd">42</span>
6880
6881 <span class="hledgerTransactionDate">2014/05/08</span> <span class="hledgerTransactionDescription">Propagande</span>
6882 <span class="hledgerPostingAccount"> Caisse</span><span class="hledgerAccountSeparator">:</span><span class="hledgerPostingAccount">Grève</span><span class="hledgerPostingAmount"> -</span><span class="hledgerNumber">7</span>
6883 <span class="hledgerPostingAccountOdd"> Achat</span><span class="hledgerAccountSeparatorOdd">:</span><span class="hledgerPostingAccountOdd">Impression</span><span class="hledgerAccountSeparatorOdd">:</span><span class="hledgerPostingAccountOdd">Tracts</span><span class="hledgerPostingAmountOdd"> </span><span class="hledgerNumberOdd">7</span>
6884
6885 <span class="Comment">; Répéter ad nauseam</span>
6886 </pre></div></div>
6887 </div></div>
6888 <script type="text/javascript">/*<![CDATA[*/if (slidefootnotes != ''){document.write("<hr/><p>"+slidefootnotes+"</p>");}/*]]>*/</script>
6889
6890 <div class="sect2">
6891 <h1 id="_les_plus">1.1. Les plus</h1>
6892 <script type="text/javascript">/*<![CDATA[*/subslide=1;nextclass="sect2";nexttitle="1.1. Les plus";slidefootnotes="";/*]]>*/</script>
6893 <div class="sectionbody">
6894 <div class="hdlist"><table><tbody class=" incremental">
6895 <tr>
6896 <td class="hdlist1">
6897 Transparent
6898 <br />
6899 </td>
6900 <td class="hdlist2">
6901 <p style="margin-top: 0;">
6902 Visibilité de <em>toutes</em> les informations.
6903 </p>
6904 </td>
6905 </tr>
6906 <tr>
6907 <td class="hdlist1">
6908 Pérenne
6909 <br />
6910 </td>
6911 <td class="hdlist2">
6912 <p style="margin-top: 0;">
6913 Compréhensible sans peine.
6914 </p>
6915 </td>
6916 </tr>
6917 <tr>
6918 <td class="hdlist1">
6919 Modifiable
6920 <br />
6921 </td>
6922 <td class="hdlist2">
6923 <p style="margin-top: 0;">
6924 Pas d’interface protectrice.
6925 </p>
6926 </td>
6927 </tr>
6928 <tr>
6929 <td class="hdlist1">
6930 Accès
6931 <br />
6932 </td>
6933 <td class="hdlist2">
6934 <p style="margin-top: 0;">
6935 Pas de changement d’interface non-consenti.
6936 </p>
6937 </td>
6938 </tr>
6939 <tr>
6940 <td class="hdlist1">
6941 Versionnable
6942 <br />
6943 </td>
6944 <td class="hdlist2">
6945 <p style="margin-top: 0;">
6946 Suivi et fusion simples des modifications.
6947 </p>
6948 </td>
6949 </tr>
6950 <tr>
6951 <td class="hdlist1">
6952 Écrit
6953 <br />
6954 </td>
6955 <td class="hdlist2">
6956 <p style="margin-top: 0;">
6957 Langage pour s’exprimer clairement, par exemple pour discuter dans un courriel.
6958 </p>
6959 </td>
6960 </tr>
6961 <tr>
6962 <td class="hdlist1">
6963 Hors-ligne
6964 <br />
6965 </td>
6966 <td class="hdlist2">
6967 <p style="margin-top: 0;">
6968 Pas besoin de réseau.
6969 </p>
6970 </td>
6971 </tr>
6972 <tr>
6973 <td class="hdlist1">
6974 Interopérable
6975 <br />
6976 </td>
6977 <td class="hdlist2">
6978 <p style="margin-top: 0;">
6979 Pas spécifique à un éditeur logiciel particulier
6980 (sauf fonctionnalité expérimentale).
6981 </p>
6982 <ul class=" incremental">
6983 <li>
6984 <span>
6985 <a href="http://ledger-cli.org/">http://ledger-cli.org/</a>
6986 </span>
6987 </li>
6988 <li>
6989 <span>
6990 <a href="http://hledger.org/">http://hledger.org/</a>
6991 </span>
6992 </li>
6993 <li>
6994 <span>
6995 <a href="http://furius.ca/beancount/">http://furius.ca/beancount/</a>
6996 </span>
6997 </li>
6998 <li>
6999 <span>
7000 <a href="https://massysett.github.io/penny/">https://massysett.github.io/penny/</a>
7001 </span>
7002 </li>
7003 <li>
7004 <span>
7005 <a href="https://github.com/hrj/abandon/">https://github.com/hrj/abandon/</a>
7006 </span>
7007 </li>
7008 </ul>
7009 </td>
7010 </tr>
7011 </tbody></table></div>
7012 </div></div>
7013 <script type="text/javascript">/*<![CDATA[*/if (slidefootnotes != ''){document.write("<hr/><p>"+slidefootnotes+"</p>");}/*]]>*/</script>
7014 </div><div class="slide">
7015
7016 <div class="sect2">
7017 <h1 id="_les_moins">1.2. Les moins</h1>
7018 <script type="text/javascript">/*<![CDATA[*/subslide=1;nextclass="sect2";nexttitle="1.2. Les moins";slidefootnotes="";/*]]>*/</script>
7019 <div class="sectionbody">
7020 <div class="hdlist"><table><tbody class=" incremental">
7021 <tr>
7022 <td class="hdlist1">
7023 Modifiable
7024 <br />
7025 </td>
7026 <td class="hdlist2">
7027 <p style="margin-top: 0;">
7028 Mais pas moins que les autres logiciels
7029 et à nuancer si couplé à un gestionnaires de versions,
7030 et/ou avec signature cryptographiques.
7031 </p>
7032 <div class="listingblock incremental">
7033 <div class="content"><pre>
7034 % git tag <span class="Special">--sign</span> v2011 <span class="Special">-m</span> <span class="Statement">&quot;</span><span class="Constant">Clôture de la comptabilité 2011</span><span class="Statement">&quot;</span>
7035 % git tag <span class="Special">--verify</span> v2011
7036 </pre></div></div>
7037 <div class="listingblock incremental">
7038 <div class="content"><pre>
7039 % gpg <span class="Special">--sign</span> <span class="PreProc">$fichier</span>.hledger
7040 % gpg <span class="Special">--verify-files</span> <span class="PreProc">$fichier</span>.hledger.gpg
7041 </pre></div></div>
7042 </td>
7043 </tr>
7044 <tr>
7045 <td class="hdlist1">
7046 Textuel
7047 <br />
7048 </td>
7049 <td class="hdlist2">
7050 <p style="margin-top: 0;">
7051 Préférable de bien savoir utiliser
7052 un éditeur de texte structuré.
7053 </p>
7054 </td>
7055 </tr>
7056 <tr>
7057 <td class="hdlist1">
7058 Peu contraint
7059 <br />
7060 </td>
7061 <td class="hdlist2">
7062 <div class="listingblock incremental">
7063 <div class="content"><pre>
7064 <span class="hledgerTransactionDate">2102/03/21</span> <span class="hledgerTransactionDescription">Remise chq (1101804)</span>
7065 <span class="hledgerPostingAccount"> </span><span class="hledgerNumber">5</span><span class="hledgerPostingAccount">.Finance</span><span class="hledgerAccountSeparator">:</span><span class="hledgerNumber">1</span><span class="hledgerPostingAccount">.Etablissement</span><span class="hledgerAccountSeparator">:</span><span class="hledgerNumber">1</span><span class="hledgerPostingAccount">.Valeur</span><span class="hledgerAccountSeparator">:</span><span class="hledgerNumber">2</span><span class="hledgerPostingAccount">.Chèque_à_encaisser</span><span class="hledgerPostingAmount"> -</span><span class="hledgerNumber">145</span><span class="hledgerPostingAmount">,</span><span class="hledgerNumber">00</span>
7066 <span class="hledgerPostingAccountOdd"> </span><span class="hledgerNumberOdd">5</span><span class="hledgerPostingAccountOdd">.Finance</span><span class="hledgerAccountSeparatorOdd">:</span><span class="hledgerNumberOdd">1</span><span class="hledgerPostingAccountOdd">.Etablissement</span><span class="hledgerAccountSeparatorOdd">:</span><span class="hledgerNumberOdd">2</span><span class="hledgerPostingAccountOdd">.Banque</span><span class="hledgerAccountSeparatorOdd">:</span><span class="hledgerNumberOdd">001</span><span class="hledgerPostingAccountOdd">.Courant</span><span class="hledgerPostingAmountOdd"> </span><span class="hledgerNumberOdd">145</span><span class="hledgerPostingAmountOdd">,</span><span class="hledgerNumberOdd">00</span>
7067 </pre></div></div>
7068 </td>
7069 </tr>
7070 </tbody></table></div>
7071 <div class="admonitionblock incremental">
7072 <table><tr>
7073 <td class="icon">
7074 <img src="./icons/note.png" alt="Note" />
7075 </td>
7076 <td class="content">KISS</td>
7077 </tr></table>
7078 </div>
7079 </div></div>
7080 <script type="text/javascript">/*<![CDATA[*/if (slidefootnotes != ''){document.write("<hr/><p>"+slidefootnotes+"</p>");}/*]]>*/</script>
7081 </div><div class="slide">
7082
7083 <div class="sect1">
7084 <h1 id="_code_hledger_code_un_outil_libre_et_convivial">2. <code>hledger</code> : un outil libre.. et convivial</h1>
7085 <script type="text/javascript">/*<![CDATA[*/subslide=1;nextclass="sect1";nexttitle="2. <code>hledger</code> : un outil libre.. et convivial";slidefootnotes="";/*]]>*/</script>
7086 <div class="sectionbody">
7087 <div class="listingblock incremental">
7088 <div class="content"><pre>
7089 % hledger balance <span class="Statement">'</span><span class="Constant">^6</span><span class="Statement">'</span> <span class="Statement">'</span><span class="Constant">^7</span><span class="Statement">'</span> <span class="Special">--depth</span> <span class="Constant">2</span> <span class="Special">-f</span> Paris.2011.hledger
7090 <span class="Constant">770</span>,<span class="Constant">58</span>6.Charge
7091 <span class="Constant">248</span>,<span class="Constant">87</span>0.Achat
7092 <span class="Constant">441</span>,<span class="Constant">46</span>1.Service
7093 <span class="Constant">55</span>,<span class="Constant">25</span>2.Autre_service
7094 <span class="Constant">25</span>,<span class="Constant">00</span>5.Gestion
7095 <span class="Constant">-726</span>,<span class="Constant">00</span>7.Produit
7096 <span class="Constant">-700</span>,<span class="Constant">00</span>0.Vente
7097 <span class="Constant">-26</span>,<span class="Constant">00</span>5.Autre_gestion_courante
7098 ‑-------------------
7099 <span class="Constant">44</span>,<span class="Constant">58</span>
7100 </pre></div></div>
7101 </div></div>
7102 <script type="text/javascript">/*<![CDATA[*/if (slidefootnotes != ''){document.write("<hr/><p>"+slidefootnotes+"</p>");}/*]]>*/</script>
7103
7104 <div class="sect2">
7105 <h1 id="_les_plus_2">2.1. Les plus</h1>
7106 <script type="text/javascript">/*<![CDATA[*/subslide=1;nextclass="sect2";nexttitle="2.1. Les plus";slidefootnotes="";/*]]>*/</script>
7107 <div class="sectionbody">
7108 <div class="dlist"><dl class=" incremental">
7109 <dt class="hdlist1">
7110 Utilisation
7111 </dt>
7112 <dt class="hdlist1">
7113 Étude
7114 </dt>
7115 <dt class="hdlist1">
7116 Modification
7117 </dt>
7118 <dt class="hdlist1">
7119 Duplication
7120 </dt>
7121 <dd>
7122 <p>
7123 Permises techniquement et légalement<br />
7124 (« logiciel libre » sous <code>GNU/GPLv3</code>)
7125 </p>
7126 </dd>
7127 <dt class="hdlist1">
7128 Certification
7129 </dt>
7130 <dd>
7131 <p>
7132 Programmé en <a href="http://fr.wikipedia.org/wiki/Haskell">Haskell</a>
7133 </p>
7134 <div class="hdlist"><table><tbody class=" incremental">
7135 <tr>
7136 <td class="hdlist1">
7137 Fonctionnel pur
7138 <br />
7139 </td>
7140 <td class="hdlist2">
7141 <p style="margin-top: 0;">
7142 Aucune mutation de données externes à une fonction (effet de bord).
7143 </p>
7144 </td>
7145 </tr>
7146 <tr>
7147 <td class="hdlist1">
7148 Typage statique
7149 <br />
7150 </td>
7151 <td class="hdlist2">
7152 <p style="margin-top: 0;">
7153 Vérification des erreurs de type avant l’exécution du programme.
7154 </p>
7155 </td>
7156 </tr>
7157 <tr>
7158 <td class="hdlist1">
7159 Typage fort
7160 <br />
7161 </td>
7162 <td class="hdlist2">
7163 <p style="margin-top: 0;">
7164 Aucune conversion implicite de types de données.
7165 </p>
7166 </td>
7167 </tr>
7168 </tbody></table></div>
7169 </dd>
7170 <dt class="hdlist1">
7171 Portable
7172 </dt>
7173 <dd>
7174 <p>
7175 GNU/Linux, Apple/MacOS, Microsoft/Windows
7176 </p>
7177 </dd>
7178 <dt class="hdlist1">
7179 Support
7180 </dt>
7181 <dd>
7182 <p>
7183 ~1 développeur à mi-temps
7184 </p>
7185 <ul class=" incremental">
7186 <li>
7187 <span>
7188 Simon Michael &lt;<a href="mailto:simon@joyful.com">simon@joyful.com</a>&gt;
7189 </span>
7190 </li>
7191 </ul>
7192 </dd>
7193 <dt class="hdlist1">
7194 Ligne de commande
7195 </dt>
7196 <dd>
7197 <div class="listingblock incremental">
7198 <div class="content"><pre>
7199 % hledger balance <span class="Special">-f</span> <span class="PreProc">$fichier</span>.hledger
7200 </pre></div></div>
7201 </dd>
7202 <dt class="hdlist1">
7203 Interface Web
7204 </dt>
7205 <dd>
7206 <div class="listingblock incremental">
7207 <div class="content"><pre>
7208 % hledger-web <span class="Special">--server</span> <span class="Special">-f</span> <span class="PreProc">$fichier</span>.hledger
7209 % firefox <span class="Statement">&quot;</span><span class="Constant"><a href="http://localhost:5000">http://localhost:5000</a></span><span class="Statement">&quot;</span>
7210 </pre></div></div>
7211 </dd>
7212 <dt class="hdlist1">
7213 Extensible
7214 </dt>
7215 <dd>
7216 <div class="listingblock incremental">
7217 <div class="content"><pre>
7218 % ghc hledger-fait-ce-que-je-veux.hs
7219 % ./hledger-fait-ce-que-je-veux <span class="Special">-f</span> <span class="PreProc">$fichier</span>.hledger
7220 </pre></div></div>
7221 </dd>
7222 </dl></div>
7223 </div></div>
7224 <script type="text/javascript">/*<![CDATA[*/if (slidefootnotes != ''){document.write("<hr/><p>"+slidefootnotes+"</p>");}/*]]>*/</script>
7225
7226 <div class="sect2">
7227 <h1 id="_les_moins_2">2.2. Les moins</h1>
7228 <script type="text/javascript">/*<![CDATA[*/subslide=1;nextclass="sect2";nexttitle="2.2. Les moins";slidefootnotes="";/*]]>*/</script>
7229 <div class="sectionbody">
7230 <div class="dlist"><dl class=" incremental">
7231 <dt class="hdlist1">
7232 Ligne de commande
7233 </dt>
7234 <dd>
7235 <div class="paragraph">
7236 <div class="incremental">
7237 <p>&#8230;</p>
7238 </div>
7239 </div>
7240 </dd>
7241 </dl></div>
7242 </div></div>
7243 <script type="text/javascript">/*<![CDATA[*/if (slidefootnotes != ''){document.write("<hr/><p>"+slidefootnotes+"</p>");}/*]]>*/</script>
7244 </div><div class="slide">
7245
7246 <div class="sect1">
7247 <h1 id="_installer_code_hledger_code">3. Installer <code>hledger</code></h1>
7248 <script type="text/javascript">/*<![CDATA[*/subslide=1;nextclass="sect1";nexttitle="3. Installer <code>hledger</code>";slidefootnotes="";/*]]>*/</script>
7249 <div class="sectionbody">
7250 <ul class=" incremental">
7251 <li>
7252 <span>
7253 <a href="http://hledger.org/installing">http://hledger.org/installing</a>
7254 </span>
7255 </li>
7256 </ul>
7257 <div class="listingblock incremental">
7258 <div class="title">Debian/jessie</div>
7259 <div class="content"><pre>
7260 % sudo apt-get install hledger hledger-web
7261 </pre></div></div>
7262 </div></div>
7263 <script type="text/javascript">/*<![CDATA[*/if (slidefootnotes != ''){document.write("<hr/><p>"+slidefootnotes+"</p>");}/*]]>*/</script>
7264
7265 <div class="sect2">
7266 <h1 id="_via_code_cabal_code">3.1. Via <code>cabal</code></h1>
7267 <script type="text/javascript">/*<![CDATA[*/subslide=1;nextclass="sect2";nexttitle="3.1. Via <code>cabal</code>";slidefootnotes="";/*]]>*/</script>
7268 <div class="sectionbody">
7269 <ul class=" incremental">
7270 <li>
7271 <span>
7272 <a href="http://www.haskell.org/cabal/">http://www.haskell.org/cabal/</a>
7273 </span>
7274 </li>
7275 </ul>
7276 <div class="listingblock incremental">
7277 <div class="title">Debian/wheezy</div>
7278 <div class="content"><pre>
7279 % <span class="Statement">echo</span><span class="Constant"> </span><span class="Statement">'</span><span class="Constant">PATH=&quot;$HOME/.cabal/bin:$PATH&quot;</span><span class="Statement">'</span><span class="Constant"> </span><span class="Statement">&gt;&gt;</span>~/.profile
7280 <span class="Comment"># NOTE: rajoute dans le chemins des exécutables</span>
7281 <span class="Comment"># les exécutables installés par cabal</span>
7282 % <span class="Statement">exit</span> <span class="Comment"># NOTE: recharge ~/.profile</span>
7283
7284 % sudo apt-get install ghc cabal-install <span class="Statement">\</span>
7285 libncurses5-dev libtinfo-dev zlib1g-dev
7286 % cabal update
7287 % cabal install cabal <span class="Comment"># NOTE: met à jour cabal</span>
7288 % cabal install happy <span class="Comment"># NOTE: anticipe une dépendance exécutable</span>
7289 % cabal install hledger
7290 % cabal install alex <span class="Comment"># NOTE: anticipe une dépendance exécutable</span>
7291 % cabal install warp-2.0.3.4 hledger-web
7292 <span class="Comment"># NOTE: aide cabal à sélectionner un warp qui fonctionne</span>
7293 </pre></div></div>
7294 <div class="listingblock incremental">
7295 <div class="title">Mise-à-jour</div>
7296 <div class="content"><pre>
7297 % cabal install <span class="Special">--reinstall</span> hledger hledger-web
7298 </pre></div></div>
7299 </div></div>
7300 <script type="text/javascript">/*<![CDATA[*/if (slidefootnotes != ''){document.write("<hr/><p>"+slidefootnotes+"</p>");}/*]]>*/</script>
7301
7302 <div class="sect3">
7303 <h1 id="_version_de_développement">3.1.1. Version de développement</h1>
7304 <script type="text/javascript">/*<![CDATA[*/subslide=1;nextclass="sect3";nexttitle="3.1.1. Version de développement";slidefootnotes="";/*]]>*/</script>
7305 <div class="sectionbody">
7306 <div class="listingblock incremental">
7307 <div class="content"><pre>
7308 % git clone <a href="http://github.com/simonmichael/hledger.git">http://github.com/simonmichael/hledger.git</a> ~/src/hledger
7309 % <span class="Statement">cd</span> ~/src/hledger
7310 % cabal install <span class="Special">--reinstall</span> <span class="Special">--force-reinstalls</span> <span class="Statement">\</span>
7311 ./hledger-lib ./hledger ./hledger-web
7312 </pre></div></div>
7313 </div></div>
7314 <script type="text/javascript">/*<![CDATA[*/if (slidefootnotes != ''){document.write("<hr/><p>"+slidefootnotes+"</p>");}/*]]>*/</script>
7315 </div><div class="slide">
7316
7317 <div class="sect1">
7318 <h1 id="_écrire_en_code_ledger_code">4. Écrire en <code>.ledger</code></h1>
7319 <script type="text/javascript">/*<![CDATA[*/subslide=1;nextclass="sect1";nexttitle="4. Écrire en <code>.ledger</code>";slidefootnotes="";/*]]>*/</script>
7320 <div class="sectionbody">
7321 <div class="paragraph">
7322 <div class="incremental">
7323 <p>Un <code>.ledger</code> est un fichier de texte brut respectant une syntaxe préçise
7324 qui forme une succession d’écritures comptables, ordonnées librement.</p>
7325 </div>
7326 </div>
7327 </div></div>
7328 <script type="text/javascript">/*<![CDATA[*/if (slidefootnotes != ''){document.write("<hr/><p>"+slidefootnotes+"</p>");}/*]]>*/</script>
7329
7330 <div class="sect2">
7331 <h1 id="_exemple">4.1. Exemple</h1>
7332 <script type="text/javascript">/*<![CDATA[*/subslide=1;nextclass="sect2";nexttitle="4.1. Exemple";slidefootnotes="";/*]]>*/</script>
7333 <div class="sectionbody">
7334 <div class="listingblock incremental">
7335 <div class="content"><pre>
7336 <span class="Comment">; Ceci est un exemple de livre comptable « ledger »</span>
7337 <span class="Comment">; NOTE: fantaisiste comptablement parlant, mais syntaxiquement correct</span>
7338
7339 <span class="hledgerTransactionDate">2014/01/01</span> <span class="hledgerTransactionDescription">Libellé de l’écriture </span><span class="hledgerTransactionComment">; </span><span class="hledgerTag">UN_TAG:</span><span class="hledgerTransactionComment">, </span><span class="hledgerTag">Autre_tag:</span><span class="hledgerTagValue">Avec_Valeur</span>
7340 <span class="hledgerPostingAccount"> Compte</span><span class="hledgerAccountSeparator">:</span><span class="hledgerPostingAccount">Sous-Compte</span><span class="hledgerPostingAmount"> -</span><span class="hledgerNumber">42</span> <span class="hledgerTransactionComment">; flux créditant</span>
7341 <span class="hledgerPostingAccountOdd"> Autre_Compte</span><span class="hledgerAccountSeparatorOdd">:</span><span class="hledgerPostingAccountOdd">Sous-Compte</span><span class="hledgerAccountSeparatorOdd">:</span><span class="hledgerPostingAccountOdd">Sous-Sous-Compte</span><span class="hledgerPostingAmountOdd"> </span><span class="hledgerNumberOdd">42</span> <span class="hledgerTransactionComment">; flux débitant</span>
7342
7343 <span class="hledgerTransactionDate">2014/01/01</span> <span class="hledgerTransactionDescription">Deuxième écriture le même jour</span>
7344 <span class="hledgerPostingAccount"> Vente</span><span class="hledgerAccountSeparator">:</span><span class="hledgerPostingAccount">Âme</span><span class="hledgerPostingAmount"> -</span><span class="hledgerNumber">666</span> <span class="hledgerTransactionComment">; (tag de flux) </span><span class="hledgerTag">Arnaque:</span>
7345 <span class="hledgerPostingAccountOdd"> Kapital</span><span class="hledgerPostingAmountOdd"> </span><span class="hledgerNumberOdd">666</span>
7346
7347 <span class="hledgerTransactionDate">2014/01/02</span> <span class="hledgerTransactionDescription">Troisième écriture le jour suivant avec ventilation des flux</span>
7348 <span class="hledgerPostingAccount"> Compte</span><span class="hledgerAccountSeparator">:</span><span class="hledgerPostingAccount">Crédité</span><span class="hledgerAccountSeparator">:</span><span class="hledgerPostingAccount">A</span><span class="hledgerPostingAmount"> -</span><span class="hledgerNumber">1</span>
7349 <span class="hledgerPostingAccountOdd"> Compte</span><span class="hledgerAccountSeparatorOdd">:</span><span class="hledgerPostingAccountOdd">Crédité</span><span class="hledgerAccountSeparatorOdd">:</span><span class="hledgerPostingAccountOdd">B</span><span class="hledgerPostingAmountOdd"> -</span><span class="hledgerNumberOdd">2</span>
7350 <span class="hledgerPostingAccount"> Compte</span><span class="hledgerAccountSeparator">:</span><span class="hledgerPostingAccount">Débité</span><span class="hledgerAccountSeparator">:</span><span class="hledgerPostingAccount">Z</span><span class="hledgerPostingAmount"> </span><span class="hledgerNumber">1</span>
7351 <span class="hledgerPostingAccountOdd"> Compte</span><span class="hledgerAccountSeparatorOdd">:</span><span class="hledgerPostingAccountOdd">Débité</span><span class="hledgerAccountSeparatorOdd">:</span><span class="hledgerPostingAccountOdd">Y</span><span class="hledgerPostingAmountOdd"> </span><span class="hledgerNumberOdd">1</span>
7352 <span class="hledgerPostingAccount"> Compte</span><span class="hledgerAccountSeparator">:</span><span class="hledgerPostingAccount">Débité</span><span class="hledgerAccountSeparator">:</span><span class="hledgerPostingAccount">X</span><span class="hledgerAccountSeparator">:</span><span class="hledgerPostingAccount">x</span><span class="hledgerPostingAmount"> </span><span class="hledgerNumber">1</span>
7353
7354 <span class="hledgerTransactionDate">2014/04/12</span>
7355 <span class="hledgerPostingAccount"> Compte</span><span class="hledgerAccountSeparator">:</span><span class="hledgerPostingAccount">Crédité</span><span class="hledgerPostingAmount"> -</span><span class="hledgerNumber">1234</span><span class="hledgerPostingAmount">,</span><span class="hledgerNumber">56</span>
7356 <span class="hledgerPostingAccountOdd"> Compte</span><span class="hledgerAccountSeparatorOdd">:</span><span class="hledgerPostingAccountOdd">Débité</span> <span class="hledgerTransactionComment">; 1234,56 (montant inféré)</span>
7357
7358 <span class="hledgerTransactionDate">2014/02/01</span> <span class="hledgerTransactionDescription">Écriture non ordonnée par date </span><span class="hledgerTransactionComment">; Ok, mais déconseillé</span>
7359 <span class="hledgerPostingAccount"> Compte</span><span class="hledgerAccountSeparator">:</span><span class="hledgerPostingAccount">Débité</span><span class="hledgerPostingAmount"> </span><span class="hledgerNumber">1</span>
7360 <span class="hledgerPostingAccountOdd"> Compte</span><span class="hledgerAccountSeparatorOdd">:</span><span class="hledgerPostingAccountOdd">Crédité</span><span class="hledgerPostingAmountOdd"> -</span><span class="hledgerNumberOdd">1</span> <span class="hledgerTransactionComment">; Flux non ordonné par crédit/débit</span>
7361 <span class="hledgerTransactionDescription"> </span><span class="hledgerTransactionComment">; c'est juste moins lisible...</span>
7362
7363 <span class="Comment">; Répéter ad nauseam</span>
7364 </pre></div></div>
7365 </div></div>
7366 <script type="text/javascript">/*<![CDATA[*/if (slidefootnotes != ''){document.write("<hr/><p>"+slidefootnotes+"</p>");}/*]]>*/</script>
7367 </div><div class="slide">
7368
7369 <div class="sect2">
7370 <h1 id="_langage">4.2. Langage</h1>
7371 <script type="text/javascript">/*<![CDATA[*/subslide=1;nextclass="sect2";nexttitle="4.2. Langage";slidefootnotes="";/*]]>*/</script>
7372 <div class="sectionbody">
7373 <div class="tableblock">
7374 <table rules="all"
7375 width="100%"
7376 frame="border"
7377 cellspacing="0" cellpadding="4">
7378 <col width="50%" />
7379 <col width="50%" />
7380 <thead>
7381 <tr>
7382 <th align="center" valign="top">Syntaxe (grammaire <a href="https://fr.wikipedia.org/wiki/Forme_de_Backus-Naur">BNF</a>)</th>
7383 <th align="center" valign="top">Structure (signatures fonctionnelles)</th>
7384 </tr>
7385 </thead>
7386 <tbody class="incremental">
7387 <tr>
7388 <td align="left" valign="top"><div><div class="listingblock incremental">
7389 <div class="content"><pre>
7390 livre ::= (écriture | commentaire | <span class="Constant">&quot;&quot;</span> | <span class="Constant">&quot;&quot;</span>)*
7391 </pre></div></div></div></td>
7392 <td align="left" valign="top"><div><div class="hdlist math"><table><tbody class=" incremental math">
7393 <tr>
7394 <td class="hdlist1">
7395 <strong>livre</strong>
7396 <br />
7397 </td>
7398 <td class="hdlist2">
7399 <p style="margin-top: 0;">
7400 <span class=" LaTeX ">$
7401 :\&gt;f:\textcolor{#D2691E}{\textbf{fichier}} →
7402 \lbrack\textcolor{#D2691E}{\textbf{\acute{e}criture}}\rbrack$</span>
7403 </p>
7404 </td>
7405 </tr>
7406 </tbody></table></div></div></td>
7407 </tr>
7408 <tr>
7409 <td align="left" valign="top"><div><div class="listingblock incremental">
7410 <div class="content"><pre>
7411 écriture ::= date <span class="Constant">&quot;&quot;</span> <span class="Constant">&quot;&quot;</span>* libellé commentaire <span class="Constant">&quot;&quot;</span>
7412 (<span class="Constant">&quot;&quot;</span> flux <span class="Constant">&quot;&quot;</span>)*
7413 date ::= (année <span class="Constant">&quot;/&quot;</span>)? mois <span class="Constant">&quot;/&quot;</span> jour
7414 libellé ::= (· - (<span class="Constant">&quot;;&quot;</span>|<span class="Constant">&quot;&quot;</span>))*
7415 </pre></div></div></div></td>
7416 <td align="left" valign="top"><div><div class="hdlist math"><table><tbody class=" incremental math">
7417 <tr>
7418 <td class="hdlist1">
7419 <strong>date</strong>
7420 <br />
7421 </td>
7422 <td class="hdlist2">
7423 <p style="margin-top: 0;">
7424 <span class=" LaTeX ">$
7425 :\&gt;e:\textcolor{#D2691E}{\textbf{\acute{e}criture}} →
7426 (\textcolor{#083194}{\textbf{ann\acute{e}e}}:\textcolor{#D2691E}{\textbf{ℕ}},~
7427 \textcolor{#083194}{\textbf{mois}}:\{\textcolor{#D2691E}{\textbf{01}},...,\textcolor{#D2691E}{\textbf{12}}\},~
7428 \textcolor{#083194}{\textbf{jour}}:\{\textcolor{#D2691E}{\textbf{01}},...,\textcolor{#D2691E}{\textbf{31}}\})$</span>
7429 </p>
7430 </td>
7431 </tr>
7432 <tr>
7433 <td class="hdlist1">
7434 <strong>libellé</strong>
7435 <br />
7436 </td>
7437 <td class="hdlist2">
7438 <p style="margin-top: 0;">
7439 <span class=" LaTeX ">$
7440 :\&gt;e:\textcolor{#D2691E}{\textbf{\acute{e}criture}} →
7441 \textcolor{#D2691E}{\textbf{texte}}$</span>
7442 </p>
7443 </td>
7444 </tr>
7445 <tr>
7446 <td class="hdlist1">
7447 <strong>commentaire</strong>
7448 <br />
7449 </td>
7450 <td class="hdlist2">
7451 <p style="margin-top: 0;">
7452 <span class=" LaTeX ">$
7453 :\&gt;e:\textcolor{#D2691E}{\textbf{\acute{e}criture}} →
7454 \textcolor{#D2691E}{\textbf{texte}}$</span>
7455 </p>
7456 </td>
7457 </tr>
7458 <tr>
7459 <td class="hdlist1">
7460 <strong>tags</strong>
7461 <br />
7462 </td>
7463 <td class="hdlist2">
7464 <p style="margin-top: 0;">
7465 <span class=" LaTeX ">$
7466 :\&gt;e:\textcolor{#D2691E}{\textbf{\acute{e}criture}} →
7467 \lbrack\textcolor{#D2691E}{\textbf{tag}}\rbrack
7468 \ =\ \textbf{tags}~(\textbf{commentaire}~e)$</span>
7469 </p>
7470 </td>
7471 </tr>
7472 <tr>
7473 <td class="hdlist1">
7474 <strong>flux</strong>
7475 <br />
7476 </td>
7477 <td class="hdlist2">
7478 <p style="margin-top: 0;">
7479 <span class=" LaTeX ">$
7480 :\&gt;e:\textcolor{#D2691E}{\textbf{\acute{e}criture}} →
7481 \lbrack\textcolor{#D2691E}{\textbf{flux}}\rbrack$</span>
7482 </p>
7483 </td>
7484 </tr>
7485 </tbody></table></div></div></td>
7486 </tr>
7487 <tr>
7488 <td align="left" valign="top"><div><div class="listingblock incremental">
7489 <div class="content"><pre>
7490 flux ::= compte <span class="Constant">&quot;␣␣&quot;</span> <span class="Constant">&quot;&quot;</span>* (<span class="Constant">&quot;-&quot;</span> crédit | débit) (<span class="Constant">&quot;&quot;</span>|<span class="Constant">&quot;&quot;</span>)* commentaire
7491 compte ::= nom ( <span class="Constant">&quot;:&quot;</span> nom )*
7492 nom ::= (· - (<span class="Constant">&quot;:&quot;</span>|<span class="Constant">&quot;&quot;</span>)) (· - (<span class="Constant">&quot;:&quot;</span>|<span class="Constant">&quot;&quot;</span>))*
7493 crédit ::= quantité
7494 débit ::= quantité
7495 </pre></div></div></div></td>
7496 <td align="left" valign="top"><div><div class="hdlist math"><table><tbody class=" incremental math">
7497 <tr>
7498 <td class="hdlist1">
7499 <strong>compte</strong>
7500 <br />
7501 </td>
7502 <td class="hdlist2">
7503 <p style="margin-top: 0;">
7504 <span class=" LaTeX ">$
7505 :\&gt;f:\textcolor{#D2691E}{\textbf{flux}} →
7506 \lbrack\textcolor{#D2691E}{\textbf{nom}}\rbrack$</span>
7507 </p>
7508 </td>
7509 </tr>
7510 <tr>
7511 <td class="hdlist1">
7512 <strong>montant</strong>
7513 <br />
7514 </td>
7515 <td class="hdlist2">
7516 <p style="margin-top: 0;">
7517 <span class=" LaTeX ">$
7518 :\&gt;f:\textcolor{#D2691E}{\textbf{flux}} → \textcolor{#D2691E}{ℚ} = \displaystyle{
7519 \left\{\begin{array}{ll} -~(\textbf{cr\acute{e}dit}~f) &amp; \mathit{\mbox{si défini}} \\
7520 (\textbf{d\acute{e}bit}~f) &amp; \mathit{\mbox{sinon}}
7521 \end{array}\right}$</span>
7522 </p>
7523 </td>
7524 </tr>
7525 <tr>
7526 <td class="hdlist1">
7527 <strong>tags</strong>
7528 <br />
7529 </td>
7530 <td class="hdlist2">
7531 <p style="margin-top: 0;">
7532 <span class=" LaTeX ">$
7533 :\&gt;f:\textcolor{#D2691E}{\textbf{flux}} →
7534 \lbrack\textcolor{#D2691E}{\textbf{tag}}\rbrack
7535 \ =\ \textbf{tags}~(\textbf{commentaire}~f)$</span>
7536 </p>
7537 </td>
7538 </tr>
7539 </tbody></table></div></div></td>
7540 </tr>
7541 <tr>
7542 <td align="left" valign="top"><div><div class="listingblock incremental">
7543 <div class="content"><pre>
7544 commentaire ::= ( <span class="Constant">&quot;;&quot;</span> (tag <span class="Constant">&quot;:&quot;</span> valeur? | ·)* )
7545 ( (<span class="Constant">&quot;&quot;</span>|<span class="Constant">&quot;&quot;</span>)* <span class="Constant">&quot;;&quot;</span> (tag <span class="Constant">&quot;:&quot;</span> valeur? | ·)* )*
7546 </pre></div></div></div></td>
7547 <td align="left" valign="top"><div><div class="hdlist math"><table><tbody class=" incremental math">
7548 <tr>
7549 <td class="hdlist1">
7550 <strong>tags</strong>
7551 <br />
7552 </td>
7553 <td class="hdlist2">
7554 <p style="margin-top: 0;">
7555 <span class=" LaTeX ">$
7556 :\&gt;m:\textcolor{#D2691E}{\textbf{commentaire}} →
7557 \lbrack\textcolor{#D2691E}{\textbf{tag}}\rbrack$</span>
7558 </p>
7559 </td>
7560 </tr>
7561 <tr>
7562 <td class="hdlist1">
7563 <strong>tag</strong>
7564 <br />
7565 </td>
7566 <td class="hdlist2">
7567 <p style="margin-top: 0;">
7568 <span class=" LaTeX ">$
7569 :\&gt;(\textcolor{#083194}{\textbf{tag}}:\textcolor{#D2691E}{\textbf{texte}},%
7570 ~\textcolor{#083194}{\textbf{valeur}}:\textcolor{#D2691E}{\textbf{\mbox{texte}}\&gt;?})$</span>
7571 </p>
7572 </td>
7573 </tr>
7574 </tbody></table></div></div></td>
7575 </tr>
7576 </tbody>
7577 </table>
7578 </div>
7579 <div class="admonitionblock incremental">
7580 <table><tr>
7581 <td class="icon">
7582 <img src="./icons/note.png" alt="Note" />
7583 </td>
7584 <td class="content">RTFM @ <a href="http://hledger.org/manual/">http://hledger.org/manual/</a>.</td>
7585 </tr></table>
7586 </div>
7587 </div></div>
7588 <script type="text/javascript">/*<![CDATA[*/if (slidefootnotes != ''){document.write("<hr/><p>"+slidefootnotes+"</p>");}/*]]>*/</script>
7589 </div><div class="slide">
7590
7591 <div class="sect2">
7592 <h1 id="_calculs">4.3. Calculs</h1>
7593 <script type="text/javascript">/*<![CDATA[*/subslide=1;nextclass="sect2";nexttitle="4.3. Calculs";slidefootnotes="";/*]]>*/</script>
7594 <div class="sectionbody">
7595 <div class="hdlist"><table><tbody class=" incremental">
7596 <tr>
7597 <td class="hdlist1">
7598 <strong>compte_parent</strong>
7599 <br />
7600 </td>
7601 <td class="hdlist2">
7602 <p style="margin-top: 0;">
7603 <span class=" LaTeX ">$:\&gt;c : \textcolor{#D2691E}{\textbf{compte}} → \textcolor{#D2691E}{\textbf{compte}}\&gt;?$</span><br />
7604 <span class=" LaTeX ">$=\&gt;c_{\lbrack0,\cdots,|c|-2\rbrack}\ \mbox{si}\ |c| \ge 2$</span>
7605 </p>
7606 </td>
7607 </tr>
7608 <tr>
7609 <td class="hdlist1">
7610 <strong>hiérarchie_de_compte</strong>
7611 <br />
7612 </td>
7613 <td class="hdlist2">
7614 <p style="margin-top: 0;">
7615 <span class=" LaTeX ">$:\&gt;\mathbb c : \textcolor{#D2691E}{\textbf{compte}} → \lbrack\textcolor{#D2691E}{\textbf{compte}}\rbrack$</span><br />
7616 <span class=" LaTeX ">$=\&gt;\lbrack{\ c\ :\ \lbrack{\ c\ |\ c ← (\mathbf{compte\mbox{_}parent}\&gt;{c})}\ \rbrack}\ \rbrack$</span>
7617 </p>
7618 </td>
7619 </tr>
7620 <tr>
7621 <td class="hdlist1">
7622 <strong>comptes</strong>
7623 <br />
7624 </td>
7625 <td class="hdlist2">
7626 <p style="margin-top: 0;">
7627 <span class=" LaTeX ">$:\&gt;\mathbb E : \lbrack\textcolor{#D2691E}{\textbf{\acute{e}criture}}\rbrack → \{\textcolor{#D2691E}{\textbf{compte}}\}$</span><br />
7628 <span class=" LaTeX ">$\{\ (\textbf{compte}\&gt;f)\ |\ f ← (\textbf{flux}\&gt;e)\ |\ e ← \mathbb E\ \}$</span>
7629 </p>
7630 </td>
7631 </tr>
7632 <tr>
7633 <td class="hdlist1">
7634 <strong>balance</strong>
7635 <br />
7636 </td>
7637 <td class="hdlist2">
7638 <p style="margin-top: 0;">
7639 <span class=" LaTeX ">$:\&gt;\mathbb F : \lbrack\textcolor{#D2691E}{\textbf{flux}}\rbrack → ℚ$</span><br />
7640 <span class=" LaTeX ">$=\&gt;{(\ m\ |\ m ← m + (\textbf{montant}\&gt;f)\ |\ f ← \mathbb F\ |\ m ← 0\ )$</span><br />
7641 </p>
7642 </td>
7643 </tr>
7644 <tr>
7645 <td class="hdlist1">
7646 <strong>solde_de_compte</strong>
7647 <br />
7648 </td>
7649 <td class="hdlist2">
7650 <p style="margin-top: 0;">
7651 <span class=" LaTeX ">$:\&gt;\mathbb E : \lbrack\textcolor{#D2691E}{\textbf{\acute{e}criture}}\rbrack → c : \textcolor{#D2691E}{\textbf{compte}} → ℚ$</span><br />
7652 <span class=" LaTeX ">$=\&gt;{\textbf{balance}\&gt;\lbrack{\ f\ |\ f ← (\textbf{flux}\&gt;e),\ c\&gt;≼\&gt;(\textbf{compte}\&gt;f)\ |\ e ← \mathbb E\ }\rbrack$</span><br />
7653 </p>
7654 </td>
7655 </tr>
7656 <tr>
7657 <td class="hdlist1">
7658 <strong>solde</strong>
7659 <br />
7660 </td>
7661 <td class="hdlist2">
7662 <p style="margin-top: 0;">
7663 <span class=" LaTeX ">$:\&gt;\mathbb E : \lbrack\textcolor{#D2691E}{\textbf{\acute{e}criture}}\rbrack →
7664 \lbrack\textcolor{#D2691E}{\textbf{flux}}\rbrack$</span><br />
7665 <span class=" LaTeX ">$=\&gt;\displaystyle{\left\lbrack
7666 \begin{array}{l}
7667 (\textcolor{#083194}{\textbf{compte}}=c´, \textcolor{#083194}{\textbf{montant}}=m) \\
7668 |\ m ← (\mathbf{\mbox{solde_de_compte}}\,\mathbb E\,c´) \\
7669 |\ c´ ← (\mathbf{hi\acute{e}rarchie\mbox{_}de\mbox{_}compte}\,c) \\
7670 |\ c ← (\mathbf{comptes}\,\mathbb E)
7671 \end{array}}\right\rbrack$</span>
7672 </p>
7673 </td>
7674 </tr>
7675 </tbody></table></div>
7676 </div></div>
7677 <script type="text/javascript">/*<![CDATA[*/if (slidefootnotes != ''){document.write("<hr/><p>"+slidefootnotes+"</p>");}/*]]>*/</script>
7678 </div><div class="slide">
7679
7680 <div class="sect2">
7681 <h1 id="_utiliser_un_éditeur_de_texte_structuré_code_vim_code">4.4. Utiliser un éditeur de texte structuré (<code>vim</code>)</h1>
7682 <script type="text/javascript">/*<![CDATA[*/subslide=1;nextclass="sect2";nexttitle="4.4. Utiliser un éditeur de texte structuré (<code>vim</code>)";slidefootnotes="";/*]]>*/</script>
7683 <div class="sectionbody">
7684 <div class="dlist"><dl class=" incremental">
7685 <dt class="hdlist1">
7686 Coloration syntaxique sur mesure
7687 </dt>
7688 <dd>
7689 <ul class=" incremental">
7690 <li>
7691 <span>
7692 <code>hledger.vim</code>
7693 </span>
7694 <div class="listingblock incremental">
7695 <div class="title">~/.vimrc</div>
7696 <div class="content"><pre>
7697 <span class="Statement">autocmd</span> <span class="Type">BufNewFile</span>,<span class="Type">BufRead</span> *.hledger,*.ledger <span class="Statement">setfiletype</span> hledger
7698 </pre></div></div>
7699 </li>
7700 </ul>
7701 </dd>
7702 <dt class="hdlist1">
7703 Complètement automatique des comptes (<code>&lt;Tab&gt;</code>)
7704 </dt>
7705 <dd>
7706 <ul class=" incremental">
7707 <li>
7708 <span>
7709 <a href="https://github.com/Shougo/neocomplete.vim">https://github.com/Shougo/neocomplete.vim</a>
7710 </span>
7711 </li>
7712 <li>
7713 <span>
7714 <a href="https://github.com/Shougo/neocomplcache.vim">https://github.com/Shougo/neocomplcache.vim</a>
7715 </span>
7716 <div class="listingblock incremental">
7717 <div class="title">~/.vimrc</div>
7718 <div class="content"><pre>
7719 <span class="Statement">autocmd</span> <span class="Type">Filetype</span> hledger <span class="Statement">set</span> <span class="PreProc">iskeyword</span>+=.<span class="Statement">,</span>38<span class="Statement">,</span>39<span class="Statement">,</span>40<span class="Statement">,</span>41<span class="Statement">,</span>44<span class="Statement">,</span>45<span class="Statement">,</span>58 &quot;
7720 </pre></div></div>
7721 </li>
7722 </ul>
7723 </dd>
7724 <dt class="hdlist1">
7725 Alignement automatique des montants
7726 </dt>
7727 <dd>
7728 <ul class=" incremental">
7729 <li>
7730 <span>
7731 <a href="https://github.com/junegunn/vim-easy-align">https://github.com/junegunn/vim-easy-align</a>
7732 </span>
7733 <div class="listingblock incremental">
7734 <div class="title">~/.vimrc</div>
7735 <div class="content"><pre>
7736 <span class="Statement">let</span> <span class="Identifier">g</span>:easy_align_ignore_groups <span class="Statement">=</span> [<span class="Constant">'Comment'</span>, <span class="Constant">'String'</span>, <span class="Constant">'hledgerTransaction'</span>]
7737 </pre></div></div>
7738 </li>
7739 </ul>
7740 </dd>
7741 </dl></div>
7742 </div></div>
7743 <script type="text/javascript">/*<![CDATA[*/if (slidefootnotes != ''){document.write("<hr/><p>"+slidefootnotes+"</p>");}/*]]>*/</script>
7744
7745 <div class="sect3">
7746 <h1 id="_suivre_les_modifications_à_plusieurs_et_ou_à_distance_code_git_code">4.4.1. Suivre les modifications à plusieurs et/ou à distance (<code>git</code>)</h1>
7747 <script type="text/javascript">/*<![CDATA[*/subslide=1;nextclass="sect3";nexttitle="4.4.1. Suivre les modifications à plusieurs et/ou à distance (<code>git</code>)";slidefootnotes="";/*]]>*/</script>
7748 <div class="sectionbody">
7749 <div class="paragraph">
7750 <div class="incremental">
7751 <p>TODO</p>
7752 </div>
7753 </div>
7754 </div></div>
7755 <script type="text/javascript">/*<![CDATA[*/if (slidefootnotes != ''){document.write("<hr/><p>"+slidefootnotes+"</p>");}/*]]>*/</script>
7756 </div><div class="slide">
7757
7758 <div class="sect1">
7759 <h1 id="_commandes_code_hledger_code">5. Commandes <code>hledger</code></h1>
7760 <script type="text/javascript">/*<![CDATA[*/subslide=1;nextclass="sect1";nexttitle="5. Commandes <code>hledger</code>";slidefootnotes="";/*]]>*/</script>
7761 <div class="sectionbody">
7762 </div></div>
7763 <script type="text/javascript">/*<![CDATA[*/if (slidefootnotes != ''){document.write("<hr/><p>"+slidefootnotes+"</p>");}/*]]>*/</script>
7764
7765 <div class="sect2">
7766 <h1 id="_calculer_des_soldes_code_balance_code">5.1. Calculer des soldes (<code>balance</code>)</h1>
7767 <script type="text/javascript">/*<![CDATA[*/subslide=1;nextclass="sect2";nexttitle="5.1. Calculer des soldes (<code>balance</code>)";slidefootnotes="";/*]]>*/</script>
7768 <div class="sectionbody">
7769 <div class="listingblock incremental">
7770 <div class="content"><pre>
7771 % hledger balance <span class="Special">-f</span> <span class="PreProc">$fichier</span>.ledger <span class="PreProc">$filtre</span>
7772 </pre></div></div>
7773 <div class="listingblock incremental">
7774 <div class="title">Suivi des comptes</div>
7775 <div class="content"><pre>
7776 % hledger balance <span class="Special">-b</span> <span class="Constant">2012</span>/<span class="Constant">02</span>/<span class="Constant">01</span> <span class="Special">-e</span> <span class="Constant">2012</span>/<span class="Constant">04</span>/<span class="Constant">30</span> <span class="Special">--monthly</span> <span class="Special">-f</span> <span class="PreProc">$fichier</span>.ledger <span class="Statement">&gt;</span>/tmp/bal.flow
7777 % hledger balance <span class="Special">-b</span> <span class="Constant">2012</span>/<span class="Constant">02</span>/<span class="Constant">01</span> <span class="Special">-e</span> <span class="Constant">2012</span>/<span class="Constant">04</span>/<span class="Constant">30</span> <span class="Special">--cumulative</span> <span class="Special">--monthly</span> <span class="Special">-f</span> <span class="PreProc">$fichier</span>.ledger <span class="Statement">&gt;</span>/tmp/bal.cumulative
7778 % hledger balance <span class="Special">-b</span> <span class="Constant">2012</span>/<span class="Constant">02</span>/<span class="Constant">01</span> <span class="Special">-e</span> <span class="Constant">2012</span>/<span class="Constant">04</span>/<span class="Constant">30</span> <span class="Special">--historical</span> <span class="Special">--monthly</span> <span class="Special">-f</span> <span class="PreProc">$fichier</span>.ledger <span class="Statement">&gt;</span>/tmp/bal.historical
7779 % gvimdiff <span class="Special">-o</span> /tmp/bal.<span class="Special">{</span>cumulative,historical<span class="Special">}</span>
7780 </pre></div></div>
7781 <div class="imageblock incremental">
7782 <div class="content">
7783 <img src="data/gvimdiff-cumulative-historical.png" alt="data/gvimdiff-cumulative-historical.png" />
7784 </div>
7785 </div>
7786 </div></div>
7787 <script type="text/javascript">/*<![CDATA[*/if (slidefootnotes != ''){document.write("<hr/><p>"+slidefootnotes+"</p>");}/*]]>*/</script>
7788
7789 <div class="sect2">
7790 <h1 id="_filtrer_des_écritures_code_print_code">5.2. Filtrer des écritures (<code>print</code>)</h1>
7791 <script type="text/javascript">/*<![CDATA[*/subslide=1;nextclass="sect2";nexttitle="5.2. Filtrer des écritures (<code>print</code>)";slidefootnotes="";/*]]>*/</script>
7792 <div class="sectionbody">
7793 <div class="paragraph">
7794 <div class="incremental">
7795 <p>TODO</p>
7796 </div>
7797 </div>
7798 </div></div>
7799 <script type="text/javascript">/*<![CDATA[*/if (slidefootnotes != ''){document.write("<hr/><p>"+slidefootnotes+"</p>");}/*]]>*/</script>
7800
7801 <div class="sect2">
7802 <h1 id="_suivre_un_compte_code_register_code">5.3. Suivre un compte (<code>register</code>)</h1>
7803 <script type="text/javascript">/*<![CDATA[*/subslide=1;nextclass="sect2";nexttitle="5.3. Suivre un compte (<code>register</code>)";slidefootnotes="";/*]]>*/</script>
7804 <div class="sectionbody">
7805 <div class="paragraph">
7806 <div class="incremental">
7807 <p>TODO</p>
7808 </div>
7809 </div>
7810 </div></div>
7811 <script type="text/javascript">/*<![CDATA[*/if (slidefootnotes != ''){document.write("<hr/><p>"+slidefootnotes+"</p>");}/*]]>*/</script>
7812
7813 <div class="sect2">
7814 <h1 id="_observer_des_statistiques_code_stats_code_code_activity_code">5.4. Observer des statistiques (<code>stats</code>, <code>activity</code>)</h1>
7815 <script type="text/javascript">/*<![CDATA[*/subslide=1;nextclass="sect2";nexttitle="5.4. Observer des statistiques (<code>stats</code>, <code>activity</code>)";slidefootnotes="";/*]]>*/</script>
7816 <div class="sectionbody">
7817 <div class="paragraph">
7818 <div class="incremental">
7819 <p>TODO</p>
7820 </div>
7821 </div>
7822 </div></div>
7823 <script type="text/javascript">/*<![CDATA[*/if (slidefootnotes != ''){document.write("<hr/><p>"+slidefootnotes+"</p>");}/*]]>*/</script>
7824 </div><div class="slide">
7825
7826 <div class="sect1">
7827 <h1 id="_exercice_comptable">6. Exercice comptable</h1>
7828 <script type="text/javascript">/*<![CDATA[*/subslide=1;nextclass="sect1";nexttitle="6. Exercice comptable";slidefootnotes="";/*]]>*/</script>
7829 <div class="sectionbody">
7830 </div></div>
7831 <script type="text/javascript">/*<![CDATA[*/if (slidefootnotes != ''){document.write("<hr/><p>"+slidefootnotes+"</p>");}/*]]>*/</script>
7832
7833 <div class="sect2">
7834 <h1 id="_plan_comptable_d_une_association">6.1. Plan comptable d’une association</h1>
7835 <script type="text/javascript">/*<![CDATA[*/subslide=1;nextclass="sect2";nexttitle="6.1. Plan comptable d’une association";slidefootnotes="";/*]]>*/</script>
7836 <div class="sectionbody">
7837 <ul class=" incremental">
7838 <li>
7839 <span>
7840 DOC : <a href="https://wiki.cyclocoop.org/Comptabilité/Document/Plan_comptable/">https://wiki.cyclocoop.org/Comptabilité/Document/Plan_comptable/</a>
7841 </span>
7842 </li>
7843 </ul>
7844 <div class="listingblock incremental">
7845 <div class="content"><pre>
7846 #include::data/Cyclofficine.Plan_comptable.hledger[]
7847 </pre></div></div>
7848 </div></div>
7849 <script type="text/javascript">/*<![CDATA[*/if (slidefootnotes != ''){document.write("<hr/><p>"+slidefootnotes+"</p>");}/*]]>*/</script>
7850 </div><div class="slide">
7851
7852 <div class="sect2">
7853 <h1 id="_comptabiliser_en_partie_double">6.2. Comptabiliser en partie double</h1>
7854 <script type="text/javascript">/*<![CDATA[*/subslide=1;nextclass="sect2";nexttitle="6.2. Comptabiliser en partie double";slidefootnotes="";/*]]>*/</script>
7855 <div class="sectionbody">
7856 <div class="dlist"><dl class=" incremental">
7857 <dt class="hdlist1">
7858 Solde nul de toute écriture
7859 </dt>
7860 <dd>
7861 <div class="dlist"><dl class=" incremental">
7862 <dt class="hdlist1">
7863 Pour toute écriture
7864 </dt>
7865 <dd>
7866 <p>
7867 Tout ce qui est <em>débité</em> (<code>+</code>) dans ses comptes<br />
7868 est forcément <em>crédité</em> (<code>-</code>) dans ses autres comptes.
7869 </p>
7870 <ul class=" incremental">
7871 <li>
7872 <span>
7873 <span class=" LaTeX ">$\forall e : \textcolor{#D2691E}{\textbf{\acute{e}criture}},
7874 \ \textbf{balance}\&gt;(\textbf{flux}\&gt;{e}) = 0$</span>
7875 </span>
7876 </li>
7877 </ul>
7878 </dd>
7879 </dl></div>
7880 </dd>
7881 <dt class="hdlist1">
7882 Relation de Chasles par écritures d’engagement et de paiement
7883 </dt>
7884 <dd>
7885 <div class="listingblock incremental">
7886 <div class="content"><pre>
7887 <span class="hledgerTransactionDate">01/01</span> <span class="hledgerTransactionDescription">Écriture d’engagement</span>
7888 <span class="hledgerPostingAccount"> </span><span class="hledgerNumber">7</span><span class="hledgerPostingAccount">.Produit</span><span class="hledgerAccountSeparator">:</span><span class="hledgerNumber">0</span><span class="hledgerPostingAccount">.Vente</span><span class="hledgerAccountSeparator">:</span><span class="hledgerNumber">1</span><span class="hledgerPostingAccount">.Produit_fini</span><span class="hledgerAccountSeparator">:</span><span class="hledgerNumber">1</span><span class="hledgerPostingAccount">.Vélo</span><span class="hledgerPostingAmount"> -</span><span class="hledgerNumber">80</span>
7889 <span class="hledgerPostingAccountOdd"> </span><span class="hledgerNumberOdd">5</span><span class="hledgerPostingAccountOdd">.Finance</span><span class="hledgerAccountSeparatorOdd">:</span><span class="hledgerNumberOdd">1</span><span class="hledgerPostingAccountOdd">.Etablissement</span><span class="hledgerAccountSeparatorOdd">:</span><span class="hledgerNumberOdd">1</span><span class="hledgerPostingAccountOdd">.Valeur</span><span class="hledgerAccountSeparatorOdd">:</span><span class="hledgerNumberOdd">2</span><span class="hledgerPostingAccountOdd">.Chèque_à_encaisser</span><span class="hledgerPostingAmountOdd"> </span><span class="hledgerNumberOdd">80</span>
7890
7891 <span class="hledgerTransactionDate">01/02</span> <span class="hledgerTransactionDescription">Écriture de paiement</span>
7892 <span class="hledgerPostingAccount"> </span><span class="hledgerNumber">5</span><span class="hledgerPostingAccount">.Finance</span><span class="hledgerAccountSeparator">:</span><span class="hledgerNumber">1</span><span class="hledgerPostingAccount">.Etablissement</span><span class="hledgerAccountSeparator">:</span><span class="hledgerNumber">1</span><span class="hledgerPostingAccount">.Valeur</span><span class="hledgerAccountSeparator">:</span><span class="hledgerNumber">2</span><span class="hledgerPostingAccount">.Chèque_à_encaisser</span><span class="hledgerPostingAmount"> -</span><span class="hledgerNumber">80</span>
7893 <span class="hledgerPostingAccountOdd"> </span><span class="hledgerNumberOdd">5</span><span class="hledgerPostingAccountOdd">.Finance</span><span class="hledgerAccountSeparatorOdd">:</span><span class="hledgerNumberOdd">1</span><span class="hledgerPostingAccountOdd">.Etablissement</span><span class="hledgerAccountSeparatorOdd">:</span><span class="hledgerNumberOdd">2</span><span class="hledgerPostingAccountOdd">.Banque</span><span class="hledgerAccountSeparatorOdd">:</span><span class="hledgerNumberOdd">001</span><span class="hledgerPostingAccountOdd">.Courant</span><span class="hledgerPostingAmountOdd"> </span><span class="hledgerNumberOdd">80</span>
7894 </pre></div></div>
7895 <div class="admonitionblock incremental">
7896 <table><tr>
7897 <td class="icon">
7898 <img src="./icons/note.png" alt="Note" />
7899 </td>
7900 <td class="content">pour des espèces, transiter par : <code>5.Finance:3.Caisse:1.Siège</code></td>
7901 </tr></table>
7902 </div>
7903 </dd>
7904 </dl></div>
7905 </div></div>
7906 <script type="text/javascript">/*<![CDATA[*/if (slidefootnotes != ''){document.write("<hr/><p>"+slidefootnotes+"</p>");}/*]]>*/</script>
7907 </div><div class="slide">
7908
7909 <div class="sect3">
7910 <h1 id="_soldes_nuls_souhaitables">6.2.1. Soldes nuls souhaitables</h1>
7911 <script type="text/javascript">/*<![CDATA[*/subslide=1;nextclass="sect3";nexttitle="6.2.1. Soldes nuls souhaitables";slidefootnotes="";/*]]>*/</script>
7912 <div class="sectionbody">
7913 <ul class=" incremental">
7914 <li>
7915 <span>
7916 Écritures des recettes
7917 </span>
7918 <ol class="arabic incremental">
7919 <li>
7920 <span>
7921 <span class=" LaTeX ">$\sum{\mbox{ventes}} + \sum{\mbox{dons}} = \sum{\mbox{espèces entrées en caisse}} + \sum{\mbox{Chèques à encaisser}}$</span><br />
7922 (Total des ventes + dons == Total d’espèces entrée en caisse + Chèques à encaisser (5112))
7923 </span>
7924 </li>
7925 <li>
7926 <span>
7927 Total chèques à encaisser (5112) == Total remises de chèques à la banque (512) (+/- argent non déposé en banque)
7928 </span>
7929 </li>
7930 <li>
7931 <span>
7932 Solde du compte caisse (531) == Total entrées espèces en caisse - Total des sorties (remises d’espèces en banque - sorties d’achats - erreur de caisse)
7933 </span>
7934 </li>
7935 <li>
7936 <span>
7937 Solde compte caisse (531) == Total entrées en caisse - Dépôt espèce en banque - Achat en espèce
7938 </span>
7939 </li>
7940 </ol>
7941 </li>
7942 <li>
7943 <span>
7944 Écritures de paye
7945 </span>
7946 <div class="paragraph">
7947 <div class="incremental">
7948 <p>TODO</p>
7949 </div>
7950 </div>
7951 </li>
7952 </ul>
7953 </div></div>
7954 <script type="text/javascript">/*<![CDATA[*/if (slidefootnotes != ''){document.write("<hr/><p>"+slidefootnotes+"</p>");}/*]]>*/</script>
7955 </div><div class="slide">
7956
7957 <div class="sect2">
7958 <h1 id="_journaux_filtres">6.3. Journaux (filtres)</h1>
7959 <script type="text/javascript">/*<![CDATA[*/subslide=1;nextclass="sect2";nexttitle="6.3. Journaux (filtres)";slidefootnotes="";/*]]>*/</script>
7960 <div class="sectionbody">
7961 <div class="hdlist"><table><tbody class=" incremental">
7962 <tr>
7963 <td class="hdlist1">
7964 <strong>Banque</strong>
7965 <br />
7966 </td>
7967 <td class="hdlist2">
7968 <div class="listingblock incremental">
7969 <div class="content"><pre>
7970 hledger <span class="Statement">print</span><span class="Constant"> -f </span><span class="PreProc">$fichier</span><span class="Constant">.ledger </span><span class="Statement">'</span><span class="Constant">^5.Finance:1.Etablissement:2.Banque:</span><span class="Statement">'</span>
7971 </pre></div></div>
7972 </td>
7973 </tr>
7974 <tr>
7975 <td class="hdlist1">
7976 <strong>Achats</strong>
7977 <br />
7978 </td>
7979 <td class="hdlist2">
7980 <div class="listingblock incremental">
7981 <div class="content"><pre>
7982 hledger <span class="Statement">print</span><span class="Constant"> -f </span><span class="PreProc">$fichier</span><span class="Constant">.ledger </span><span class="Statement">'</span><span class="Constant">^(2.Immobilisation:1.Corporelle:|6.Charge:(0.Achat|1.Service|2.Autre_service):)</span><span class="Statement">'</span>
7983 </pre></div></div>
7984 </td>
7985 </tr>
7986 <tr>
7987 <td class="hdlist1">
7988 <strong>Vente</strong>
7989 <br />
7990 </td>
7991 <td class="hdlist2">
7992 <div class="listingblock incremental">
7993 <div class="content"><pre>
7994 hledger <span class="Statement">print</span><span class="Constant"> -f </span><span class="PreProc">$fichier</span><span class="Constant">.ledger </span><span class="Statement">'</span><span class="Constant">^7.Produit:0.Vente:</span><span class="Statement">'</span>
7995 </pre></div></div>
7996 </td>
7997 </tr>
7998 <tr>
7999 <td class="hdlist1">
8000 <strong>Caisse</strong>
8001 <br />
8002 </td>
8003 <td class="hdlist2">
8004 <div class="listingblock incremental">
8005 <div class="content"><pre>
8006 hledger <span class="Statement">print</span><span class="Constant"> -f </span><span class="PreProc">$fichier</span><span class="Constant">.ledger </span><span class="Statement">'</span><span class="Constant">^5.Finance:3.Caisse:</span><span class="Statement">'</span>
8007 </pre></div></div>
8008 </td>
8009 </tr>
8010 <tr>
8011 <td class="hdlist1">
8012 <strong>Paye</strong>
8013 <br />
8014 </td>
8015 <td class="hdlist2">
8016 <div class="listingblock incremental">
8017 <div class="content"><pre>
8018 hledger <span class="Statement">print</span><span class="Constant"> -f </span><span class="PreProc">$fichier</span><span class="Constant">.ledger </span><span class="Statement">'</span><span class="Constant">6.Charge:(3.Impôt:(1.|3.):|4.Personnel:)</span><span class="Statement">'</span>
8019 </pre></div></div>
8020 </td>
8021 </tr>
8022 <tr>
8023 <td class="hdlist1">
8024 <strong>À NouVeaux</strong>
8025 <br />
8026 </td>
8027 <td class="hdlist2">
8028 <div class="listingblock incremental">
8029 <div class="content"><pre>
8030 hledger <span class="Statement">print</span><span class="Constant"> -f </span><span class="PreProc">$fichier</span><span class="Constant">.ledger tag:ANV</span>
8031 </pre></div></div>
8032 </td>
8033 </tr>
8034 <tr>
8035 <td class="hdlist1">
8036 <strong>Opération_Diverses</strong>
8037 <br />
8038 </td>
8039 <td class="hdlist2">
8040 <div class="listingblock incremental">
8041 <div class="content"><pre>
8042 hledger <span class="Statement">print</span><span class="Constant"> -f </span><span class="PreProc">$fichier</span><span class="Constant">.ledger tag:OD</span>
8043 </pre></div></div>
8044 </td>
8045 </tr>
8046 </tbody></table></div>
8047 </div></div>
8048 <script type="text/javascript">/*<![CDATA[*/if (slidefootnotes != ''){document.write("<hr/><p>"+slidefootnotes+"</p>");}/*]]>*/</script>
8049 </div><div class="slide">
8050
8051 <div class="sect2">
8052 <h1 id="_clôture_ouverture_code_equity_code">6.4. Clôture / Ouverture (<code>equity</code>)</h1>
8053 <script type="text/javascript">/*<![CDATA[*/subslide=1;nextclass="sect2";nexttitle="6.4. Clôture / Ouverture (<code>equity</code>)";slidefootnotes="";/*]]>*/</script>
8054 <div class="sectionbody">
8055 <div class="paragraph">
8056 <div class="incremental">
8057 <p><code>hledger-equity</code> calcule une balance de comptes
8058 et en fait deux écritures, respectivement :</p>
8059 </div>
8060 </div>
8061 <div class="hdlist"><table><tbody class=" incremental">
8062 <tr>
8063 <td class="hdlist1">
8064 de clôture
8065 <br />
8066 </td>
8067 <td class="hdlist2">
8068 <p style="margin-top: 0;">
8069 pour les solder à zéro en fin d’exercice ;
8070 </p>
8071 </td>
8072 </tr>
8073 <tr>
8074 <td class="hdlist1">
8075 d’ouverture
8076 <br />
8077 </td>
8078 <td class="hdlist2">
8079 <p style="margin-top: 0;">
8080 pour les réinitialiser à leur solde du précédent exercice.
8081 </p>
8082 </td>
8083 </tr>
8084 </tbody></table></div>
8085 <div class="listingblock incremental">
8086 <div class="content"><pre>
8087 % hledger-equity <span class="Special">-f</span> <span class="PreProc">$fichier</span>.ledger <span class="PreProc">$filtre</span>
8088 </pre></div></div>
8089 <div class="listingblock incremental">
8090 <div class="title">Solde des compte de gestion</div>
8091 <div class="content"><pre>
8092 % hledger-equity '^6' '^7' -f Paris.2011.hledger
8093 <span class="hledgerTransactionDate">2014/07/29</span>
8094 <span class="hledgerPostingAccount"> </span><span class="hledgerNumber">6</span><span class="hledgerPostingAccount">.Charge</span><span class="hledgerAccountSeparator">:</span><span class="hledgerNumber">0</span><span class="hledgerPostingAccount">.Achat</span><span class="hledgerAccountSeparator">:</span><span class="hledgerNumber">6</span><span class="hledgerPostingAccount">.Non_stocké</span><span class="hledgerAccountSeparator">:</span><span class="hledgerNumber">8</span><span class="hledgerPostingAccount">.Autre_Matière,Fourniture</span><span class="hledgerAccountSeparator">:</span><span class="hledgerNumber">1</span><span class="hledgerPostingAccount">.Atelier</span><span class="hledgerPostingAmount"> -</span><span class="hledgerNumber">248</span><span class="hledgerPostingAmount">,</span><span class="hledgerNumber">87</span><span class="hledgerPostingAmount"></span>
8095 <span class="hledgerPostingAccountOdd"> </span><span class="hledgerNumberOdd">6</span><span class="hledgerPostingAccountOdd">.Charge</span><span class="hledgerAccountSeparatorOdd">:</span><span class="hledgerNumberOdd">1</span><span class="hledgerPostingAccountOdd">.Service</span><span class="hledgerAccountSeparatorOdd">:</span><span class="hledgerNumberOdd">3</span><span class="hledgerPostingAccountOdd">.Location</span><span class="hledgerAccountSeparatorOdd">:</span><span class="hledgerNumberOdd">2</span><span class="hledgerPostingAccountOdd">.Immobilière</span><span class="hledgerPostingAmountOdd"> -</span><span class="hledgerNumberOdd">441</span><span class="hledgerPostingAmountOdd">,</span><span class="hledgerNumberOdd">46</span><span class="hledgerPostingAmountOdd"></span>
8096 <span class="hledgerPostingAccount"> </span><span class="hledgerNumber">6</span><span class="hledgerPostingAccount">.Charge</span><span class="hledgerAccountSeparator">:</span><span class="hledgerNumber">2</span><span class="hledgerPostingAccount">.Autre_service</span><span class="hledgerAccountSeparator">:</span><span class="hledgerNumber">3</span><span class="hledgerPostingAccount">.Communication</span><span class="hledgerAccountSeparator">:</span><span class="hledgerNumber">6</span><span class="hledgerPostingAccount">.Catalogue,Imprimé</span><span class="hledgerPostingAmount"> -</span><span class="hledgerNumber">24</span><span class="hledgerPostingAmount">,</span><span class="hledgerNumber">00</span><span class="hledgerPostingAmount"></span>
8097 <span class="hledgerPostingAccountOdd"> </span><span class="hledgerNumberOdd">6</span><span class="hledgerPostingAccountOdd">.Charge</span><span class="hledgerAccountSeparatorOdd">:</span><span class="hledgerNumberOdd">2</span><span class="hledgerPostingAccountOdd">.Autre_service</span><span class="hledgerAccountSeparatorOdd">:</span><span class="hledgerNumberOdd">7</span><span class="hledgerPostingAccountOdd">.Service_bancaire</span><span class="hledgerPostingAmountOdd"> -</span><span class="hledgerNumberOdd">31</span><span class="hledgerPostingAmountOdd">,</span><span class="hledgerNumberOdd">25</span><span class="hledgerPostingAmountOdd"></span>
8098 <span class="hledgerPostingAccount"> </span><span class="hledgerNumber">6</span><span class="hledgerPostingAccount">.Charge</span><span class="hledgerAccountSeparator">:</span><span class="hledgerNumber">5</span><span class="hledgerPostingAccount">.Gestion</span><span class="hledgerAccountSeparator">:</span><span class="hledgerNumber">8</span><span class="hledgerPostingAccount">.Divers</span><span class="hledgerAccountSeparator">:</span><span class="hledgerNumber">6</span><span class="hledgerPostingAccount">.Cotisation_(vie_statutaire)</span><span class="hledgerPostingAmount"> -</span><span class="hledgerNumber">25</span><span class="hledgerPostingAmount">,</span><span class="hledgerNumber">00</span><span class="hledgerPostingAmount"></span>
8099 <span class="hledgerPostingAccountOdd"> </span><span class="hledgerNumberOdd">7</span><span class="hledgerPostingAccountOdd">.Produit</span><span class="hledgerAccountSeparatorOdd">:</span><span class="hledgerNumberOdd">0</span><span class="hledgerPostingAccountOdd">.Vente</span><span class="hledgerAccountSeparatorOdd">:</span><span class="hledgerNumberOdd">6</span><span class="hledgerPostingAccountOdd">.Prest'action</span><span class="hledgerPostingAmountOdd"> </span><span class="hledgerNumberOdd">700</span><span class="hledgerPostingAmountOdd">,</span><span class="hledgerNumberOdd">00</span><span class="hledgerPostingAmountOdd"></span>
8100 <span class="hledgerPostingAccount"> </span><span class="hledgerNumber">7</span><span class="hledgerPostingAccount">.Produit</span><span class="hledgerAccountSeparator">:</span><span class="hledgerNumber">5</span><span class="hledgerPostingAccount">.Autre_gestion_courante</span><span class="hledgerAccountSeparator">:</span><span class="hledgerNumber">6</span><span class="hledgerPostingAccount">.Cotisation</span><span class="hledgerPostingAmount"> </span><span class="hledgerNumber">20</span><span class="hledgerPostingAmount">,</span><span class="hledgerNumber">00</span><span class="hledgerPostingAmount"></span>
8101 <span class="hledgerPostingAccountOdd"> </span><span class="hledgerNumberOdd">7</span><span class="hledgerPostingAccountOdd">.Produit</span><span class="hledgerAccountSeparatorOdd">:</span><span class="hledgerNumberOdd">5</span><span class="hledgerPostingAccountOdd">.Autre_gestion_courante</span><span class="hledgerAccountSeparatorOdd">:</span><span class="hledgerNumberOdd">8</span><span class="hledgerPostingAccountOdd">.Divers</span><span class="hledgerPostingAmountOdd"> </span><span class="hledgerNumberOdd">6</span><span class="hledgerPostingAmountOdd">,</span><span class="hledgerNumberOdd">00</span><span class="hledgerPostingAmountOdd"></span>
8102 <span class="hledgerPostingAccount"> equity</span><span class="hledgerAccountSeparator">:</span><span class="hledgerPostingAccount">closing balances</span><span class="hledgerPostingAmount"> </span><span class="hledgerNumber">44</span><span class="hledgerPostingAmount">,</span><span class="hledgerNumber">58</span><span class="hledgerPostingAmount"></span>
8103
8104 <span class="hledgerTransactionDate">2014/07/29</span>
8105 <span class="hledgerPostingAccount"> </span><span class="hledgerNumber">6</span><span class="hledgerPostingAccount">.Charge</span><span class="hledgerAccountSeparator">:</span><span class="hledgerNumber">0</span><span class="hledgerPostingAccount">.Achat</span><span class="hledgerAccountSeparator">:</span><span class="hledgerNumber">6</span><span class="hledgerPostingAccount">.Non_stocké</span><span class="hledgerAccountSeparator">:</span><span class="hledgerNumber">8</span><span class="hledgerPostingAccount">.Autre_Matière,Fourniture</span><span class="hledgerAccountSeparator">:</span><span class="hledgerNumber">1</span><span class="hledgerPostingAccount">.Atelier</span><span class="hledgerPostingAmount"> </span><span class="hledgerNumber">248</span><span class="hledgerPostingAmount">,</span><span class="hledgerNumber">87</span><span class="hledgerPostingAmount"></span>
8106 <span class="hledgerPostingAccountOdd"> </span><span class="hledgerNumberOdd">6</span><span class="hledgerPostingAccountOdd">.Charge</span><span class="hledgerAccountSeparatorOdd">:</span><span class="hledgerNumberOdd">1</span><span class="hledgerPostingAccountOdd">.Service</span><span class="hledgerAccountSeparatorOdd">:</span><span class="hledgerNumberOdd">3</span><span class="hledgerPostingAccountOdd">.Location</span><span class="hledgerAccountSeparatorOdd">:</span><span class="hledgerNumberOdd">2</span><span class="hledgerPostingAccountOdd">.Immobilière</span><span class="hledgerPostingAmountOdd"> </span><span class="hledgerNumberOdd">441</span><span class="hledgerPostingAmountOdd">,</span><span class="hledgerNumberOdd">46</span><span class="hledgerPostingAmountOdd"></span>
8107 <span class="hledgerPostingAccount"> </span><span class="hledgerNumber">6</span><span class="hledgerPostingAccount">.Charge</span><span class="hledgerAccountSeparator">:</span><span class="hledgerNumber">2</span><span class="hledgerPostingAccount">.Autre_service</span><span class="hledgerAccountSeparator">:</span><span class="hledgerNumber">3</span><span class="hledgerPostingAccount">.Communication</span><span class="hledgerAccountSeparator">:</span><span class="hledgerNumber">6</span><span class="hledgerPostingAccount">.Catalogue,Imprimé</span><span class="hledgerPostingAmount"> </span><span class="hledgerNumber">24</span><span class="hledgerPostingAmount">,</span><span class="hledgerNumber">00</span><span class="hledgerPostingAmount"></span>
8108 <span class="hledgerPostingAccountOdd"> </span><span class="hledgerNumberOdd">6</span><span class="hledgerPostingAccountOdd">.Charge</span><span class="hledgerAccountSeparatorOdd">:</span><span class="hledgerNumberOdd">2</span><span class="hledgerPostingAccountOdd">.Autre_service</span><span class="hledgerAccountSeparatorOdd">:</span><span class="hledgerNumberOdd">7</span><span class="hledgerPostingAccountOdd">.Service_bancaire</span><span class="hledgerPostingAmountOdd"> </span><span class="hledgerNumberOdd">31</span><span class="hledgerPostingAmountOdd">,</span><span class="hledgerNumberOdd">25</span><span class="hledgerPostingAmountOdd"></span>
8109 <span class="hledgerPostingAccount"> </span><span class="hledgerNumber">6</span><span class="hledgerPostingAccount">.Charge</span><span class="hledgerAccountSeparator">:</span><span class="hledgerNumber">5</span><span class="hledgerPostingAccount">.Gestion</span><span class="hledgerAccountSeparator">:</span><span class="hledgerNumber">8</span><span class="hledgerPostingAccount">.Divers</span><span class="hledgerAccountSeparator">:</span><span class="hledgerNumber">6</span><span class="hledgerPostingAccount">.Cotisation_(vie_statutaire)</span><span class="hledgerPostingAmount"> </span><span class="hledgerNumber">25</span><span class="hledgerPostingAmount">,</span><span class="hledgerNumber">00</span><span class="hledgerPostingAmount"></span>
8110 <span class="hledgerPostingAccountOdd"> </span><span class="hledgerNumberOdd">7</span><span class="hledgerPostingAccountOdd">.Produit</span><span class="hledgerAccountSeparatorOdd">:</span><span class="hledgerNumberOdd">0</span><span class="hledgerPostingAccountOdd">.Vente</span><span class="hledgerAccountSeparatorOdd">:</span><span class="hledgerNumberOdd">6</span><span class="hledgerPostingAccountOdd">.Prest'action</span><span class="hledgerPostingAmountOdd"> -</span><span class="hledgerNumberOdd">700</span><span class="hledgerPostingAmountOdd">,</span><span class="hledgerNumberOdd">00</span><span class="hledgerPostingAmountOdd"></span>
8111 <span class="hledgerPostingAccount"> </span><span class="hledgerNumber">7</span><span class="hledgerPostingAccount">.Produit</span><span class="hledgerAccountSeparator">:</span><span class="hledgerNumber">5</span><span class="hledgerPostingAccount">.Autre_gestion_courante</span><span class="hledgerAccountSeparator">:</span><span class="hledgerNumber">6</span><span class="hledgerPostingAccount">.Cotisation</span><span class="hledgerPostingAmount"> -</span><span class="hledgerNumber">20</span><span class="hledgerPostingAmount">,</span><span class="hledgerNumber">00</span><span class="hledgerPostingAmount"></span>
8112 <span class="hledgerPostingAccountOdd"> </span><span class="hledgerNumberOdd">7</span><span class="hledgerPostingAccountOdd">.Produit</span><span class="hledgerAccountSeparatorOdd">:</span><span class="hledgerNumberOdd">5</span><span class="hledgerPostingAccountOdd">.Autre_gestion_courante</span><span class="hledgerAccountSeparatorOdd">:</span><span class="hledgerNumberOdd">8</span><span class="hledgerPostingAccountOdd">.Divers</span><span class="hledgerPostingAmountOdd"> -</span><span class="hledgerNumberOdd">6</span><span class="hledgerPostingAmountOdd">,</span><span class="hledgerNumberOdd">00</span><span class="hledgerPostingAmountOdd"></span>
8113 <span class="hledgerPostingAccount"> equity</span><span class="hledgerAccountSeparator">:</span><span class="hledgerPostingAccount">opening balances</span><span class="hledgerPostingAmount"> -</span><span class="hledgerNumber">44</span><span class="hledgerPostingAmount">,</span><span class="hledgerNumber">58</span><span class="hledgerPostingAmount"></span>
8114 </pre></div></div>
8115 </div></div>
8116 <script type="text/javascript">/*<![CDATA[*/if (slidefootnotes != ''){document.write("<hr/><p>"+slidefootnotes+"</p>");}/*]]>*/</script>
8117 </div><div class="slide">
8118
8119 <div class="sect1">
8120 <h1 id="_import_et_export_avec_code_hledger_code">7. Import et export avec <code>hledger</code></h1>
8121 <script type="text/javascript">/*<![CDATA[*/subslide=1;nextclass="sect1";nexttitle="7. Import et export avec <code>hledger</code>";slidefootnotes="";/*]]>*/</script>
8122 <div class="sectionbody">
8123 <ul class=" incremental">
8124 <li>
8125 <span>
8126 <a href="https://github.com/eval/total_recall">https://github.com/eval/total_recall</a>
8127 </span>
8128 </li>
8129 <li>
8130 <span>
8131 <a href="https://github.com/quentinsf/icsv2ledger">https://github.com/quentinsf/icsv2ledger</a>
8132 </span>
8133 </li>
8134 </ul>
8135 </div></div>
8136 <script type="text/javascript">/*<![CDATA[*/if (slidefootnotes != ''){document.write("<hr/><p>"+slidefootnotes+"</p>");}/*]]>*/</script>
8137 </div><div class="slide">
8138
8139 <div class="sect2">
8140 <h1 id="_feuilles_de_calculs_des_documents_comptables">7.1. Feuilles de calculs des documents comptables</h1>
8141 <script type="text/javascript">/*<![CDATA[*/subslide=1;nextclass="sect2";nexttitle="7.1. Feuilles de calculs des documents comptables";slidefootnotes="";/*]]>*/</script>
8142 <div class="sectionbody">
8143 </div></div>
8144 <script type="text/javascript">/*<![CDATA[*/if (slidefootnotes != ''){document.write("<hr/><p>"+slidefootnotes+"</p>");}/*]]>*/</script>
8145
8146 <div class="sect3">
8147 <h1 id="_bilan_financier">7.1.1. Bilan financier</h1>
8148 <script type="text/javascript">/*<![CDATA[*/subslide=1;nextclass="sect3";nexttitle="7.1.1. Bilan financier";slidefootnotes="";/*]]>*/</script>
8149 <div class="sectionbody">
8150 <div class="paragraph">
8151 <div class="incremental">
8152 <p>TODO</p>
8153 </div>
8154 </div>
8155 </div></div>
8156 <script type="text/javascript">/*<![CDATA[*/if (slidefootnotes != ''){document.write("<hr/><p>"+slidefootnotes+"</p>");}/*]]>*/</script>
8157
8158 <div class="sect3">
8159 <h1 id="_comptes_de_résultats">7.1.2. Comptes de résultats</h1>
8160 <script type="text/javascript">/*<![CDATA[*/subslide=1;nextclass="sect3";nexttitle="7.1.2. Comptes de résultats";slidefootnotes="";/*]]>*/</script>
8161 <div class="sectionbody">
8162 <div class="paragraph">
8163 <div class="incremental">
8164 <p>TODO</p>
8165 </div>
8166 </div>
8167 </div></div>
8168 <script type="text/javascript">/*<![CDATA[*/if (slidefootnotes != ''){document.write("<hr/><p>"+slidefootnotes+"</p>");}/*]]>*/</script>
8169 </div><div class="slide">
8170
8171 <div class="sect1">
8172 <h1 id="_code_hledger_web_code">8. <code>hledger-web</code></h1>
8173 <script type="text/javascript">/*<![CDATA[*/subslide=1;nextclass="sect1";nexttitle="8. <code>hledger-web</code>";slidefootnotes="";/*]]>*/</script>
8174 <div class="sectionbody">
8175 <div class="paragraph">
8176 <div class="incremental">
8177 <p>TODO</p>
8178 </div>
8179 </div>
8180 </div></div>
8181 <script type="text/javascript">/*<![CDATA[*/if (slidefootnotes != ''){document.write("<hr/><p>"+slidefootnotes+"</p>");}/*]]>*/</script>
8182 </div><div class="slide">
8183
8184 <div class="sect1">
8185 <h1 id="_bonus_scripter_code_hledger_code">9. (bonus) Scripter <code>hledger</code></h1>
8186 <script type="text/javascript">/*<![CDATA[*/subslide=1;nextclass="sect1";nexttitle="9. (bonus) Scripter <code>hledger</code>";slidefootnotes="";/*]]>*/</script>
8187 <div class="sectionbody">
8188 <div class="paragraph">
8189 <div class="incremental">
8190 <p>TODO</p>
8191 </div>
8192 </div>
8193 </div></div>
8194 <script type="text/javascript">/*<![CDATA[*/if (slidefootnotes != ''){document.write("<hr/><p>"+slidefootnotes+"</p>");}/*]]>*/</script>
8195
8196 <div class="sect2">
8197 <h1 id="_installer_un_script_code_hledger_code">9.1. Installer un script <code>hledger</code></h1>
8198 <script type="text/javascript">/*<![CDATA[*/subslide=1;nextclass="sect2";nexttitle="9.1. Installer un script <code>hledger</code>";slidefootnotes="";/*]]>*/</script>
8199 <div class="sectionbody">
8200 <div class="listingblock incremental">
8201 <div class="content"><pre>
8202 % <span class="Statement">echo</span><span class="Constant"> </span><span class="Statement">'</span><span class="Constant">PATH=&quot;$HOME/src/hledger/extra:$PATH&quot;</span><span class="Statement">'</span><span class="Constant"> </span><span class="Statement">&gt;&gt;</span>~/.profile
8203 % <span class="Statement">exit</span> <span class="Comment"># NOTE: recharge ~/.profile</span>
8204 % ghc ~/src/hledger/extra/hledger-SCRIPT.hs
8205 </pre></div></div>
8206 </div></div>
8207 <script type="text/javascript">/*<![CDATA[*/if (slidefootnotes != ''){document.write("<hr/><p>"+slidefootnotes+"</p>");}/*]]>*/</script>
8208 </div><div class="slide">
8209
8210 <div class="sect1">
8211 <h1 id="_communauté">10. Communauté</h1>
8212 <script type="text/javascript">/*<![CDATA[*/subslide=1;nextclass="sect1";nexttitle="10. Communauté";slidefootnotes="";/*]]>*/</script>
8213 <div class="sectionbody">
8214 <div class="hdlist"><table><tbody class=" incremental">
8215 <tr>
8216 <td class="hdlist1">
8217 Chat
8218 <br />
8219 </td>
8220 <td class="hdlist2">
8221 <p style="margin-top: 0;">
8222 <a href="irc://irc.freenode.net#ledger">irc://irc.freenode.net#ledger</a>
8223 </p>
8224 </td>
8225 </tr>
8226 <tr>
8227 <td class="hdlist1">
8228 Liste
8229 <br />
8230 </td>
8231 <td class="hdlist2">
8232 <p style="margin-top: 0;">
8233 &lt;<a href="mailto:hledger+subscribe@googlegroups.com">hledger+subscribe@googlegroups.com</a>&gt;
8234 </p>
8235 </td>
8236 </tr>
8237 </tbody></table></div>
8238 <div class="background hledgersplash" style="position: absolute; left: 50%; top: 10%;">
8239 <div class="imageblock incremental">
8240 <div class="content">
8241 <img src="data/hledger.splash.png" alt="hledgersplash" />
8242 </div>
8243 </div>
8244 </div>
8245 <div id="footer" style="position: absolute; left: 5%; top: 80%; width: 90%;">
8246 <div id="footer-text">
8247 Version 6ca58eb<br />
8248 Dernière mise à jour 2014-07-29 21:47:32 CEST
8249 </div>
8250 </div>
8251 </div></div>
8252 <script type="text/javascript">/*<![CDATA[*/if (slidefootnotes != ''){document.write("<hr/><p>"+slidefootnotes+"</p>");}/*]]>*/</script>
8253 </div>
8254 <script type="text/javascript">
8255 /*<![CDATA[*/
8256 // move the div class="background" elements immediately
8257 // as document.body children
8258 var re = new RegExp("(^| )background\W*");
8259 var divs = document.body.getElementsByTagName("div");
8260 for (var i = (divs.length - 1); i >= 0 ; --i)
8261 {
8262 div = divs.item(i);
8263 if ( re.test(div.getAttribute("class")) )
8264 {
8265 div2 = div.cloneNode(true);
8266 div.parentNode.removeChild(div);
8267 document.body.appendChild(div2);
8268 }
8269 }
8270 /*]]>*/
8271 </script>
8272 </body>
8273 </html>