hplgit / doconce Goto Github PK
View Code? Open in Web Editor NEWLightweight markup language - document once, include anywhere
Home Page: http://hplgit.github.io/doconce/doc/web/index.html
License: Other
Lightweight markup language - document once, include anywhere
Home Page: http://hplgit.github.io/doconce/doc/web/index.html
License: Other
Use of the --latex_exercise_numbering=chapter or absolute
will have no effect now - change to --exercise_numbering=
. The --exercise_numbering=
makes it possible to have chapter-wise numbering of exercises for any format. In particular, you can get the same numbering in an html version of a book as in the latex version.
This change was part of a efforts with extracting exercises as separate files for distribution to students (e.g., as .tex
files or IPython notebook files - the students can fill in the answers and learn to use latex or notebooks). See quick description.
The doconce format pdflatex
(or latex
) command results in a file with extension .p.tex
, which must be transformed to an ordinary LaTeX file using either the stand-alone ptex2tex
program or the simpler doconce ptex2tex
utility. The flexible typesetting of computer code offered by ptex2tex
has now been reimplemented in a simpler way within DocOnce such that the ptex2tex
step is unnecessary.
Running
Terminal> doconce format pdflatex mydoc --latex_code_style=X
generates a mydoc.tex
file directly. Moreover, the LaTeX code for typesetting computer is simpler, more readable, and more flexible than offered by ptex2tex
. The argument X
can be simple or very complex, depending on how much detailed control of the typesetting of various code environments that is wanted. The verbatim typesetting now relies on three LaTeX environments: Verbatim, minted, and listlisting. These can be combined with colored backgrounds, if desired, and various parameters (line numbers, indent, etc.) can be specified for each code environment.
More detailed information on how to use the new --latex_code_style
option is given in the demo.
Many DocOnce documents make heavy use of # #include "file"
. With a new version of preprocess, https://github.com/hplgit/preprocess, it is possible to include just parts of another file. For example, one can easily include an example from the middle of a report in another document.
Here is another example: if the solution of an exercise is available as a separate report add_project.do.txt
, parts of that report can be included in the solution environments of the exercise. The exercise goes like
!bsubex
Compute $1+1$.
!bsol
# #include "add_project.do.txt" fromto: Computing \$1+1\$ is a huge task\.@===== Computing 2 times 2 =====
!esol
!esubex
!bsubex
Compute $2\cdot 2$.
!bsol
# #include "add_project.do.txt" fromto: ===== Computing 2 times 2 =====@===== Concluding
!esol
!esubex
The syntax is identical to what is used by the DocOnce @@@CODE
inclusion command (fromto: start-regex@end-regex
).
I am not sure if this is a conda error or not, just just wanted to let you know
Linux Mint 17.1
installed Anaconda
bash Anaconda-2.2.0-Linux-x86_64.sh
I closed the terminal and opened a new one.
neal@cinnamon ~ $ conda info
Current conda install:
platform : linux-64
conda version : 3.12.0
conda-build version : 1.11.0
python version : 2.7.9.final.0
requests version : 2.7.0
root environment : /home/neal/anaconda (writable)
default environment : /home/neal/anaconda
envs directories : /home/neal/anaconda/envs
package cache : /home/neal/anaconda/pkgs
channel URLs : https://repo.continuum.io/pkgs/free/linux-64/
https://repo.continuum.io/pkgs/free/noarch/
https://repo.continuum.io/pkgs/pro/linux-64/
https://repo.continuum.io/pkgs/pro/noarch/
config file : None
when I try to install
conda install --channel johannr doconce
I get the error
doconce-1.0.3- 100% |################################| Time: 0:00:03 1.77 MB/s
Extracting packages ...
[ COMPLETE ] |##################################################| 100%
Unlinking packages ...
[ COMPLETE ] |##################################################| 100%
Linking packages ...
An unexpected error has occurred, please consider sending the######## | 90%
following traceback to the conda GitHub issue tracker at:
https://github.com/conda/conda/issues
Include the output of the command 'conda info' in your report.
Traceback (most recent call last):
File "/home/neal/anaconda/bin/conda", line 5, in <module>
sys.exit(main())
File "/home/neal/anaconda/lib/python2.7/site-packages/conda/cli/main.py", line 202, in main
File "/home/neal/anaconda/lib/python2.7/site-packages/conda/cli/main.py", line 207, in args_func
try:
File "/home/neal/anaconda/lib/python2.7/site-packages/conda/cli/main_install.py", line 46, in execute
install.install(args, parser, 'install')
File "/home/neal/anaconda/lib/python2.7/site-packages/conda/cli/install.py", line 420, in install
log.debug("Can't write the history file")
File "/home/neal/anaconda/lib/python2.7/site-packages/conda/plan.py", line 502, in execute_actions
if to_link:
File "/home/neal/anaconda/lib/python2.7/site-packages/conda/instructions.py", line 140, in execute_instructions
File "/home/neal/anaconda/lib/python2.7/site-packages/conda/instructions.py", line 84, in LINK_CMD
return dist, pkgs_dir, int(linktype)
File "/home/neal/anaconda/lib/python2.7/site-packages/conda/instructions.py", line 80, in link
if pkgs_dir is None:
File "/home/neal/anaconda/lib/python2.7/site-packages/conda/install.py", line 523, in link
File "/home/neal/anaconda/lib/python2.7/os.py", line 157, in makedirs
mkdir(name, mode)
OSError: [Errno 17] File exists: '/home/neal/anaconda/lib/python2.7/site-packages/snowballstemmer-1.2.0-py2.7.egg-info'
I also tried doing the complete install as root and I get the same error. I however, used the install script
with success.
I am really excited to see this project grow. Awesome work!
I am a newcomer to doconce and I am really eager to start using it. However, having to download 300+ MB in order to try the program is too much. du -h -d 1
reveals that more than half of that are git objects, which I believe to be unnecessary for most users. A large amount of space is taken up by files related to slide generation, which are not essential either. Also, I noticed an overlap in the content of the bundled
and lib
directories. The latter includes zip files of some of the directories in the former.
This comment is not intended to be a rant and I apologize if it sounds like it. I am very interested in using this tool and more importantly, I want my colleagues to use it.
Here is my source file: http://pastebin.com/QBTKKp59
Would you please help me in getting rid of the following error?
$ doconce format html main.do.txt --list_of_exercises=toc
translating doconce text in main.do.txt to html
Traceback (most recent call last):
File "/home/sohail/anaconda/envs/doc27/bin/doconce", line 1177, in <module>
main()
File "/home/sohail/anaconda/envs/doc27/bin/doconce", line 1167, in main
eval(command + '()')
File "<string>", line 1, in <module>
File "/home/sohail/anaconda/envs/doc27/bin/doconce", line 92, in format
doconce.doconce.format_driver()
File "/home/sohail/anaconda/envs/doc27/lib/python2.7/site-packages/doconce/doconce.py", line 4278, in format_driver
out_filename = file2file(filename_preprocessed, format, basename)
File "/home/sohail/anaconda/envs/doc27/lib/python2.7/site-packages/doconce/doconce.py", line 3247, in file2file
filestr = doconce2format(filestr, format)
File "/home/sohail/anaconda/envs/doc27/lib/python2.7/site-packages/doconce/doconce.py", line 3575, in doconce2format
filestr = exercises(filestr, format, code_blocks, tex_blocks)
File "/home/sohail/anaconda/envs/doc27/lib/python2.7/site-packages/doconce/doconce.py", line 1434, in exercises
formatted_exercise, formatted_solution = EXERCISE[format](exer)
File "/home/sohail/anaconda/envs/doc27/lib/python2.7/site-packages/doconce/html.py", line 1737, in html_exercise
hint_header='__Hint.__')
File "/home/sohail/anaconda/envs/doc27/lib/python2.7/site-packages/doconce/common.py", line 792, in doconce_exercise_output
ssol += answer_header + '\n' + exer['answer'] + '\n'
UnboundLocalError: local variable 'ssol' referenced before assignment
In http://hplgit.github.io/doconce/doc/pub/manual/html/manual.html#bibliography-references
there are several places it mentions the bibitem
command. I thought the bibtex
command is more standard for this purpose? (e.g. TeX Live does not seem to have the bibitem
command.)
For example,
The eye visually doesn't create the second word without a little help. Lowercasing to doconce
would be a reasonable solution, but if you're going to mash together two words DocOnce
will read much more naturally (at least to Americans).
Hi,
I try to make a presentation with the line:
TITLE: Sustentação
and got the following error:
Traceback (most recent call last):
File "/usr/local/bin/doconce", line 1177, in <module>
main()
File "/usr/local/bin/doconce", line 1167, in main
eval(command + '()')
File "<string>", line 1, in <module>
File "/usr/local/bin/doconce", line 92, in format
doconce.doconce.format_driver()
File "/usr/local/lib/python2.7/dist-packages/doconce/doconce.py", line 4499, in format_driver
out_filename = file2file(filename_preprocessed, format, basename)
File "/usr/local/lib/python2.7/dist-packages/doconce/doconce.py", line 3478, in file2file
filestr = doconce2format(filestr, format)
File "/usr/local/lib/python2.7/dist-packages/doconce/doconce.py", line 3905, in doconce2format
filestr = INTRO[format] + filestr
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 306: ordinal not in range(128)
To overcome the situation I just added these two lines in make.sh:
doconce replace '<h1>Sustentacao</h1>' '<h1>Sustentação</h1>' $name.html
doconce replace '<title>Sustentacao</title>' '<title>Sustentação</title>' $name.html
Interestingly was that it accepts:
AUTHOR: Sustentação
but not:
TITLE: Sustentação
I used the beige theme, where just TITLE is made a little glossy.
Thanks in advance,
When I use 7 =
for section titles in .do.txt source and run doconce format pdflatex --sections_up
, \section{}
in the .tex file is promoted to \chapter{}
as expected, but \documentclass
still uses article
(not book
), causing pdflatex command to fail (e.g. article
does not support \chapter
)
I could get around this problem by some preprocessing, but it would be great if article
can also be promoted to book
when 7 =
is prompted to 9 by --sections_up
, to avoid pdflatex errors.
Test:
$ cat intro.do.txt
======= Introduction =======
This is the intro.
$ doconce format pdflatex intro --sections_up
translating doconce text in intro.do.txt to pdflatex
transforming sections: section to chapter...
transforming sections: subsection to section...
transforming sections: subsubsection to subsection...
output in intro.p.tex
$ doconce ptex2tex intro
output in intro.tex
$ cat intro.tex
...<snipped>
\documentclass[%
twoside, % oneside: electronic viewing, twoside: printing
final, % or draft (marks overfull hboxes, figures with paths)
10pt]{article}
...<snipped>
\chapter{Introduction}
Doconce does not show the installed version with the --help option
$ doconce --help
Usage: doconce command [optional arguments]
commands: format insertdocstr old2new_format gwiki_figsubst remove_inline_comments latin2html sphinx_dir subst replace replace_from_file clean help latex_header latex_footer guess_encoding change_encoding bbl2rst split_rst list_labels teamod sphinxfix_localURLs make_figure_code_links grab spellcheck ptex2tex ...
Neither there is an option --version.
Knowing the doconce version would be useful when reading the online documentation in order to know how much accordance to expect.
Os: Debian Jessie 8 ( Testing )
Doconce version: 0.7.3-1 installed from official Debian repository for US. (the testing repository)
For output in HTML with Bootstrap styles, hints and answers (!bsol, !bans) in exercises are now unfolded sections. Click the symbol to open them (and click again to fold the section). See example:
http://hplgit.github.io/doconce/doc/pub/manual/._manual013.html#doconce:manual:exercise:ex
I want to generate "underline" and "doubleunderline" in final generated PDF, i am not able to see any way in which doconce allows me to do so. Underline is also possible in HTML
Can you kindly enhance it
I keep getting this error when I try pdflatex
The package inputenc has already been loaded with options:
[utf8x]
There has now been an attempt to load it with options
[utf8]
Adding the global options:
utf8x,utf8
to your \documentclass declaration may fix this.
Try typing <return> to proceed.
I'm not sure how to fix this with doconce.
Any help appreciated.
see error:
ben@Bens-MacBook-Pro ~/dev/doconce !510 # python bin/bib2rst.py
Traceback (most recent call last):
File "bin/bib2rst.py", line 26, in
from bibstuff import bib4txt
ImportError: cannot import name bib4txt
This is after running python setup.py install on head.
Use the script ebookmaker.py as described in the Troubleshooting and FAQ document. Basically, translate to Bootstrap HTML first, make a JSON file describing the content, and then run ebookmaker.py
.
It might be useful to be able to specify the target python distribution to use for this, instead of hacking the script itself.
Just a suggestion.
Plots are no longer restricted to static image files, see
http://hplgit.github.io/doconce/doc/pub/manual/manual.html#___sec13
Bokeh offers fancy interactive tools for exploring data. Simple Matplotlib plots can be converted to Bokeh format. Examples are given in the link above.
I have a doconce source file test2.do.txt that creates an html file and latex and then pdf. The references are created correctly with the html file but not the latex file. Any Ideas?
Thanks in advance.
Currently, there are two ways to place caption for figures in html: either caption is above the figure (default behaviour) or it is on the right side of the figure (with sidecap=True
). It seems to be useful to add an option to place caption below the figure as it is standard way to do it in many typographic traditions (e.g. Russian).
How can we done this properly? I see at least two possible approaches:
bottomcap
. Then if two options sidecap
and bottomcap
are True
, one of them is ignored. (Which one?)sidecap
with another option caption_placement
that can take one of the following values: top
, bottom
, side
(or even left
, right
instead of just side
)?While trying to follow the answer at: http://stackoverflow.com/questions/29545338/how-to-build-a-non-distribution-non-recipe-existent-packages-for-anaconda/29569096#29569096
I got:
$ conda skeleton pypi doconce
doconce not found, trying Doconce
Using url http://code.google.com/p/doconce/downloads/list (0 B) for Doconce.
Downloading Doconce (use --no-download to skip this step)
Unpacking Doconce...
An unexpected error has occurred, please consider sending the
following traceback to the conda GitHub issue tracker at:
https://github.com/conda/conda-build/issues
Include the output of the command 'conda info' in your report.
Traceback (most recent call last):
File "/home/sohail/anaconda/bin/conda-skeleton", line 5, in <module>
sys.exit(main())
File "/home/sohail/anaconda/lib/python2.7/site-packages/conda_build/main_skeleton.py", line 188, in main
args_func(args, p)
File "/home/sohail/anaconda/lib/python2.7/site-packages/conda_build/main_build.py", line 321, in args_func
args.func(args, p)
File "/home/sohail/anaconda/lib/python2.7/site-packages/conda_build/main_skeleton.py", line 202, in execute
pypi.main(args, parser)
File "/home/sohail/anaconda/lib/python2.7/site-packages/conda_build/pypi.py", line 376, in main
get_package_metadata(args, package, d, data)
File "/home/sohail/anaconda/lib/python2.7/site-packages/conda_build/pypi.py", line 428, in get_package_metadata
unpack(join(SRC_CACHE, d['filename']), tempdir)
File "/home/sohail/anaconda/lib/python2.7/site-packages/conda_build/pypi.py", line 640, in unpack
raise Exception("not a valid source")
Exception: not a valid source
Would some body help??
I've tried to get a whole picture about this project by reading different docs etc. and stumbled upon TODO. I wonder if it's still up to date as the mentions of pandoc etc. doesn't make me feel like so.
Particularly I'm looking for a better support for CommonMark with some extensions (as described on https://github.com/jgm/CommonMark/wiki/Proposed-Extensions-to-CommonMark) allowing the same set of features as the markup used e.g. for the book A Primer on Scientific Programming with Python (I believe the markup is the one on http://hplgit.github.io/teamods/writing_reports/_static/report.do.txt.html).
Slate is very similar to Nikola, but specialized on API docs: https://github.com/tripit/slate
Somehow I think that using doconce to generate markdown for Slate might be a good idea, especially if one want to generate LaTeX/PDF as well.
Slate has it's own flavor of markdown: https://github.com/tripit/slate/wiki/Markdown-Syntax
which use PHP style tables :-(
Finally I managed to use doconce format pandoc myfile --github_md
which gives
Two problems still remain:
Seems I can hack pandoc.py to add what I need (Java), but what will happen when I will generate say LaTex format ?
Is it feasible to have special option --slate_md to generate correct markdown for Slate and still valid LaTeX from the DocOnce format ?
Hi Hans,
I found a bug on the installation script
https://github.com/hplgit/doconce/blob/master/doc/src/manual/install_doconce.py
You have to move installation of "future" python in line 89 to some place before line 69, because 'future' is a dependency of 'preprocess'. Otherwise returns "ImportError no module named past.builtins".
Regards.
Searching keeps on forever.
As discussed in #48 , support for both-way translation between DocOnce and CommonMark with extensions would be nice as the extensions are already getting into the most popular CommonMark implementations (e.g. https://github.com/markdown-it/markdown-it).
for writing a research paper , I have to write in latex STRICTLY USING "elsevier.cls"
( please refer http://www.elsevier.com/author-schemas/the-journal-document-class-elsart
http://www.elsevier.com/author-schemas/latex-instructions
http://mirrors.ctan.org/macros/latex/contrib/elsarticle/doc/elsdoc.pdf
)
Now, Can i write my research paper in "doconce", so as to "generate the latex" while which only uses "Journal documentclass elsarticle " from the "elsevier.cls" . So that the research paper can be submitted to an elsevier journal.
Trying to include utf8 characters somewhere between !bquiz
and !equiz
lead to an error 'ascii' codec can't encode...
.
I am trying to add support for doconce in http://getnikola.com and ran into something:
I can't find a way to call doconce with a specific filename as input and a filename as output.
So, if you can describe the command line I should use to turn posts/foo.do into cache/posts/foo.html it would be much appreciated :-)
Is there an option to make doconce generate \verb
instead of \Verb
when using "format pdflatex"?
When I run
doconce format pdflatex test1.do.txt
where
$ cat test1.do.txt
The word `test` is in verbatim.
the generated .tex file contains \Verb
, causing the "undefined control sequence" error:
$ pdflatex test1.p.tex
... <snipped>
! Undefined control sequence.
l.93 The word \Verb
!test! is in verbatim.
If I replace the \Verb
with \verb
, then pdflatex test1.p.tex
runs ok:
$ doconce subst '\\Verb' '\\verb' test1.p.tex
\\Verb replaced by \\verb in test1.p.tex
$ pdflatex test1.p.tex
# this is ok
Consider a bibliography item for a web site:
@Misc{test,
author = {First Last},
title = {{T}his title is a test},
url = {http://test_url.org},
howpublished = {\url{http://test_howpublished}},
year = {2015}
}
When building doconce format pdflatex
, it will displays correctly like this:
But when building for doconce format html
, it generates this:
It seems to me that when building format html
, the HTML code should just display the howpublished
field (like in format pdflatex
) or the url
field, but not both. Or am I doing something wrong?
(Normally url and howpublished would use the same web address. I use different ones here just to see which one is displayed in html and pdflatex, respectively)
The paper.pub file (publish import mybib.bib
) looks like:
$ cat papers.pub
* misc
** {T}his Title Is a Test
key: test
author: First Last
year: 2015
url: http://test_url.org
status: published
howpublished: \url{http://test_howpublished}
entrytype: misc
.do.txt source file:
$ cat my.do.txt
Referece test cite{test}
===== References =====
BIBFILE: papers.pub
Just wanted to make a general comment that confused me and caused a lot of tex errors, The Figure captions apparently cannot have _
This might be handy to include in the documentation. Thanks again
You can just do
conda install --channel johannr doconce
to get a full installation of DocOnce.
(Thanks to Johannes Ring who made the packages!)
Many python libraries run on python 2.7 and python 3.4.
Especially one can use single file library of "six" ( see https://pypi.python.org/pypi/six ), which is compatibility library between python 2 and python 3). For example, mako templates runs upon starting from python 2.6 till python 3.4 - all simultaneously
So port doconce such that it runs on python 2.7 and python 3.4 both.
reference: my own comment on issue #25
The handling of interactive sessions in DocOnce when compiling to the ipynb format has been changed. Previously, the entire session became a computational cell, but this is not what you (normally) want. You want to break up the session such that each output like >>> a
ends a cell and enables printing a
when executing the cell. In this way, you can recreate the entire interactive session in the notebook. This also works for sessions with IPython syntax.
Special features to be aware of when translating DocOnce to IPython/Jupyter notebooks is document
here:
This blog post:
http://bkanuka.com/articles/native-latex-plots/
shows how to incorporate native looking defaults into matplotlib figures. Can this be accommodated in doconce?
Thanks!
Using LaTeX or DocOnce to prepare manuscripts is great because the files can be version controlled and the writer does not have to fuss over the formatting.
However, one of the biggest challenges of using LaTeX to prepare manuscripts in the life and health sciences is that few journals support LaTeX. No LaTeX styles or templates are provided, and the writer has to spend considerable time tweaking LaTeX parameters to meet the formatting requirements of a given journal. And if your manuscript is accepted, you will have to generate a .doc
version of your manuscript.
Nevertheless, there are a few journals that support LaTeX. A series of journals that have become increasingly popular are PLOS journals. When preparing a manuscript for one of these journals, there is a LaTeX template that can be used. It is not a .cls
, but rather a .tex
file with lots of commands, as well as a .bst
file.
Would it be possible to add some functionality to DocOnce so that users could specify --latex_style=PLOS
? I am not certain whether this would be more complicated than adding another pdf_style based on a .cls
file. As a non-expert, would this be something I could tackle with some guidance, or would this be too hard?
Adding a PLOS latex_style would add to the pool of people who might be interested in using DocOnce. For me, it would be easier to get colleagues to collaborate a .do.txt
file; most would be intimated and confused with a .tex
file.
Regards.
I have not found other mean to report a minor typo en the doconce manual I've just read.
the section available at
http://hplgit.github.io/doconce/doc/pub/manual/html/manual.html#exercise-1-compute-integrals
Look at the excercise b), it describes the integral as
$e^{-at}\sin(wx)$
but I'm guessing that you meant
$e^{-ax}\sin(wx)$
My guess is based on the solution proposed and the python source code provided which reads
F = sp.integrate(sp.exp(-a_x)_sp.sin(w*x), x)
Sorry if this is not the best way of reporting a typo, but I did not found other way.
D.M.
Doconce makefile make.py created with the command
$ doconce makefile example.do.txt html pdflatex
Fails when executed as
$ python make.py
The error message is
File "make.py", line 19
print 'Command failed.' %% cmd
^
SyntaxError: invalid syntax
Create file example.do.txt with the contents:
TITLE: Example
AUTHOR: Example
DATE: Feb 2015
TOC: on========= Example =========
Lorem ipsum dolor...
Execute commands
$ doconce makefile example.do.txt html pdflatex
$ python make.py
Os: Debian Jessie 8 ( Testing )
Doconce version: DocOnce version 1.0.2 Installed from official git repository downloaded and compiled the 10 Feb of 2015
While a friend and me are currently working on a lightweight german description on DocOnce for school I tripped over a minor typo in the "Markdown to HTML conversion" section:
In the codeblock you wrote "m2html" instead of "md2html" like in the sentence before for the conversion from pandoc to html.
Hope this helps and keep up the amazing work on DocOnce.
I can't get any of the commands slides_html, split_html or slides_beamer to work. This means I can't produce any slides. I think I have a working installation of DocOnce, it works perfectly well for papers and web pages. The error I get is
command slides_html not legal, must be among, and then a list of permitted commands.
Using Ubuntu 14.10, it appears that, after installing miniconda, and then running the conda package install conda install --channel johannr doconce
, it is missing the ipython notebook for some operations. Once I ran conda install ipython-notebook
, all the ipynb operations worked with doconce. Perhaps this could be included in the conda package?
Trying to specify --html_toc_depth=1
during doconce format html
, I have the following warning:
*** warning: unrecognized command-line option
--html_toc_depth=1
It seems that there's no handlers for html_toc_depth
at all:
[user@maccie doconce #2152]$ grep "html_toc_depth" **/*.py
build/lib/doconce/misc.py: bootstrap_options = ' --html_style=bootswatch_readable --html_code_style=inherit --html_pre_style=inherit --html_toc_depth=2 --pygments_html_style=default'
lib/doconce/misc.py: bootstrap_options = ' --html_style=bootswatch_readable --html_code_style=inherit --html_pre_style=inherit --html_toc_depth=2 --pygments_html_style=default'
And that's all, no other mentions of this options in the sources.
Notebooks are meant to be written interactively in the browser, but many would prefer to use an editor like Emacs and write the notebook in plain Markdown and computer code. Others may have lots of LaTeX files that they want to translate to notebooks, and then translating to an ascii format first is attractive. If the ascii format is extended with programming constructs like variables and functions, it also becomes more functional than writing notebooks in the web browser. Here is a description of such an ascii format and how the little compiler can be written:
http://hplgit.github.io/doconce/doc/pub/ipynb/ipynb_generator.html
Note that DocOnce offers the same possibility to write notebooks in ascii format, and with much more functionality, such as copying selected parts of files, capturing output from programs in the text, proper equation referencing in Markdown math, much more testing for potential Mako problems, handling of literature references, references to other sections, etc. The note above is for those who want to create their own independent format and/or learn how to use IPython.nbformat
functionality for writing notebooks from programs.
Issue
I am able to compile my book on my work computer, but I get an error when I try to compile it on my laptop. I have tried to install Doconce on another laptop and I get the same error message. It appears to be a problem with preprocess, but I am relatively new to Python so the error message does not give me sufficient information about how to solve it. Hopefully someone will have some ideas.
Systems and Programs
Error Message
(python2)13:45 ~/.../book$ doconce format pdflatex book.do.txt --latex_code_style=vrb --latex_style=Springer_T2
running preprocess -DFORMAT=pdflatex -DDEVICE=screen book.do.txt > tmp_preprocess__book.do.txt
Could not run preprocessor:
preprocess -DFORMAT=pdflatex -DDEVICE=screen book.do.txt > tmp_preprocess__book.do.txt
Traceback (most recent call last):
File "/home/martin/anaconda3/envs/python2/bin/preprocess", line 9, in
load_entry_point('preprocess==1.2.2', 'console_scripts', 'preprocess')()
File "/home/martin/anaconda3/envs/python2/lib/python2.7/site-packages/setuptools-19.1.1-py2.7.egg/pkg_resources/init.py", line 568, in load_entry_point
File "/home/martin/anaconda3/envs/python2/lib/python2.7/site-packages/setuptools-19.1.1-py2.7.egg/pkg_resources/init.py", line 2719, in load_entry_point
ImportError: Entry point ('console_scripts', 'preprocess') not found
return code from preprocess: 1
Abort! (add --no_abort on the command line to avoid this abortion)
Error Message (--no-abort added)
(python2)13:45 ~/.../book$ doconce format pdflatex book.do.txt --latex_code_style=vrb --latex_style=Springer_T2 --no_abort
running preprocess -DFORMAT=pdflatex -DDEVICE=screen book.do.txt > tmp_preprocess__book.do.txt
Could not run preprocessor:
preprocess -DFORMAT=pdflatex -DDEVICE=screen book.do.txt > tmp_preprocess__book.do.txt
Traceback (most recent call last):
File "/home/martin/anaconda3/envs/python2/bin/preprocess", line 9, in
load_entry_point('preprocess==1.2.2', 'console_scripts', 'preprocess')()
File "/home/martin/anaconda3/envs/python2/lib/python2.7/site-packages/setuptools-19.1.1-py2.7.egg/pkg_resources/init.py", line 568, in load_entry_point
File "/home/martin/anaconda3/envs/python2/lib/python2.7/site-packages/setuptools-19.1.1-py2.7.egg/pkg_resources/init.py", line 2719, in load_entry_point
ImportError: Entry point ('console_scripts', 'preprocess') not found
return code from preprocess: 1
avoided abortion because of --no-abort
Traceback (most recent call last):
File "/home/martin/anaconda3/envs/python2/bin/doconce", line 1518, in
main()
File "/home/martin/anaconda3/envs/python2/bin/doconce", line 1508, in main
eval(command + '()')
File "", line 1, in
File "/home/martin/anaconda3/envs/python2/bin/doconce", line 95, in format
doconce.doconce.format_driver()
File "/home/martin/anaconda3/envs/python2/lib/python2.7/site-packages/doconce/doconce.py", line 4774, in format_driver
preprocessor_options)
File "/home/martin/anaconda3/envs/python2/lib/python2.7/site-packages/doconce/doconce.py", line 4431, in preprocess
remove_code_and_tex(filestr, format)
File "/home/martin/anaconda3/envs/python2/lib/python2.7/site-packages/doconce/common.py", line 478, in remove_code_and_tex
if filestr[-1] != '\n':
IndexError: string index out of range
__This is a paragraph heading.___
has an extra _
from http://hplgit.github.io/doconce/doc/pub/tutorial/tutorial.html#link_footnote_1
======= First a Section Heading with 7 = Characters =======
===== Then a Subsection Heading with 5 = Characters =====
=== Finally a Subsubection Heading with 3 = Characters ===
You can also have paragraphs with a paragraph heading surrounded
by double underscores are the beginning of a line.
__This is a paragraph heading.___
And here comes the text.
===== A Subsection with Sample Text =====
label{my:first:sec}
Ordinary text looks like ordinary text, but must always start at the
beginning of lines. Tags used for _boldface_ words, *emphasized*
words, and `computer` words look natural in plain text. Quotations
appear inside double backticks and double single quotes, as in ``this
example''.
Below the section title we have a *label*, which can be used to
refer to Section ref{my:first:sec}.
References to equations, such as (ref{myeq1}), work in the same
LaTeX-inspired way.
Lists are typeset as you would do in email,
* item 1
* item 2,
perhaps with a 2nd line
* item 3
Note the consistent use of indentation (as in Python programming!).
Lists can also have automatically numbered items instead of bullets,
o item 1
o item 2
o item 3,
but be careful with the indentation of the next lines!
__Hyperlinks.__
URLs with a link word are possible, as in "hpl": "http://folk.uio.no/hpl".
If the word is just URL, the URL itself becomes the link name,
as in URL: "tutorial.do.txt". DocOnce distinguishes between paper
and screen output. In traditional paper output, in PDF generated from LaTeX
generated from DocOnce, the URLs of links appear as footnotes.
With screen output, all links are clickable hyperlinks, except in
the plain text format which does not support hyperlinks.
__Inline comments.__
DocOnce also allows inline comments of the form [name: comment] (with
a space after `name:`), e.g., such as [hpl: here I will make some
remarks to the text]. Inline comments can be removed from the output
by a command-line argument (see Section ref{doconce2formats} for an
example). Inline comments can also be used for detailed editing of
text, much like track changes in word, to illustrate how a text
is revised. (However, for seeing how others have revised the text, I
strongly recommend using Git for version control and running `git diff`
on the appropriate versions, or you can click on differences at
GitHub if the files are hosted there.)
__Footnotes.__ Adding a footnote[^footnote] is also possible.
[^footnote]: The syntax for footnotes is borrowed from Extended Markdown.
__Tables.__
Tables are also written in the plain text way, e.g.,
|--c--------c-----------c--------|
|time | velocity | acceleration |
|---r-------r-----------r--------|
| 0.0 | 1.4186 | -5.01 |
| 2.0 | 1.376512 | 11.919 |
| 4.0 | 1.1E+1 | 14.717624 |
|--------------------------------|
The characters `c`, `r`, and `l` can be inserted, as illustrated above,
for aligning the headings and the columns (center, right, left).
# Lines beginning with # are comment lines.
DocOnce has a new output format matlabnb
for Matlab notebooks in the publish format, http://se.mathworks.com/help/matlab/matlab_prog/marking-up-matlab-comments-for-publishing.html. The implementation is very experimental!
Note that the publish format is very primitive so only a small subset of the DocOnce markup can successfully translate to Matlab notebooks. However, if one writes within this subset, it is easy to write notebooks that translate to both Python and Matlab.
Is there a tool that automatically takes an IPython notebook and converts it to Doconce format? I can see two reasons why this would be very useful:
Me again, sorry :-)
Found another one:
reStructuredText chapter
-> The sentence before the third codeblock says "unovonv" instead of "unoconv"
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.