Commit f050ed54 authored by Konrad Hinsen's avatar Konrad Hinsen

Merge branch 'master' of gitlab.inria.fr:learninglab/mooc-rr/mooc-rr-ressources

parents 8ddadacf 39443083
...@@ -5,14 +5,13 @@ pages: ...@@ -5,14 +5,13 @@ pages:
- pandoc --version - pandoc --version
# - pandoc --help # - pandoc --help
# - pandoc --list-input-formats # Broken as pandoc dates from 2013 on this image! :( # - pandoc --list-input-formats # Broken as pandoc dates from 2013 on this image! :(
- bin/pandoc_fixer.pl html_src_files.lst;
- for file in `cat html_src_files.lst | sed 's/#.*//g' `; do - for file in `cat html_src_files.lst | sed 's/#.*//g' `; do
bin/pandoc_fixer.pl ${file};
echo "Creating" public/`dirname ${file}`;
mkdir -p public/`dirname ${file}`; mkdir -p public/`dirname ${file}`;
mv ${file%.*}.html public/`dirname ${file}`/; mv ${file%.*}.html public/`dirname ${file}`/;
done done
- cat html_src_files.lst | sed -e 's|\.md |.html |' -e 's|\.org |\.html |' -e 's|^./\([^ ]*\) *# *\([^ ]*\)|- [[./\1]] (\2)|' > index.org - cd module2/ressources/; tar zcf rr_org_archive.tgz rr_org/init.el rr_org/journal.org rr_org/init.org ; cd ../.. ; mv module2/ressources/rr_org_archive.tgz public/module2/ressources/
- pandoc -s -f org -t html -o public/index.html index.org - cd module2/ressources/; make -C replicable_article/ all ../replicable_article.tgz ; cd ../.. ; mv module2/ressources/replicable_article.tgz public/module2/ressources/
artifacts: artifacts:
paths: paths:
- public - public
......
#!/usr/bin/perl -w #!/usr/bin/perl -w
use strict; use strict;
my($usage) = "Usage: pandox_fixer.pl input.md"; my($usage) = "Usage: pandox_fixer.pl org_md_files.lst";
($#ARGV==0) or die $usage; ($#ARGV==0) or die $usage;
my($input)=shift(@ARGV); sub pandoc_export {
my($input)=shift(@_);
########### Git date ################# ########### Git date #################
my($gitdate)=`git log --date=short $input | grep Date | head -n 1`; my($gitdate)=`git log --date=short $input | grep Date | head -n 1`;
chomp($gitdate); chomp($gitdate);
$gitdate =~ s/Date: *//g; $gitdate =~ s/Date: *//g;
$gitdate =~ s/\s*\+.*$//g; $gitdate =~ s/\s*\+.*$//g;
########### Input file ############### ########### Input file ###############
my($type) = ""; my($type) = "";
my($output) = $input; my($output) = $input;
if($input =~ /.md$/) { if($input =~ /.md$/) {
$type = "gfm"; $type = "gfm";
$output =~ s/.md$/.html/; $output =~ s/.md$/.html/;
} elsif ($input =~ /.org$/) { } elsif ($input =~ /.org$/) {
$type = "org"; $type = "org";
$output =~ s/.org$/.html/; $output =~ s/.org$/.html/;
} else { } else {
die "Usage: pandox_fixer.pl input.md"; die "Usage: pandox_fixer.pl input.md";
}
my($output_temp) = $output."tmp";
########### URL Fixing ###############
my($input_path)=$input;
$input_path =~ s|/[^/]*$||g;
my($raw_path) = "https://gitlab.inria.fr/learninglab/mooc-rr/mooc-rr-ressources/raw/master/".$input_path;
my($raw_path_percent) = $raw_path; $raw_path_percent =~ s/^http/%/g;
my($tree_path) = "https://gitlab.inria.fr/learninglab/mooc-rr/mooc-rr-ressources/tree/master/".$input_path;
my($gitlab_origin)= "https://gitlab.inria.fr/learninglab/mooc-rr/mooc-rr-ressources/blob/master/";
########### Pandoc #################
print "Exporting $input\n";
my($pandoc_output) = `LANG=C ; pandoc -s --mathjax -f $type -t html -o $output_temp $input`;open INPUT, $output_temp or die;
open OUTPUT, "> ".$output or die;
while(defined(my $line=<INPUT>)) {
if($line =~ /<p class="author"/) { next; }
if($line =~ /<h1 class="title"/) { next; }
if($line =~ /<p class="date"/) { next; }
if($line =~ /<p>.*broken-links:nil/) { next; }
# $line =~ s|https://gitlab.inria.fr/learninglab/|https://learninglab.gitlabpages.inria.fr/|g; ## Not such a good idea!
if($line =~ /<body>/) {
if($output=~ /_fr.html/) {
$line =~ s|<body>|<body>Les <a href='$gitlab_origin/$input'>sources de ce document sont disponibles sur gitlab</a>.|g;
$line .= "<br><i>Version du $gitdate.</i><br><hr/>\n"
} else {
$line =~ s|<body>|<body>The <a href='$gitlab_origin/$input'>source of this document is available on gitlab</a>.|g;
$line .= "<br><i>Last version: $gitdate</i><br><hr/>\n"
}
} }
$line =~ s|<span class="smallcaps">TOC</span>||g; my($output_temp) = $output."tmp";
########### URL Fixing ###############
my($input_path)=$input;
$input_path =~ s|/[^/]*$||g;
my($raw_path) = "https://gitlab.inria.fr/learninglab/mooc-rr/mooc-rr-ressources/raw/master/".$input_path;
my($raw_path_percent) = $raw_path; $raw_path_percent =~ s/^http/%/g;
my($tree_path) = "https://gitlab.inria.fr/learninglab/mooc-rr/mooc-rr-ressources/tree/master/".$input_path;
my($pages_path) = "https://learninglab.gitlabpages.inria.fr/mooc-rr/mooc-rr-ressources/".$input_path;
my($pages_path_percent) = $pages_path; $pages_path_percent =~ s/^http/%/g;
my($gitlab_origin)= "https://gitlab.inria.fr/learninglab/mooc-rr/mooc-rr-ressources/blob/master/";
########### Pandoc #################
print "Exporting $input\n";
my($pandoc_output) = `LANG=C ; pandoc -s --mathjax -f $type -t html -o $output_temp $input`;open INPUT, $output_temp or die;
open OUTPUT, "> ".$output or die;
while(defined(my $line=<INPUT>)) {
if($line =~ /<p class="author"/) { next; }
if($line =~ /<h1 class="title"/) { next; }
if($line =~ /<p class="date"/) { next; }
if($line =~ /<p>.*broken-links:nil/) { next; }
# $line =~ s|https://gitlab.inria.fr/learninglab/|https://learninglab.gitlabpages.inria.fr/|g; ## Not such a good idea!
if($line =~ /<body>/) {
if($output=~ /_fr.html/) {
$line =~ s|<body>|<body>Les <a href='$gitlab_origin/$input'>sources de ce document sont disponibles sur gitlab</a>.|g;
$line .= "<br><i>Version du $gitdate.</i><br><hr/>\n"
} else {
$line =~ s|<body>|<body>The <a href='$gitlab_origin/$input'>source of this document is available on gitlab</a>.|g;
$line .= "<br><i>Last version: $gitdate</i><br><hr/>\n"
}
}
$line =~ s|<span class="smallcaps">TOC</span>||g;
$line =~ s|---</p>|<hr/>|g;
# $line =~ s|Date:.*<br|<i>Date: $gitdate</i><br|g;
# $line =~ s|<p>TITLE:\(.*\)<br|<b>TITLE:$1</b><br|g;
$line =~ s|---</p>|<hr/>|g; #### Processing links to images, org files, archives, ...
# $line =~ s|Date:.*<br|<i>Date: $gitdate</i><br|g; $line =~ s|img src="http|img src="%|g;
# $line =~ s|<p>TITLE:\(.*\)<br|<b>TITLE:$1</b><br|g; $line =~ s|img src="([^%][^"]*)"|img src="$raw_path/$1"|g; # ?inline=false
$line =~ s|img src="%|img src="http|g;
$line =~ s|href="http|href="%|g;
$line =~ s|href="([^%#][^"]*.tgz)"|href="$pages_path_percent/$1"|g;
$line =~ s|href="([^%#][^"]*)"|href="$tree_path/$1"|g; # ?inline=false
$line =~ s|href="%|href="http|g;
#### Processing links to images, org files, archives, ... # if($line =~ /img src="([^%][^"]*)"/) {
$line =~ s|img src="http|img src="%|g; # $line = "\t".$line;
$line =~ s|img src="([^%][^"]*)"|img src="$raw_path/$1"|g; # ?inline=false # }
$line =~ s|img src="%|img src="http|g;
$line =~ s|href="http|href="%|g; #### Changing headers
$line =~ s|href="([^%#][^"]*.tgz)"|href="$raw_path_percent/$1"|g; # ?inline=false foreach my $i (4,3,2,1) {
$line =~ s|href="([^%#][^"]*)"|href="$tree_path/$1"|g; # ?inline=false my($j)=$i+1;
$line =~ s|href="%|href="http|g; $line =~ s|<h$i|<h$j|g;
$line =~ s|</h$i|</h$j|g;
}
print OUTPUT $line;
}
# if($line =~ /img src="([^%][^"]*)"/) { close OUTPUT;
# $line = "\t".$line; close INPUT;
# } unlink($output_temp);
}
#### Changing headers sub main() {
foreach my $i (4,3,2,1) { my($input_list)=shift(@ARGV);
my($j)=$i+1; open LIST, $input_list or die;
$line =~ s|<h$i|<h$j|g; open INDEX, "> public/index.org" or die;
$line =~ s|</h$i|</h$j|g; my($f);
print INDEX "| Gitlab Origin | Pandoc HTML (Gitlab pages) | FUN Outcome |
|---+---+---|\n";
while(defined($f = <LIST>)) {
chomp($f);
if($f =~ /^\s*$/) {
print INDEX "|---+---+---|\n";
next;
}
my($file,$url) = split(/\s*#\s*/,$f);
if($file eq "" || !defined($url)) { warn "Malformed line"; next;}
# print "'$file' --- '$url'\n";
# pandoc_export($file);
my($html)=$file; $html=~ s/\.[^\.]*$/.html/g;
my($url_id) = $url; $url_id =~ s|^.*jump_to_id/||g;
print INDEX "| [[https://gitlab.inria.fr/learninglab/mooc-rr/mooc-rr-ressources/tree/master/$file][$file]] | [[$html]] | [[$url][$url_id]] |\n";
} }
print OUTPUT $line; print INDEX "|---+---+---|\n";
close INDEX;
close LIST;
my($pandoc_output) = `LANG=C ; pandoc -s -c http://www.pirilampo.org/styles/readtheorg/css/readtheorg.css -f org -t html -o public/index.html public/index.org`;
} }
close OUTPUT; main()
close INPUT;
unlink($output_temp);
...@@ -13,14 +13,13 @@ pages: ...@@ -13,14 +13,13 @@ pages:
- pandoc --version - pandoc --version
# - pandoc --help # - pandoc --help
# - pandoc --list-input-formats # Broken as pandoc dates from 2013 on this image! :( # - pandoc --list-input-formats # Broken as pandoc dates from 2013 on this image! :(
- bin/pandoc_fixer.pl html_src_files.lst;
- for file in `cat html_src_files.lst | sed 's/#.*//g' `; do - for file in `cat html_src_files.lst | sed 's/#.*//g' `; do
bin/pandoc_fixer.pl ${file};
echo "Creating" public/`dirname ${file}`;
mkdir -p public/`dirname ${file}`; mkdir -p public/`dirname ${file}`;
mv ${file%.*}.html public/`dirname ${file}`/; mv ${file%.*}.html public/`dirname ${file}`/;
done done
- cat html_src_files.lst | sed -e 's|\.md |.html |' -e 's|\.org |\.html |' -e 's|^./\([^ ]*\) *# *\([^ ]*\)|- [[./\1]] (\2)|' > index.org - cd module2/ressources/; tar zcf rr_org_archive.tgz rr_org/init.el rr_org/journal.org rr_org/init.org ; cd ../.. ; mv module2/ressources/rr_org_archive.tgz public/module2/ressources/
- pandoc -s -f org -t html -o public/index.html index.org - cd module2/ressources/; make -C replicable_article/ all ../replicable_article.tgz ; cd ../.. ; mv module2/ressources/replicable_article.tgz public/module2/ressources/
artifacts: artifacts:
paths: paths:
- public - public
...@@ -115,115 +114,3 @@ chmod +x ./gitlab-ci.sh ...@@ -115,115 +114,3 @@ chmod +x ./gitlab-ci.sh
./gitlab-ci.sh ./gitlab-ci.sh
#+end_src #+end_src
#+RESULTS:
#+begin_example
pandoc 2.2.1
Compiled with pandoc-types 1.17.5.1, texmath 0.11.1, skylighting 0.7.5
Default user data directory: /home/alegrand/.pandoc
Copyright (C) 2006-2018 John MacFarlane
Web: http://pandoc.org
This is free software; see the source for copying conditions.
There is no warranty, not even for merchantability or fitness
for a particular purpose.
Exporting ./module2/ressources/maintaining_a_journal.org
Creating public/./module2/ressources
Exporting ./module2/ressources/jupyter_fr.org
Creating public/./module2/ressources
Exporting ./module2/ressources/rstudio_fr.org
Creating public/./module2/ressources
Exporting ./module2/ressources/gitlab_fr.org
Creating public/./module2/ressources
Exporting ./module2/ressources/emacs_orgmode_fr.org
Creating public/./module2/ressources
Exporting ./module2/ressources/jupyter.org
Creating public/./module2/ressources
Exporting ./module2/ressources/emacs_orgmode.org
Creating public/./module2/ressources
Exporting ./module2/ressources/maintaining_a_journal_fr.org
Creating public/./module2/ressources
Exporting ./module2/ressources/rstudio.org
Creating public/./module2/ressources
Exporting ./module2/ressources/gitlab.org
Creating public/./module2/ressources
Exporting ./module2/ressources/orgmode_examples/README.org
Creating public/./module2/ressources/orgmode_examples
Exporting ./module2/ressources/orgmode_examples/README_fr.org
Creating public/./module2/ressources/orgmode_examples
Exporting ./module2/exo4/stat_activity.org
Creating public/./module2/exo4
Exporting ./module2/slides/ressources_fr.org
Creating public/./module2/slides
Exporting ./module2/slides/ressources.org
Creating public/./module2/slides
Exporting ./module3/ressources/iso_date_format.org
Creating public/./module3/ressources
Exporting ./module3/ressources/iso_date_format_fr.org
Creating public/./module3/ressources
Exporting ./module3/ressources/influenza-like-illness-analysis-orgmode+R.org
Creating public/./module3/ressources
Exporting ./module3/ressources/influenza-like-illness-analysis-orgmode+Lisp+Python+R.org
Creating public/./module3/ressources
Exporting ./module3/ressources/influenza-like-illness-analysis-orgmode.org
Creating public/./module3/ressources
Exporting ./module3/ressources/analyse-syndrome-grippal-orgmode.org
Creating public/./module3/ressources
Exporting ./module3/ressources/analyse-syndrome-grippal-orgmode+R.org
Creating public/./module3/ressources
Exporting ./module3/ressources/analyse-syndrome-grippal-orgmode+Lisp+Python+R.org
Creating public/./module3/ressources
Exporting ./module1/ressources/Module1_1_MaterielSupplementaire_fr.org
Creating public/./module1/ressources
Exporting ./module1/ressources/Module1_2_MaterielSupplementaire_fr.org
Creating public/./module1/ressources
Exporting ./module1/ressources/Module1_3_MaterielSupplementaire_fr.org
Creating public/./module1/ressources
Exporting ./module1/ressources/Module1_5_MaterielSupplementaire_fr.org
Creating public/./module1/ressources
Exporting ./module1/ressources/Module1_1_SupplementaryMaterial.org
Creating public/./module1/ressources
Exporting ./module1/ressources/Module1_2_SupplementaryMaterial.org
Creating public/./module1/ressources
Exporting ./module1/ressources/introduction_to_markdown_fr.org
Creating public/./module1/ressources
Exporting ./module1/ressources/introduction_to_markdown.org
Creating public/./module1/ressources
Exporting ./module1/ressources/module1_supplementary_material.org
Creating public/./module1/ressources
Exporting ./module1/ressources/module1_additionalRessources.md
Creating public/./module1/ressources
Exporting ./module1/ressources/sequence3_fr.org
Creating public/./module1/ressources
Exporting ./module1/ressources/sequence5_fr.org
Creating public/./module1/ressources
Exporting ./module1/ressources/sequence2_fr.org
Creating public/./module1/ressources
Exporting ./module1/ressources/sequence1_fr.org
Creating public/./module1/ressources
Exporting ./module4/ressources/resources_refs.org
Creating public/./module4/ressources
Exporting ./module4/ressources/resources_refs_fr.org
Creating public/./module4/ressources
Exporting ./module4/ressources/exo1.org
Creating public/./module4/ressources
Exporting ./module4/ressources/exo2.org
Creating public/./module4/ressources
Exporting ./module4/ressources/exo3.org
Creating public/./module4/ressources
Exporting ./module4/ressources/resources_environment.org
Creating public/./module4/ressources
Exporting ./module4/ressources/resources_environment_fr.org
Creating public/./module4/ressources
Exporting ./documents/notebooks/notebook_RStudio_SASmarkdown.md
Creating public/./documents/notebooks
Exporting ./documents/tuto_git_gtlab/tuto_git_gitlab.md
Creating public/./documents/tuto_git_gtlab
Exporting ./documents/tuto_rstudio_gitlab/tuto_rstudio_gitlab.md
Creating public/./documents/tuto_rstudio_gitlab
Exporting ./documents/tuto_magit/tuto_magit.md
Creating public/./documents/tuto_magit
Exporting ./documents/tuto_emacs_windows/tuto_emacs_windows.md
Creating public/./documents/tuto_emacs_windows
Exporting ./documents/tuto_jupyter_windows/tuto_jupyter_windows.md
Creating public/./documents/tuto_jupyter_windows
#+end_example
...@@ -25,6 +25,7 @@ Archer Reilly]]. ...@@ -25,6 +25,7 @@ Archer Reilly]].
- [[#summations-and-integrals][Summations and integrals]] - [[#summations-and-integrals][Summations and integrals]]
- [[#outfits][Outfits]] - [[#outfits][Outfits]]
- [[#about-markdown][About =markdown=]] - [[#about-markdown][About =markdown=]]
- [[#markdown-and-pandoc-resources-in-english][Markdown/Pandoc Resources in english]]
* Syntax * Syntax
** Headers ** Headers
...@@ -194,3 +195,18 @@ The =pdf= conversion always relies on [[https://fr.wikipedia.org/wiki/LaTeX][LaT ...@@ -194,3 +195,18 @@ The =pdf= conversion always relies on [[https://fr.wikipedia.org/wiki/LaTeX][LaT
In the demo, we show how to generate a =docx= from a =markdown= document with =Pandoc= and we explain that it is then possible to use a word processor like =LibreOffice= to edit the resulting file. Obviously the modifications will not be back-propagated to the original =markdown= document. You may however want to use =Pandoc= again to convert your new =docx= document to a new =markdown= document. In the demo, we show how to generate a =docx= from a =markdown= document with =Pandoc= and we explain that it is then possible to use a word processor like =LibreOffice= to edit the resulting file. Obviously the modifications will not be back-propagated to the original =markdown= document. You may however want to use =Pandoc= again to convert your new =docx= document to a new =markdown= document.
Another common strategy consists in doing most of the editing of an article/report in =Markdown= and to export it into a =docx= (or =LaTeX=) only in the end so as to prepare it for a camera-ready version with a standard word processing environment (or a =LaTeX= editor). Another common strategy consists in doing most of the editing of an article/report in =Markdown= and to export it into a =docx= (or =LaTeX=) only in the end so as to prepare it for a camera-ready version with a standard word processing environment (or a =LaTeX= editor).
* Markdown and Pandoc Resources in english
** Mardown et pandoc
- [[https://programminghistorian.org/en/lessons/sustainable-authorship-in-plain-text-using-pandoc-and-markdown][Sustainable Authorship in Plain Text using Pandoc and Markdown by Dennis Tenen and Grant Wythoff]]: in this tutorial, you will first learn the basics of Markdown—an easy to read and write markup syntax for plain text—as well as Pandoc, a command line tool that converts plain text into a number of beautifully formatted file types: PDF, .docx, HTML, LaTeX, slide decks, and more.
- The « [[https://github.com/jgm/pandoc/wiki/Documentation-and-Tutorials][Documentation and Tutorials]] » page of the github Pandoc project provides many links to resources about Pandoc.
** Markdown syntax
- [[https://programminghistorian.org/en/lessons/getting-started-with-markdown][Programming Historian : Getting Started with Markdown]] is very usefull to understand why this language is used, how to format Markdown files, and how to preview Markdown-formatted documents on the web (in spanish [[https://programminghistorian.org/es/lecciones/introduccion-a-markdown][Introducción a Markdown]])
- To write equations with Markdown: [[http://pandoc.org/MANUAL.html#math][see the relevant part of the Pandoc documentation]]
- Writing equations requires a basic knowledge of TeX / LaTeX: [[https://en.wikibooks.org/wiki/LaTeX][see wikibooks.org documentation about LaTeX]]
** Others
The resources listed under the [[https://programminghistorian.org/en/lessons/?activity=sustaining][Sustain section of "The Programming Historian"]] are all relevant for Module 1 (in particular the tutorial on Git/GitHub).
...@@ -26,6 +26,7 @@ Voici un aperçu rapide de la syntaxe Markdown repris d'une ...@@ -26,6 +26,7 @@ Voici un aperçu rapide de la syntaxe Markdown repris d'une
- [[#déguisements][Déguisements]] - [[#déguisements][Déguisements]]
- [[#autour-de-markdown][Autour de =markdown=]] - [[#autour-de-markdown][Autour de =markdown=]]
* Syntaxe * Syntaxe
** Headers ** Headers
#+BEGIN_EXAMPLE #+BEGIN_EXAMPLE
...@@ -195,3 +196,4 @@ La conversion en =pdf= passe toujours par [[https://fr.wikipedia.org/wiki/LaTeX] ...@@ -195,3 +196,4 @@ La conversion en =pdf= passe toujours par [[https://fr.wikipedia.org/wiki/LaTeX]
Dans la petite démonstration, nous montrons comment générer un fichier =docx= à partir d'un fichier =md= avec =Pandoc= et nous soulignons qu'il est alors possible d'utiliser un traitement de texte comme =LibreOffice= pour modifier le fichier obtenu. Il est clair que si des modifications sont apportées au =docx= elle en seront pas (automatiquement) propagées au =md=. Il faudra utiliser =Pandoc= pour cela et effectuer une conversion de =docx= vers =md= (et seules les éléments du format =docx= qui existent en =md= seront conservés). Dans la petite démonstration, nous montrons comment générer un fichier =docx= à partir d'un fichier =md= avec =Pandoc= et nous soulignons qu'il est alors possible d'utiliser un traitement de texte comme =LibreOffice= pour modifier le fichier obtenu. Il est clair que si des modifications sont apportées au =docx= elle en seront pas (automatiquement) propagées au =md=. Il faudra utiliser =Pandoc= pour cela et effectuer une conversion de =docx= vers =md= (et seules les éléments du format =docx= qui existent en =md= seront conservés).
Une stratégie qui est souvent employée et qui fonctionne bien en pratique consiste à faire le gros du travail de rédaction d'un article ou d'un mémoire en =Markdown=. La rédaction terminée, le fichier est exporté au format =docx= (ou =LaTeX=) et des ajustements de mise en page sont alors effectués avec un logiciel de traitement de texte (ou un éditeur =LaTeX=). Une stratégie qui est souvent employée et qui fonctionne bien en pratique consiste à faire le gros du travail de rédaction d'un article ou d'un mémoire en =Markdown=. La rédaction terminée, le fichier est exporté au format =docx= (ou =LaTeX=) et des ajustements de mise en page sont alors effectués avec un logiciel de traitement de texte (ou un éditeur =LaTeX=).
---
title: "Mon premier document"
author: "Arnaud Legrand"
date: "10 octobre 2017"
output: word_document
---
## R Markdown
This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see <http://rmarkdown.rstudio.com>.
When you click the **Knit** button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
```{r cars}
summary(cars)
```
## Including Plots
You can also embed plots, for example:
```{r pressure, echo=FALSE}
plot(pressure)
```
Note that the `echo = FALSE` parameter was added to the code chunk to prevent printing of the R code that generated the plot.
## Ma propre section
```{r}
x=1
x
```
```{r}
x = x + 10
x
```
```{r}
hist(rnorm(1000))
```
```{r}
hist(rnorm(100,mean = 2, sd = .2))
```
## Un petit exemple avec d'autres langages
```{python}
from math import *
x = 3.14
print(sin(x))
```
```{python}
print(sin(x))
```
This diff is collapsed.
# -*- coding: utf-8 -*-
# -*- mode: org -*-
#+TITLE: Une petite démo d'Org-Mode
#+AUTHOR: Arnaud Legrand
#+STARTUP: overview indent inlineimages logdrawer
#+LANGUAGE: en
#+HTML_HEAD: <link rel="stylesheet" title="Standard" href="http://orgmode.org/worg/style/worg.css" type="text/css" />
#+PROPERTY: header-args :eval never-export
* Section 1
** Sous-section
* Section 2
** Foo
*** Hello
Avec du texte
- ici du *gras*
- et là, de /l'italique/
*** Salut
*** Etc
** Bar
** Baz
* Exécution de calculs :noexport:
#+begin_src R :results output :session *R* :exports both
cars
#+end_src
#+RESULTS:
#+begin_example
speed dist
1 4 2
2 4 10
3 7 4
4 7 22
5 8 16
6 9 10
7 10 18
8 10 26
9 10 34
10 11 17
11 11 28
12 12 14
13 12 20
14 12 24
15 12 28
16 13 26
17 13 34
18 13 34
19 13 46
20 14 26
21 14 36
22 14 60
23 14 80
24 15 20
25 15 26
26 15 54
27 16 32
28 16 40
29 17 32
30 17 40
31 17 50
32 18 42
33 18 56
34 18 76
35 18 84
36 19 36
37 19 46
38 19 68
39 20 32
40 20 48
41 20 52
42 20 56
43 20 64
44 22 66
45 23 54
46 24 70
47 24 92
48 24 93
49 24 120
50 25 85
#+end_example
#+begin_src R :results output graphics :file (org-babel-temp-file "figure" ".png") :exports results :width 600 :height 400 :session *R*
plot(cars)
#+end_src
#+RESULTS:
[[file:/tmp/babel-148945lI/figure14894n0r.png]]
#+begin_src R :results output :session *R* :exports both
(x=10)
#+end_src
#+RESULTS:
: [1] 10
#+begin_src R :results output :session *R* :exports both
(x = x+10)
#+end_src
#+RESULTS:
: [1] 20
* Autres langages
#+begin_src python :results output :exports both
print(2+2)
#+end_src
#+RESULTS:
: 4
#+begin_src shell :results output :exports both
ls /tmp
#+end_src
#+RESULTS:
#+begin_example
babel-148945lI
babel-1933r-E
babel-7506nSG
emacs1000
emacs14894axZ
firefox-esr_alegrand
mozilla_alegrand0
pulse-PKdhtXMmr18n
RtmpsK10QZ
RtmpvMPlZs
ScientificMethodologyProjectGithub.ipynb
ssh-KQXcWTA8Cx6u
systemd-private-0461cab7d3944a9e974b73d23efc09af-apache2.service-QPpUU4
systemd-private-0461cab7d3944a9e974b73d23efc09af-colord.service-wdsVAi
systemd-private-0461cab7d3944a9e974b73d23efc09af-iio-sensor-proxy.service-UYGEGU
systemd-private-0461cab7d3944a9e974b73d23efc09af-ModemManager.service-FKfsh9
systemd-private-0461cab7d3944a9e974b73d23efc09af-rtkit-daemon.service-43AVDL
systemd-private-0461cab7d3944a9e974b73d23efc09af-systemd-timesyncd.service-4pB1fo
thunderbird_alegrand
tracker-extract-files.1000
tutoriel.pdf
#+end_example
#+begin_src shell :session *shell* :results output :exports both
hostname
#+end_src
#+RESULTS:
:
: icarus
#+begin_src shell :session *shell* :results output :exports both
ssh nipmuk
#+end_src
#+RESULTS:
: The programs included with the Debian GNU/Linux system are free software;
: the exact distribution terms for each program are described in the
: individual files in /usr/share/doc/*/copyright.
:
: Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
: permitted by applicable law.
: Last login: Tue Apr 10 12:10:47 2018 from ligone.imag.fr
#+begin_src shell :session *shell* :results output :exports both
hostname
ls /tmp/
#+end_src
#+RESULTS:
: nipmuk
: ATN452-P5785-Linux-X64.bin tina_update vgauthsvclog.txt.0
: P57 tn_pipe vmware-root
: ssh-0xgYrn2tUz upgrade_linux.batch
...@@ -18,17 +18,23 @@ org-files. These documents depend on many other external data files ...@@ -18,17 +18,23 @@ org-files. These documents depend on many other external data files
and are not meant to lead to reproducible documents but it will give and are not meant to lead to reproducible documents but it will give
you an idea of how it can be organized: you an idea of how it can be organized:
1. [[file:journal.org][journal.org]]: an excerpt (I've only left a few code samples and links 1. [[file:td2_PS.ipynb][td2_PS.ipynb]]: this is a practical session (in French) on random
number generation for 1st year master students in computer
science. It uses the R language. In this teaching context, the main
advantage of using a jupyter notebook over other environments is
that students can use the University jupyterhub and thus do not
have to install anything on their laptop.
2. [[file:journal.org][journal.org]]: an excerpt (I've only left a few code samples and links
to some resources on R, Stats, ...) from my own journal. This is a to some resources on R, Stats, ...) from my own journal. This is a
personal document where everything (meeting notes, hacking, random personal document where everything (meeting notes, hacking, random
thoughts, ...) goes by default. Entries are created with the =C-c c= thoughts, ...) goes by default. Entries are created with the =C-c c=
shortcut. shortcut.
2. [[file:labbook_single.org][labbook_single.org]]: this is an excerpt from the laboratory notebook 3. [[file:labbook_single.org][labbook_single.org]]: this is an excerpt from the laboratory notebook
[[https://cornebize.net/][Tom Cornebize]] wrote during his Master thesis internship under my [[https://cornebize.net/][Tom Cornebize]] wrote during his Master thesis internship under my
supervision. This a personal labbook. I consider this notebook to be supervision. This a personal labbook. I consider this notebook to be
excellent and was the ideal level of details for us to communicate excellent and was the ideal level of details for us to communicate
without any ambiguity and for him to move forward with confidence. without any ambiguity and for him to move forward with confidence.
3. [[file:paper.org][paper.org]]: this is an ongoing paper based on the previous labbook of 4. [[file:paper.org][paper.org]]: this is an ongoing paper based on the previous labbook of
Tom Cornebize. As such it is not reproducible as there are hardcoded Tom Cornebize. As such it is not reproducible as there are hardcoded
paths and uncleaned dependencies but writing it from the labbook was paths and uncleaned dependencies but writing it from the labbook was
super easy as we just had to cut and paste the parts we super easy as we just had to cut and paste the parts we
...@@ -38,7 +44,7 @@ you an idea of how it can be organized: ...@@ -38,7 +44,7 @@ you an idea of how it can be organized:
commands that are automatically executed when opening the file. It commands that are automatically executed when opening the file. It
is an effective way to depend less on the =.emacs/init.el= which is is an effective way to depend less on the =.emacs/init.el= which is
generally customized by everyone. generally customized by everyone.
4. [[file:labbook_several.org][labbook_several.org]]: this is a labbook for a specific project shared 5. [[file:labbook_several.org][labbook_several.org]]: this is a labbook for a specific project shared
by several persons. As a consequence it starts with information by several persons. As a consequence it starts with information
about installation, common scripts, has section with notes about all about installation, common scripts, has section with notes about all
our meetings, a section with information about experiments and an our meetings, a section with information about experiments and an
...@@ -47,7 +53,7 @@ you an idea of how it can be organized: ...@@ -47,7 +53,7 @@ you an idea of how it can be organized:
available in git so we did not bother. In such labbook, it is common available in git so we did not bother. In such labbook, it is common
to find annotations indicating that such experiment was =:FLAWED:= as to find annotations indicating that such experiment was =:FLAWED:= as
it had some issues. it had some issues.
5. [[file:technical_report.org][technical_report.org]]: this is a short technical document I wrote 6. [[file:technical_report.org][technical_report.org]]: this is a short technical document I wrote
after a colleague sent me a PDF describing an experiment he was after a colleague sent me a PDF describing an experiment he was
conducting and asked me about how reproducible I felt it was. It conducting and asked me about how reproducible I felt it was. It
turned out I had to cut and paste the C code from the PDF, then turned out I had to cut and paste the C code from the PDF, then
......
...@@ -20,7 +20,13 @@ fichiers externes et ne sont pas prévu pour permettre de produire ...@@ -20,7 +20,13 @@ fichiers externes et ne sont pas prévu pour permettre de produire
directement des documents reproductibles mais ils peuvent vous donner directement des documents reproductibles mais ils peuvent vous donner
une idée de la façon dont ils peuvent être organisés: une idée de la façon dont ils peuvent être organisés:
1. [[file:journal.org][journal.org]]: ceci est un extrait (je n'ai laissé que quelques 1. [[file:td2_PS.ipynb][td2_PS.ipynb]]: ceci est une feuille de TD (en français) sur la
génération de nombres aléatoires à destination d'étudiants de
première année de Master en informatique. Elle utilise le langage
R. Dans ce contexte d'enseignement, l'intérêt du notebook jupyter
est qu'ils peuvent utiliser le jupyterhub de l'université et n'ont
donc rien à installer sur leur machine.
2. [[file:journal.org][journal.org]]: ceci est un extrait (je n'ai laissé que quelques
exemples de programmes et de liens vers des ressources sur R, les exemples de programmes et de liens vers des ressources sur R, les
statistiques, etc.) de mon propre journal. C'est un document statistiques, etc.) de mon propre journal. C'est un document
personnel dans lequel tout ce que je peux faire (notes prises personnel dans lequel tout ce que je peux faire (notes prises
...@@ -28,14 +34,14 @@ une idée de la façon dont ils peuvent être organisés: ...@@ -28,14 +34,14 @@ une idée de la façon dont ils peuvent être organisés:
variées, notes bibliographiques, ...) atterrit par défaut. Les variées, notes bibliographiques, ...) atterrit par défaut. Les
entrées avec la date sont créées automatiquement à l'aide du entrées avec la date sont créées automatiquement à l'aide du
raccourci =C-c c=. raccourci =C-c c=.
2. [[file:labbook_single.org][labbook_single.org]]: ceci est un extrait du cahier de laboratoire 3. [[file:labbook_single.org][labbook_single.org]]: ceci est un extrait du cahier de laboratoire
tenu par [[https://cornebize.net/][Tom Cornebize]] pendant son stage de Master sous ma tenu par [[https://cornebize.net/][Tom Cornebize]] pendant son stage de Master sous ma
direction. C'est un cahier de laboratoire personnel et que je direction. C'est un cahier de laboratoire personnel et que je
considère comme excellent car il a le niveau de détail idéal pour considère comme excellent car il a le niveau de détail idéal pour
nous permettre à la fois de communiquer sans aucune ambiguïté, pour nous permettre à la fois de communiquer sans aucune ambiguïté, pour
moi, de bien suivre ses avancées, et pour lui, d'avancer dans ses moi, de bien suivre ses avancées, et pour lui, d'avancer dans ses
travaux avec confiance. travaux avec confiance.
3. [[file:paper.org][paper.org]]: ceci est un article en cours basé sur le cahier de 4. [[file:paper.org][paper.org]]: ceci est un article en cours basé sur le cahier de
laboratoire précédent. En l'état, il n'est pas reproductible car il laboratoire précédent. En l'état, il n'est pas reproductible car il
y a plusieurs chemins absolus en dur et des dépendances logicielles y a plusieurs chemins absolus en dur et des dépendances logicielles
non explicitées mais sa rédaction à partir du cahier de laboratoire non explicitées mais sa rédaction à partir du cahier de laboratoire
...@@ -50,7 +56,7 @@ une idée de la façon dont ils peuvent être organisés: ...@@ -50,7 +56,7 @@ une idée de la façon dont ils peuvent être organisés:
qui sont exécutées par emacs à l'ouverture du fichier. C'est une qui sont exécutées par emacs à l'ouverture du fichier. C'est une
façon simple mais efficace de dépendre le moins possible du façon simple mais efficace de dépendre le moins possible du
=.emacs/init.el= que chacun personnalise à sa convenance. =.emacs/init.el= que chacun personnalise à sa convenance.
4. [[file:labbook_several.org][labbook_several.org]]: ceci est un petit exemple de cahier de 5. [[file:labbook_several.org][labbook_several.org]]: ceci est un petit exemple de cahier de
laboratoire partagé par plusieurs personnes. Il commence donc par laboratoire partagé par plusieurs personnes. Il commence donc par
des informations sur les dépendances logicielles à installer, les des informations sur les dépendances logicielles à installer, les
scripts les plus utiles. On y trouve ensuite une section avec des scripts les plus utiles. On y trouve ensuite une section avec des
...@@ -70,7 +76,7 @@ une idée de la façon dont ils peuvent être organisés: ...@@ -70,7 +76,7 @@ une idée de la façon dont ils peuvent être organisés:
nouvelle date) est en général alors ajoutée. L'annotation =:FLAWED:= nouvelle date) est en général alors ajoutée. L'annotation =:FLAWED:=
nous permet de conserver l'ensemble des expériences tout en sachant nous permet de conserver l'ensemble des expériences tout en sachant
d'un coup d'oeil lesquelles ne doivent pas être prises en compte. d'un coup d'oeil lesquelles ne doivent pas être prises en compte.
5. [[file:technical_report.org][technical_report.org]]: ceci est un petit document technique que j'ai 6. [[file:technical_report.org][technical_report.org]]: ceci est un petit document technique que j'ai
écrit après qu'un collègue m'ai envoyé un document PDF décrivant écrit après qu'un collègue m'ai envoyé un document PDF décrivant
une expérience qu'il avait réalisé et souhaitait mon avis sur si une expérience qu'il avait réalisé et souhaitait mon avis sur si
c'était suffisant d'un point de vue reproductibilité. Il s'est c'était suffisant d'un point de vue reproductibilité. Il s'est
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment