搜索
人大经济论坛 附件下载

附件下载

所在主题:
文件名:  markdoc.zip
资料下载链接地址: https://bbs.pinggu.org/a-1862757.html
本附件包括:
  • markdoc.ado
  • markdoc.sthlp
  • markdoccheck.ado
  • markdocpandoc.ado
  • markdocversion.ado
  • txt.ado
  • txt.sthlp
附件大小:
11.85 KB   举报本内容

markdoc/weaver/ketchup:日志文件(smcl)与docx/pdf/html/tex/epub的完美结合

1.命令安装

  1. ssc install ketchup
  2. ssc install markdoc
  3. ssc install weaver
  4. ssc install synlight
复制代码
以上命令请同时安装:
2.举例一(使用markdoc和weaver转smcl为docx/html)

markdoc命令的运行过程借助于第三方软件pandoc,其安装过程以下分手动和自动两种分别介绍:

首先介绍自动安装:

  1. set linesize 80 //列宽80打印效果较佳

  2. log close//暂时关闭日志记录
  3. qui log using example, replace

  4. /*
  5. Introduction to MarkDoc (heading 1)
  6. ===================================

  7. Using Markdown (heading 2)
  8. --------------------------

  9. Writing with __markdown__ syntax allows you to add text and graphs to
  10. _smcl_ logfile and export it to a editable document format. I will demonstrate
  11. the process by using the __Auto.dta__ dataset.

  12. ###Get started with MarkDoc (heading 3)
  13. I will open the dataset, list a few observations, and export a graph.
  14. Then I will export the logfile to Microsoft Office docx format.
  15. */

  16. sysuse auto, clear

  17. list in 1/5

  18. histogram price

  19. graph export graph.png, replace

  20. /*

  21. Adding a graph or image in the report
  22. ======================================

  23. Adding a graph using Markdown
  24. -----------------------------

  25. In order to add a graph using Markdown, I export the graph in PNG format.
  26. You can explain the graph in the "brackets" and define the file path in parentheses

  27. ![explain the graph](./graph.png)

  28. Adding a graph using HTML
  29. -------------------------

  30. By using HTML tag to add a graph, you can also resize the graph. Just include
  31. a code similar to the one below and specify the source. The width and height
  32. options specify the size of the graph.

  33. <img src="./graph.png" width=350 height=230 >

  34. */

  35. qui log c
  36. markdoc example, replace export(docx)
  37. markdoc example, replace export(html)
复制代码

由于缺少pandoc软件,这时出现安装pandoc字样提示自动/手动安装(箭头处),点击自动安装:

这时Stata会自动创建一个Weaver文件夹,将pandoc程序包(1.13.1)下载后通过自动解压,安装完毕后,重新运行上述do-file,最后可见:

点击example.docx:

注意:请调整页边距呈现最佳效果,页面布局——页边距——窄

另外一种实现自动pandoc的简捷方法:

步骤一:

  1. markdocpandoc
复制代码

------------------------或者自动安装wkhtmltopdf软件,和pandoc类似(此步可跳过):--------------------------------

  1. markdocwkhtmltopdf
复制代码

输入weaverwkhtmltopdf 以及weaverpandoc可同样自动安装wkhtmltopdf 和pandoc两种软件

============================================================================

步骤二:安装完成后,输入以下内容(其自动执行便是上述example-do.file)

  1. markdoc,test
复制代码

进一步可使用synlight高亮:
  1. 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 thismachine,将其安装在ado/plus/Weaver/Pandoc文件夹下

(自行在ado/plus/下建Weaver文件夹和Pandoc文件夹)






注:举例生成Tex见9楼和10楼


举例二:使用ketchup转smcl为pdf
同样ketchup命令的运行需要借助princexml第三方软件:以下同样分手动和自动两种方法介绍:
安装方法一:手动

首先安装princexml: http://www.princexml.com/download/

选择安装至上述Weaver文件夹,自建Prince文件夹(New Folder修改为Prince,注意大写P)

安装后:

安装方法二:自动

  1. weaverprince
复制代码

  1. //以help ketchup中的例子简述:
复制代码


举例三:使用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/
命令举例下载:
  1. copy "http://www.haghish.com/talk/reproducible/markdown_syntax.do" "markdown_syntax.do"
  2. copy "http://www.haghish.com/talk/reproducible/chunks.do" "chunks.do"
  3. copy "http://www.haghish.com/talk/reproducible/markdoc_markdown.do" "markdoc_markdown.do"
  4. copy "http://www.haghish.com/talk/reproducible/markdoc_html.do" "markdoc_html.do"
  5. copy "http://www.haghish.com/talk/reproducible/markdoc_latex.do" "markdoc_latex.do"
  6. copy "http://www.haghish.com/talk/reproducible/weaver_example.do" "weaver_example.do"
  7. copy "http://www.haghish.com/talk/reproducible/ketchup_example.do" "ketchup_example.do"
复制代码
命令的更新:
  1. adoupdate ketchup,update
  2. adoupdate weaver,update
  3. adoupdate markdoc,update
复制代码
4.与文学化编程相关的其他命令
ascii (17楼)
asciiplot (18楼)
cv (20楼)


    熟悉论坛请点击新手指南
下载说明
1、论坛支持迅雷和网际快车等p2p多线程软件下载,请在上面选择下载通道单击右健下载即可。
2、论坛会定期自动批量更新下载地址,所以请不要浪费时间盗链论坛资源,盗链地址会很快失效。
3、本站为非盈利性质的学术交流网站,鼓励和保护原创作品,拒绝未经版权人许可的上传行为。本站如接到版权人发出的合格侵权通知,将积极的采取必要措施;同时,本站也将在技术手段和能力范围内,履行版权保护的注意义务。
(如有侵权,欢迎举报)
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

GMT+8, 2025-12-25 09:12