Here are two lines that make up a block quote for testing emphasized words and boldface words, also with hypens: pre-fix, post-fix, pre-fix, post-fix.Here are two references. Equation (12) is fine. Eq. (12) too. Even Equation (12) without the tilde. This equation appears in another part if this document is split. Let us add a paragraph to test that HTML, with WordPress (
--wordpress
option)
can handle linebreaks
correctly,
even when lines begin with
bold words and
verbatim words
in
red color, and
links as well as math:
\( 1+1=2 \).
Test also that emphasize
at the end of line, and bold
works, as well as color
and links2
and verbatim
as well.
subroutine test()
integer i
real*8 r
r = 0
do i = 1, i
r = r + i
end do
return
C END1
program testme
call test()
return
subroutine test()
integer i
real*8 r
r = 0
do i = 1, i
r = r + i
end do
return
envir=ccq
):
Testing other code environments. First Python:C a comment subroutine test() integer i real*8 r r = 0 do i = 1, i r = r + i end do return C END1 program testme call test() return
!bc pycod
def f(x):
return x+1
!ec
def f(x):
return x+1
import sys
sys.path.insert(0, os.pardir)
def h(z):
return z+1
>>> from numpy import linspace, sin
>>> # Some comment
>>> x = linspace(0, 2, 11)
>>> y = sin(x)
>>> y[0]
0
>>> import matplotlib.pyplot as plt
>>> plt.plot(x, y)
In [1]: from numpy import linspace, sin
In [2]: # Some comment
In [3]: x = linspace(0, 2, 11)
In [4]: y = sin(x)
In [5]: y[0]
Out[5]: 0
In [6]: import matplotlib.pyplot as plt
In [7]: plt.plot(x, y)
In [8]: a='multiple-\nline\noutput'
In [9]: a
Out[9]: 'multiple-\nline\noutput'
In [10]: print(a)
multiple-
line
output
pyshell-t
.
>>> from numpy import linspace, sin
>>> # Some comment
>>> x = linspace(0, 2, 11)
>>> y = sin(x)
>>> y[0]
0
>>> import matplotlib.pyplot as plt
>>> plt.plot(x, y)
#include <iostream>
int main()
{
std::cout << "Sample output" << std::endl;
return 0
}
!bc cod
subroutine midpt(x, length, a, b)
real*8 a, b, x
x = (a + b)/2
length = b - a
return
end
!ec
subroutine midpt(x, length, a, b)
real*8 a, b, x
x = (a + b)/2
length = b - a
return
end
<table>
<tr><td>Column 1</td><td>Column 2</td></tr>
<tr><td>0.67526 </td><td>0.92871 </td></tr>
<!-- comment -->
</table>
<a href="
(which can destroy the following text if not properly
quoted).
Matlab with comments requires special typesetting:
% Comment on the beginning of the line can be escaped by %%
if a > b
% Indented comment needs this trick
c = a + b
end
Terminal> mkdir test
Terminal> cd test
Terminal> myprog -f
output1
output2
!bc restructuredtext
=======
Heading
=======
Some text.
!ec
=======
Heading
=======
Some text.
!bc do
supports highlighting of DocOnce source:
======= DocOnce test file =======
===== Computer code =====
Inline verbatim code, as in `import numpy as np`, is allowed, as well as
code blocks:
!bc pycod
from math import sin
def f(x):
"""Example on a function."""
return sin(x) + 1
print(f(0))
!ec
===== Mathematics =====
Formulas can be inline, as in $\nabla\cdot\boldsymbol{u} = 0$, or typeset
as equations:
!bt
\begin{align*}
\nabla\cdot\boldsymbol{u} &= 0,\\
\boldsymbol{u} &= \nabla\phi .
\end{align*}
!et
=== Subsubsection heading ===
DocOnce files can have chapters, sections, subsections, and subsubsections.
__Paragraph heading.__ Paragraphs may have headings.
verbatim inline font
especially with a newline
inside the text
and an exclamation mark at the end: BEGIN
! For
spellcheck, test a verbatim expression
in another
in a third
.
Also test exclamation mark as in !bc
and !ec
as well as a != b
.
Also test backslashes and braces like \begin
, \begin{enumerate}
,
\end{this}\end{that}
, and {something \inside braces}
.
Here is some red color and an attempt to write with
green color containing a linebreakhtml
Terminal> python -c 'print("Testing\noutput\nfrom\nPython.")'
Testing
output
from
Python.
h[i] += 1
(must have space between inline code and footnote!)1: Typesetting of the footnote depends on the format. Plain text does nothing, LaTeX removes the definition and inserts the footnote as part of the LaTeX text. reStructuredText and Sphinx employ a similar type of typesetting as Extended Markdown and DocOnce, and in HTML we keep the same syntax, just displayed properly in HTML.
2: Math footnotes can be dangerous since it interferes with an exponent.
3: One-line footnote.
4: google.com is perhaps the most famous web site today.
Here is some more text before a new definition of a footnote that was used above.[~x for x in y]
or in y=~x
, and should
of course remain a tilde in those contexts.)
Figure 1: Visualization of a wave.
![]() |
Figure 2: A long caption spanning several lines and containing verbatim words like |
movies.do.txt
.
def f(theta):
return theta**2
.tex
by proper begin-end LaTeX environments for theorems.
Should look nice in most formats!
Theorem 5.
Let \( a=1 \) and \( b=2 \). Then \( c=3 \).
Proof.
Since \( c=a+b \), the result follows from straightforward addition.
\( \Diamond \)
As we see, the proof of Theorem 5 is a modest
achievement.
time | velocity | acceleration |
0.0 | 1.4186 | -5.01 |
2.0 | 1.376512 | 11.919 |
4.0 | 1.1E+1 | 14.717624 |
Here is yet another table to test that we can handle more than one table:|--------------------------------| |time | velocity | acceleration | |--l--------r-----------r--------| | 0.0 | 1.4186 | -5.01 | | 2.0 | 1.376512 | 11.919 | | 4.0 | 1.1E+1 | 14.717624 | |--------------------------------|
time | velocity | acceleration |
0.0 | 1.4186 | -5.01 |
1.0 | 1.376512 | 11.919 |
3.0 | 1.1E+1 | 14.717624 |
\( i \) | \( h_i \) | \( \bar T_i \) | L_i |
0 | 0 | 288 | -0.0065 |
1 | 11,000 | 216 | 0.0 |
2 | 20,000 | 216 | 0.001 |
3 | 32,000 | 228 | 0.0028 |
4 | 47,000 | 270 | 0.0 |
5 | 51,000 | 270 | -0.0028 |
6 | 71,000 | 214 | NaN |
|-
because of a negative number,
and |
right before and after verbatim word (with no space):
exact | v_1 | \( a_i \) + v_2 | verb_3_ |
9 | 9.62 | 5.57 | 8.98 |
-20 | -23.39 | -7.65 | -19.93 |
10 | 17.74 | -4.50 | 9.96 |
0 | -9.19 | 4.13 | -0.26 |
\( S \) | command |
$ ||a_0|| $ | norm|length |
\( x\cap y \) | x|y |
Type | Description |
X | Alignment character that is used for specifying a potentially very long text in a column in a table. It makes use of the tabularx package in LaTeX, otherwise (for other formats) it means l (centered alignment). |
l,r,c | standard alignment characters |
bm
that expands to boldsymbol
, was tricky, but
cleanly handled now)
and URLs.
my_file_v1
and my_file_v2
my_file_v1.py
and my_file_v2.py
define some math \( a_{i-1} \).
Here is more __verbatim__
code and
some plain text on a new line.
Just verbatim
Verbatim
beginning verbatim end
verbatim
word Just verbatim
.
Some text.
Emphasize beginning.
Some text.
Verbatim beginning
.
Some text.
Maybe emphasize end.
Some text.
Maybe verbatim end
.
Some text.
The middle has emphasize word.
Some text.
The middle has verbatim
word.
Some text.
Ampersand.
We can test Hennes & Mauritz, often abbreviated H&M, but written
as Hennes & Mauritz
and H & M
.
A sole &
must also work.
# Just to check that ampersand works in code blocks:
c = a & b
.txt
.
More quotes to be tested for spellcheck:
("with parenthesis"), "with newline"
and "with comma", "hyphen"-wise, and "period".
Example:
and then, with the command-line option --examples_as_exercises
be
typeset as exercises. This is useful if one has solution
environments as part of the example.
a)
State some problem.
Solution.
The answer to this subproblem can be written here.
b)
State some other problem.
Hint 1.
A hint can be given.
Hint 2.
Maybe even another hint?
Solution.
The answer to this other subproblem goes here,
maybe over multiple doconce input lines.
add
appears in
the example in the section Example 1: A test function.
def add(a, b):
return a + b
def test_add():
a = 1; b = 1
expected = a + b
computed = add(a, b)
assert expected == computed
Problem | Result |
\( 1+1 \) | \( 2 \) |
file:///
works: link to a
file is
fine to have. Moreover, "loose" URLs work, i.e., no quotes, just
the plain URL as in https://folk.uio.no/hpl, if followed by space, comma,
colon, semi-colon, question mark, exclamation mark, but not a period
(which gets confused with the periods inside the URL).
Mail addresses can also be used: hpl@simula.no, or just a mail link, or a raw mailto:hpl@simula.no.
Here are some tough tests of URLs, especially for the latex
format:
Newton-Cotes formulas
and a good book. Need to test
Newton-Cotes with percentage in URL too:
https://en.wikipedia.org/wiki/Newton%E2%80%93Cotes_formulas
and https://en.wikipedia.org/wiki/Newton-Cotes#Open_Newton.E2.80.93Cotes_formulae which has a shebang.
For the --device=paper
option it is important to test that URLs with
monospace font link text get a footnote
(unless the --latex_no_program_footnotelink
is used), as in this reference to
decay_mod, ball1.py,
and ball2.py.
More tough tests: repeated URLs whose footnotes when using the
--device=paper
option must be correct. We have
google, google, and
google, which should result in exactly three
footnotes.