相似文件
换一批
经管之家送您一份
应届毕业生专属福利!
求职就业群
感谢您参与论坛问题回答
经管之家送您两个论坛币!
+2 论坛币
markdoc/weaver/ketchup:日志文件(smcl)与docx/pdf/html/tex/epub的完美结合 | 1.命令安装 - ssc install ketchup
- ssc install markdoc
- ssc install weaver
- ssc install synlight
复制代码 以上命令请同时安装:
| 2.举例一(使用markdoc和weaver转smcl为docx/html)
markdoc命令的运行过程借助于第三方软件pandoc,其安装过程以下分手动和自动两种分别介绍: 首先介绍自动安装: - set linesize 80 //列宽80打印效果较佳
- log close //暂时关闭日志记录
- qui log using example, replace
- /*
- Introduction to MarkDoc (heading 1)
- ===================================
-
- Using Markdown (heading 2)
- --------------------------
-
- Writing with __markdown__ syntax allows you to add text and graphs to
- _smcl_ logfile and export it to a editable document format. I will demonstrate
- the process by using the __Auto.dta__ dataset.
- ###Get started with MarkDoc (heading 3)
- I will open the dataset, list a few observations, and export a graph.
- Then I will export the logfile to Microsoft Office docx format.
- */
- sysuse auto, clear
- list in 1/5
- histogram price
- graph export graph.png, replace
- /*
-
- Adding a graph or image in the report
- ======================================
- Adding a graph using Markdown
- -----------------------------
-
- In order to add a graph using Markdown, I export the graph in PNG format.
- You can explain the graph in the "brackets" and define the file path in parentheses
-
- ![explain the graph](./graph.png)
- Adding a graph using HTML
- -------------------------
- By using HTML tag to add a graph, you can also resize the graph. Just include
- a code similar to the one below and specify the source. The width and height
- options specify the size of the graph.
-
- <img src="./graph.png" width=350 height=230 >
- */
- qui log c
- markdoc example, replace export(docx)
- markdoc example, replace export(html)
复制代码
由于缺少pandoc软件,这时出现安装pandoc字样提示自动/手动安装(箭头处),点击自动安装:
| 这时Stata会自动创建一个Weaver文件夹,将pandoc程序包(1.13.1)下载后通过自动解压,安装完毕后,重新运行上述do-file,最后可见: |
| 点击example.docx:
注意:请调整页边距呈现最佳效果,页面布局——页边距——窄 |
|
另外一种实现自动pandoc的简捷方法: 步骤一:
------------------------或者自动安装wkhtmltopdf软件,和pandoc类似(此步可跳过):--------------------------------
输入weaverwkhtmltopdf 以及weaverpandoc可同样自动安装wkhtmltopdf 和pandoc两种软件 ============================================================================ 步骤二:安装完成后,输入以下内容(其自动执行便是上述example-do.file)
进一步可使用synlight高亮: | - synlight example, replace style(imbi) size(14) cfont(Monaco) font("Lucida Console")
复制代码 |
|
| 方法二:(手动安装)
在安装两个命令后,可以到https://github.com/jgm/pandoc/releases/tag/1.15.0.6下载pandoc,下载后不要选择默认安装路径
点击advanced——install for all users of this machine,将其安装在ado/plus/Weaver/Pandoc文件夹下 (自行在ado/plus/下建Weaver文件夹和Pandoc文件夹)
注:举例生成Tex见9楼和10楼
举例二:使用ketchup转smcl为pdf
同样ketchup命令的运行需要借助princexml第三方软件:以下同样分手动和自动两种方法介绍:
安装方法一:手动
举例三:使用Weaver同时将smcl输出为html和pdf
| 以help weaver为例,其中style(minimal)来自(scheme_rbn1mono),findit scheme_rbn1mono即可: | 3.命令作者
E. F. Haghish
Center for Medical Biometry and Medical Informatics
University of Freiburg, Germany
haghish@imbi.uni-freiburg.de
http://www.haghish.com/
命令举例下载:
- copy "http://www.haghish.com/talk/reproducible/markdown_syntax.do" "markdown_syntax.do"
- copy "http://www.haghish.com/talk/reproducible/chunks.do" "chunks.do"
- copy "http://www.haghish.com/talk/reproducible/markdoc_markdown.do" "markdoc_markdown.do"
- copy "http://www.haghish.com/talk/reproducible/markdoc_html.do" "markdoc_html.do"
- copy "http://www.haghish.com/talk/reproducible/markdoc_latex.do" "markdoc_latex.do"
- copy "http://www.haghish.com/talk/reproducible/weaver_example.do" "weaver_example.do"
- copy "http://www.haghish.com/talk/reproducible/ketchup_example.do" "ketchup_example.do"
复制代码 命令的更新:- adoupdate ketchup,update
- adoupdate weaver,update
- adoupdate markdoc,update
复制代码 | 4.与文学化编程相关的其他命令
|
ascii (17楼)
asciiplot (18楼)
cv (20楼) |
扫码加我 拉你入群
请注明:姓名-公司-职位
以便审核进群资格,未注明则拒绝
|