1[article Document To Test Formatting 2 [quickbook 1.4] 3 [copyright 2007 John Maddock, Joel de Guzman, Eric Niebler and Matias Capeletto] 4 [purpose Test Formatting Document] 5 [license 6 Distributed under the Boost Software License, Version 1.0. 7 (See accompanying file LICENSE_1_0.txt or copy at 8 [@http://www.boost.org/LICENSE_1_0.txt]) 9 ] 10 [authors [Maddock, John], [de Guzman, Joel], [Niebler, Eric], [Capeletto, Matias] ] 11 [category math] 12 [/last-revision $Date: 2007-05-07 10:21:52 +0100 (Mon, 07 May 2007) $] 13] 14 15[include HTML4_symbols.qbk] 16 17[/ Some composite templates] 18[template super[x]'''<superscript>'''[x]'''</superscript>'''] 19[template sub[x]'''<subscript>'''[x]'''</subscript>'''] 20[template floor[x]'''⌊'''[x]'''⌋'''] 21[template floorlr[x][lfloor][x][rfloor]] 22[template ceil[x] '''⌈'''[x]'''⌉'''] 23 24[section Introduction] 25 26This document is purely a test case to test out HTML and PDF generation and style. 27 28This is some body text. 29 30 int main() 31 { 32 double d = 2.345; 33 return d; 34 } 35 36We can count in Greek too: [alpha], [beta], [gamma]. 37 38Try some superscrips and subscripts: x[super 2], x[sub i][super 3], [alpha][super 2], 39[beta][super [alpha]], [floor x], [floor [alpha]], [ceil a]. 40 41[endsect] 42 43[section Code Blocks] 44 45[section Embedded code] 46 47These should be syntax highlighted: 48 49 #include <iostream> 50 51 int main() 52 { 53 // Sample code 54 std::cout << "Hello, World\n"; 55 return 0; 56 } 57 58[endsect] 59 60[section Code With a Very Long Line] 61 62 template <class RealType> RealType inline foo(const RealType& a, const RealType& b, const RealType& c, const RealType& d, const RealType& e, const RealType& f, const RealType& g, const RealType& h){ return 0; } 63 64[endsect] 65 66[section Imported code and callouts] 67 68[import stub.cpp] 69 70Here's some code with left-placed callouts: 71 72[class_] 73 74And again with callouts placed exactly where we put them: 75 76[foo_bar] 77 78[endsect] 79 80[section Larger example] 81 82Now let's include a larger example, this may span several pages 83and should not be chopped off half way through... some FO processors 84get this wrong! 85 86 namespace boost{ 87 88 template <class BidirectionalIterator> 89 class sub_match; 90 91 typedef sub_match<const char*> csub_match; 92 typedef sub_match<const wchar_t*> wcsub_match; 93 typedef sub_match<std::string::const_iterator> ssub_match; 94 typedef sub_match<std::wstring::const_iterator> wssub_match; 95 96 template <class BidirectionalIterator> 97 class sub_match : public std::pair<BidirectionalIterator, BidirectionalIterator> 98 { 99 public: 100 typedef typename iterator_traits<BidirectionalIterator>::value_type value_type; 101 typedef typename iterator_traits<BidirectionalIterator>::difference_type difference_type; 102 typedef BidirectionalIterator iterator; 103 104 bool matched; 105 106 difference_type length()const; 107 operator basic_string<value_type>()const; 108 basic_string<value_type> str()const; 109 110 int compare(const sub_match& s)const; 111 int compare(const basic_string<value_type>& s)const; 112 int compare(const value_type* s)const; 113 #ifdef BOOST_REGEX_MATCH_EXTRA 114 typedef implementation-private capture_sequence_type; 115 const capture_sequence_type& captures()const; 116 #endif 117 }; 118 // 119 // comparisons to another sub_match: 120 // 121 template <class BidirectionalIterator> 122 bool operator == (const sub_match<BidirectionalIterator>& lhs, 123 const sub_match<BidirectionalIterator>& rhs); 124 template <class BidirectionalIterator> 125 bool operator != (const sub_match<BidirectionalIterator>& lhs, 126 const sub_match<BidirectionalIterator>& rhs); 127 template <class BidirectionalIterator> 128 bool operator < (const sub_match<BidirectionalIterator>& lhs, 129 const sub_match<BidirectionalIterator>& rhs); 130 template <class BidirectionalIterator> 131 bool operator <= (const sub_match<BidirectionalIterator>& lhs, 132 const sub_match<BidirectionalIterator>& rhs); 133 template <class BidirectionalIterator> 134 bool operator >= (const sub_match<BidirectionalIterator>& lhs, 135 const sub_match<BidirectionalIterator>& rhs); 136 template <class BidirectionalIterator> 137 bool operator > (const sub_match<BidirectionalIterator>& lhs, 138 const sub_match<BidirectionalIterator>& rhs); 139 140 141 // 142 // comparisons to a basic_string: 143 // 144 template <class BidirectionalIterator, class traits, class Allocator> 145 bool operator == (const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, 146 traits, 147 Allocator>& lhs, 148 const sub_match<BidirectionalIterator>& rhs); 149 template <class BidirectionalIterator, class traits, class Allocator> 150 bool operator != (const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, 151 traits, 152 Allocator>& lhs, 153 const sub_match<BidirectionalIterator>& rhs); 154 template <class BidirectionalIterator, class traits, class Allocator> 155 bool operator < (const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, 156 traits, 157 Allocator>& lhs, 158 const sub_match<BidirectionalIterator>& rhs); 159 template <class BidirectionalIterator, class traits, class Allocator> 160 bool operator > (const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, 161 traits, 162 Allocator>& lhs, 163 const sub_match<BidirectionalIterator>& rhs); 164 template <class BidirectionalIterator, class traits, class Allocator> 165 bool operator >= (const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, 166 traits, 167 Allocator>& lhs, 168 const sub_match<BidirectionalIterator>& rhs); 169 template <class BidirectionalIterator, class traits, class Allocator> 170 bool operator <= (const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, 171 traits, 172 Allocator>& lhs, 173 const sub_match<BidirectionalIterator>& rhs); 174 175 template <class BidirectionalIterator, class traits, class Allocator> 176 bool operator == (const sub_match<BidirectionalIterator>& lhs, 177 const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, 178 traits, 179 Allocator>& rhs); 180 template <class BidirectionalIterator, class traits, class Allocator> 181 bool operator != (const sub_match<BidirectionalIterator>& lhs, 182 const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, 183 traits, 184 Allocator>& rhs); 185 template <class BidirectionalIterator, class traits, class Allocator> 186 bool operator < (const sub_match<BidirectionalIterator>& lhs, 187 const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, 188 traits, 189 Allocator>& rhs); 190 template <class BidirectionalIterator, class traits, class Allocator> 191 bool operator > (const sub_match<BidirectionalIterator>& lhs, 192 const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, 193 traits, 194 Allocator>& rhs); 195 template <class BidirectionalIterator, class traits, class Allocator> 196 bool operator >= (const sub_match<BidirectionalIterator>& lhs, 197 const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, 198 traits, 199 Allocator>& rhs); 200 template <class BidirectionalIterator, class traits, class Allocator> 201 bool operator <= (const sub_match<BidirectionalIterator>& lhs, 202 const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, 203 traits, 204 Allocator>& rhs); 205 206 // 207 // comparisons to a pointer to a character array: 208 // 209 template <class BidirectionalIterator> 210 bool operator == (typename iterator_traits<BidirectionalIterator>::value_type const* lhs, 211 const sub_match<BidirectionalIterator>& rhs); 212 template <class BidirectionalIterator> 213 bool operator != (typename iterator_traits<BidirectionalIterator>::value_type const* lhs, 214 const sub_match<BidirectionalIterator>& rhs); 215 template <class BidirectionalIterator> 216 bool operator < (typename iterator_traits<BidirectionalIterator>::value_type const* lhs, 217 const sub_match<BidirectionalIterator>& rhs); 218 template <class BidirectionalIterator> 219 bool operator > (typename iterator_traits<BidirectionalIterator>::value_type const* lhs, 220 const sub_match<BidirectionalIterator>& rhs); 221 template <class BidirectionalIterator> 222 bool operator >= (typename iterator_traits<BidirectionalIterator>::value_type const* lhs, 223 const sub_match<BidirectionalIterator>& rhs); 224 template <class BidirectionalIterator> 225 bool operator <= (typename iterator_traits<BidirectionalIterator>::value_type const* lhs, 226 const sub_match<BidirectionalIterator>& rhs); 227 228 template <class BidirectionalIterator> 229 bool operator == (const sub_match<BidirectionalIterator>& lhs, 230 typename iterator_traits<BidirectionalIterator>::value_type const* rhs); 231 template <class BidirectionalIterator> 232 bool operator != (const sub_match<BidirectionalIterator>& lhs, 233 typename iterator_traits<BidirectionalIterator>::value_type const* rhs); 234 template <class BidirectionalIterator> 235 bool operator < (const sub_match<BidirectionalIterator>& lhs, 236 typename iterator_traits<BidirectionalIterator>::value_type const* rhs); 237 template <class BidirectionalIterator> 238 bool operator > (const sub_match<BidirectionalIterator>& lhs, 239 typename iterator_traits<BidirectionalIterator>::value_type const* rhs); 240 template <class BidirectionalIterator> 241 bool operator >= (const sub_match<BidirectionalIterator>& lhs, 242 typename iterator_traits<BidirectionalIterator>::value_type const* rhs); 243 template <class BidirectionalIterator> 244 bool operator <= (const sub_match<BidirectionalIterator>& lhs, 245 typename iterator_traits<BidirectionalIterator>::value_type const* rhs); 246 247 // 248 // comparisons to a single character: 249 // 250 template <class BidirectionalIterator> 251 bool operator == (typename iterator_traits<BidirectionalIterator>::value_type const& lhs, 252 const sub_match<BidirectionalIterator>& rhs); 253 template <class BidirectionalIterator> 254 bool operator != (typename iterator_traits<BidirectionalIterator>::value_type const& lhs, 255 const sub_match<BidirectionalIterator>& rhs); 256 template <class BidirectionalIterator> 257 bool operator < (typename iterator_traits<BidirectionalIterator>::value_type const& lhs, 258 const sub_match<BidirectionalIterator>& rhs); 259 template <class BidirectionalIterator> 260 bool operator > (typename iterator_traits<BidirectionalIterator>::value_type const& lhs, 261 const sub_match<BidirectionalIterator>& rhs); 262 template <class BidirectionalIterator> 263 bool operator >= (typename iterator_traits<BidirectionalIterator>::value_type const& lhs, 264 const sub_match<BidirectionalIterator>& rhs); 265 template <class BidirectionalIterator> 266 bool operator <= (typename iterator_traits<BidirectionalIterator>::value_type const& lhs, 267 const sub_match<BidirectionalIterator>& rhs); 268 269 template <class BidirectionalIterator> 270 bool operator == (const sub_match<BidirectionalIterator>& lhs, 271 typename iterator_traits<BidirectionalIterator>::value_type const& rhs); 272 template <class BidirectionalIterator> 273 bool operator != (const sub_match<BidirectionalIterator>& lhs, 274 typename iterator_traits<BidirectionalIterator>::value_type const& rhs); 275 template <class BidirectionalIterator> 276 bool operator < (const sub_match<BidirectionalIterator>& lhs, 277 typename iterator_traits<BidirectionalIterator>::value_type const& rhs); 278 template <class BidirectionalIterator> 279 bool operator > (const sub_match<BidirectionalIterator>& lhs, 280 typename iterator_traits<BidirectionalIterator>::value_type const& rhs); 281 template <class BidirectionalIterator> 282 bool operator >= (const sub_match<BidirectionalIterator>& lhs, 283 typename iterator_traits<BidirectionalIterator>::value_type const& rhs); 284 template <class BidirectionalIterator> 285 bool operator <= (const sub_match<BidirectionalIterator>& lhs, 286 typename iterator_traits<BidirectionalIterator>::value_type const& rhs); 287 // 288 // addition operators: 289 // 290 template <class BidirectionalIterator, class traits, class Allocator> 291 std::basic_string<typename iterator_traits<BidirectionalIterator>::value_type, traits, Allocator> 292 operator + (const std::basic_string<typename iterator_traits<BidirectionalIterator>::value_type, 293 traits, 294 Allocator>& s, 295 const sub_match<BidirectionalIterator>& m); 296 template <class BidirectionalIterator, class traits, class Allocator> 297 std::basic_string<typename iterator_traits<BidirectionalIterator>::value_type, traits, Allocator> 298 operator + (const sub_match<BidirectionalIterator>& m, 299 const std::basic_string<typename iterator_traits<BidirectionalIterator>::value_type, 300 traits, 301 Allocator>& s); 302 template <class BidirectionalIterator> 303 std::basic_string<typename iterator_traits<BidirectionalIterator>::value_type> 304 operator + (typename iterator_traits<BidirectionalIterator>::value_type const* s, 305 const sub_match<BidirectionalIterator>& m); 306 template <class BidirectionalIterator> 307 std::basic_string<typename iterator_traits<BidirectionalIterator>::value_type> 308 operator + (const sub_match<BidirectionalIterator>& m, 309 typename iterator_traits<BidirectionalIterator>::value_type const * s); 310 template <class BidirectionalIterator> 311 std::basic_string<typename iterator_traits<BidirectionalIterator>::value_type> 312 operator + (typename iterator_traits<BidirectionalIterator>::value_type const& s, 313 const sub_match<BidirectionalIterator>& m); 314 template <class BidirectionalIterator> 315 std::basic_string<typename iterator_traits<BidirectionalIterator>::value_type> 316 operator + (const sub_match<BidirectionalIterator>& m, 317 typename iterator_traits<BidirectionalIterator>::value_type const& s); 318 template <class BidirectionalIterator> 319 std::basic_string<typename iterator_traits<BidirectionalIterator>::value_type> 320 operator + (const sub_match<BidirectionalIterator>& m1, 321 const sub_match<BidirectionalIterator>& m2); 322 323 // 324 // stream inserter: 325 // 326 template <class charT, class traits, class BidirectionalIterator> 327 basic_ostream<charT, traits>& 328 operator << (basic_ostream<charT, traits>& os, 329 const sub_match<BidirectionalIterator>& m); 330 331 } // namespace boost 332 333[endsect] 334 335[endsect] 336 337[section Basic Formatting] 338 339[section Font Styles] 340 341Here we go with some inline formatting: 342['italic], [*bold], [_underline], [^teletype], [-strikethrough], 343we can combine styles as well: ['[*bold italic]], [_[^teletype with underline]]. 344 345[endsect] 346 347[section Replaceable Text] 348 349Text that is intended to be user-replaceable is [~rendered like this]. 350 351[endsect] 352 353[section Quotations] 354 355Here we go: ["A question that sometimes drives me hazy: am I or are the others crazy?]--Einstein 356 357Note the proper left and right quote marks. Also, while you can simply use ordinary quote marks like "quoted", our quotation, above, will generate correct DocBook quotations (e.g. <quote>quoted</quote>). 358 359Like all phrase elements, quotations may be nested. Example: 360 361["Here's the rule for bargains: ["Do other men, for they would do you.] That's 362the true business precept.] 363 364[endsect] 365 366[section Inline Code] 367 368This text has inlined code `int main() { return 0; }` in it. 369The code should be syntax highlighted. 370 371[endsect] 372 373[section Links] 374 375Try this: [@http://www.boost.org this is [*boost's] website....] it should 376be visible as a link. 377 378This is [@../../../boost/math/distributions.hpp a link to a header file (boost/math/distributions.hpp)], 379it should be rewritable and point to the website when built as a PDF. 380 381This is [@boost:libs/regex/index.html a link to another library's documentation (Boost.Regex)], using the boost: protocol, 382it should be rewritten to point to the website when building a PDF. 383 384This is [@boost:/libs/regex/index.html a link to another library's documentation (Boost.Regex)], using the boost:/ protocol, 385it should be rewritten to point to the website when building a PDF. 386 387This is [@../weighted_tail_quantile.hpp a relative link to a header file within the test source], 388it should be rewritten to point to the website when building a PDF. 389Although it might be on the website yet. 390 391[endsect] 392 393[section Footnotes] 394 395Here's one [footnote A sample footnote]. 396 397And here's another [footnote Another sample footnote]. 398 399[endsect] 400 401[section Blockquote] 402 403Lets indent the next paragraph: 404 405[:Here we go!!!] 406 407[endsect] 408 409[section Headings] 410 411Now try rendering some heading styles: 412 413[h1 Heading 1] 414 415[h2 Heading 2] 416 417[h3 Heading 3] 418 419[h4 Heading 4] 420 421[h5 Heading 5] 422 423[h6 Heading 6] 424 425[endsect] 426 427[endsect] 428 429[section Blurbs] 430 431[section Preformatted text] 432 433Here's some sample program output: 434 435[pre 436'''F test for equal standard deviations 437____________________________________ 438 439Sample 1: 440Number of Observations = 240 441Sample Standard Deviation = 65.549 442 443Sample 2: 444Number of Observations = 240 445Sample Standard Deviation = 61.854 446 447Test Statistic = 1.123 448 449CDF of test statistic: = 8.148e-001 450Upper Critical Value at alpha: = 1.238e+000 451Upper Critical Value at alpha/2: = 1.289e+000 452Lower Critical Value at alpha: = 8.080e-001 453Lower Critical Value at alpha/2: = 7.756e-001 454 455Results for Alternative Hypothesis and alpha = 0.0500 456 457Alternative Hypothesis Conclusion 458Standard deviations are unequal (two sided test) REJECTED 459Standard deviation 1 is less than standard deviation 2 REJECTED 460Standard deviation 1 is greater than standard deviation 2 REJECTED''' 461] 462 463[endsect] 464 465[section Admonishments] 466 467There are four admonishments supported by Docbook XML: 468 469[note This is a note] 470 471[tip This is a tip] 472 473[important This is important] 474 475[caution This is a caution] 476 477[warning This is a warning 478 479They can contain more than one paragraph. 480] 481 482[endsect] 483 484[section Blurbs] 485 486[blurb [*An eye catching advertisement or note...] 487 488These should be rendered in a manner similar to admonishments. 489 490They can contain more than one paragraph. 491] 492 493[endsect] 494 495[endsect] 496 497[section Lists and Tables] 498 499[section Lists] 500 501A numbered list: 502 503# One 504# Two 505# Three 506 # Three.a 507 # Three.b 508 # Three.c 509# Four 510 # Four.a 511 # Four.a.i 512 # Four.a.ii 513# Five 514 515An unordered list: 516 517* First 518* Second 519* Third 520 521A mixture of the two: 522 523# 1 524 * 1.a 525 # 1.a.1 526 # 1.a.2 527 * 1.b 528# 2 529 * 2.a 530 * 2.b 531 # 2.b.1 532 # 2.b.2 533 * 2.b.2.a 534 * 2.b.2.b 535 536 537[endsect] 538 539[section Variable Lists] 540 541[variablelist A Variable List 542 [[term 1] [The definition of term 1]] 543 [[term 2] [The definition of term 2]] 544 [[term 3] [The definition of term 3]] 545] 546 547[endsect] 548 549[section Tables] 550 551Here's a big table with code and other tricky things: 552 553[table Notes on the Implementation of the Beta Distribution 554[[Function][Implementation Notes]] 555[[pdf] 556 [f(x;[alpha],[beta]) = x[super[alpha] - 1] (1 - x)[super[beta] -1] / B([alpha], [beta]) 557 558 Implemented using ibeta_derivative(a, b, x).]] 559 560[[cdf][Using the incomplete beta function ibeta(a, b, x)]] 561[[cdf complement][ibetac(a, b, x)]] 562[[quantile][Using the inverse incomplete beta function ibeta_inv(a, b, p)]] 563[[quantile from the complement][ibetac_inv(a, b, q)]] 564[[mean][`a/(a+b)`]] 565[[variance][`a * b / (a+b)^2 * (a + b + 1)`]] 566[[mode][`(a-1) / (a + b + 2)`]] 567[[skewness][`2 (b-a) sqrt(a+b+1)/(a+b+2) * sqrt(a * b)`]] 568[[kurtosis excess][ [$images/beta_dist_kurtosis.png] ]] 569[[kurtosis][`kurtosis + 3`]] 570[[parameter estimation][ ]] 571[[alpha 572 573 from mean and variance][`mean * (( (mean * (1 - mean)) / variance)- 1)`]] 574[[beta 575 576 from mean and variance][`(1 - mean) * (((mean * (1 - mean)) /variance)-1)`]] 577[[The member functions `estimate_alpha` and `estimate_beta` 578 579 from cdf and probability x 580 581 and *either* `alpha` or `beta`] 582 [Implemented in terms of the inverse incomplete beta functions 583 584ibeta_inva, and ibeta_invb respectively.]] 585[[`estimate_alpha`][`ibeta_inva(beta, x, probability)`]] 586[[`estimate_beta`][`ibeta_invb(alpha, x, probability)`]] 587] 588 589[endsect] 590 591[endsect] 592 593[section Images] 594 595These are tricky enough that they warrent their own section. 596 597Let's start with a PNG file that's set to 120dpi, it should render at 598a sensible size in both html and PDF forms. It should print OK too! 599 600[$images/digamma3.png] 601 602Now try again with a sample SVG image: 603 604[$images/open_clipart_library_logo.svg] 605 606 607[endsect] 608 609[section Equations] 610 611This page is largely to test equation handling in various browsers, unfortunately none of this works as well as it should (or at all?) 612in Internet Explorer.... 613 614This equation is formatted from Latex text: 615 616'''<inlinemediaobject><textobject role="tex">ax^2 + bx + c = 0</textobject></inlinemediaobject>''' 617 618This equation is formed from MathML: 619 620'''<inlinemediaobject><textobject role="MathML"><?dbhtml-include href="test.mml"?></textobject></inlinemediaobject>''' 621 622This equation is SVG: 623 624'''<inlinemediaobject><imageobject><imagedata format="SVG" fileref="../test.svg"></imagedata></imageobject></inlinemediaobject>''' 625 626 627[endsect] 628 629[include test_HTML4_symbols.qbk] 630 631[include remez.qbk] 632 633[section:array Array Example Boostbook XML Documentation] 634[xinclude array.xml] 635[xinclude array1.xml] 636[xinclude array2.xml] 637[xinclude array3.xml] 638[xinclude array4.xml] 639[endsect] 640 641[section:accumulators Accumulators Example Doxygen Documentation] 642[xinclude statsdoc.xml] 643[endsect] 644 645 646 647