楼主: 匿名
6064 11

[Stata] [Stata]日志管理(三):markdoc/weaver/ketchup_专业输出命令集 [推广有奖]

匿名网友
楼主
匿名网友  发表于 2015-8-25 22:33:35 |坛友微信交流群|倒序 |AI写论文
相似文件 换一批

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币

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.    
  8.              Using Markdown (heading 2)
  9.              --------------------------
  10.    
  11.              Writing with __markdown__ syntax allows you to add text and graphs to
  12.              _smcl_ logfile and export it to a editable document format. I will demonstrate
  13.              the process by using the __Auto.dta__ dataset.

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

  18.      sysuse auto, clear

  19.      list in 1/5

  20.     histogram price

  21.     graph export graph.png, replace

  22.             /*
  23.    
  24.              Adding a graph or image in the report
  25.              ======================================

  26.              Adding a graph using Markdown
  27.              -----------------------------
  28.    
  29.              In order to add a graph using Markdown, I export the graph in PNG format.
  30.              You can explain the graph in the "brackets" and define the file path in parentheses
  31.             
  32.              ![explain the graph](./graph.png)

  33.              Adding a graph using HTML
  34.              -------------------------

  35.              By using HTML tag to add a graph, you can also resize the graph. Just include
  36.              a code similar to the one below and specify the source. The width and height
  37.              options specify the size of the graph.
  38.             
  39.              <img src="./graph.png" width=350 height=230 >

  40.              */

  41.     qui log c
  42.     markdoc example, replace export(docx)
  43.     markdoc example, replace export(html)
复制代码

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

1.JPG

x.JPG

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

m.JPG

点击example.docx:

5.PNG

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

y.png

1.JPG

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

步骤一:

  1. markdocpandoc
复制代码

markdocpandoc.png

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

  1. markdocwkhtmltopdf
复制代码

mk.png

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

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

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

  1. markdoc,test
复制代码

markdoc_test.gif

进一步可使用synlight高亮:
  1. synlight example, replace style(imbi) size(14) cfont(Monaco)  font("Lucida Console")
复制代码

11.png


12.png

方法二:(手动安装)

在安装两个命令后,可以到https://github.com/jgm/pandoc/releases/tag/1.15.0.6下载pandoc,下载后不要选择默认安装路径

3.PNG

点击advanced——install for all users of this  machine,将其安装在ado/plus/Weaver/Pandoc文件夹下

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



11.png

x5.png


捕获.JPG



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


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

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

p.png

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

z.png

安装后:

9.png

安装方法二:自动

  1. weaverprince
复制代码

wwkk.png

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

d.png

H.png


举例三:使用Weaver同时将smcl输出为html和pdf

以help weaver为例,其中style(minimal)来自(scheme_rbn1mono),findit scheme_rbn1mono即可:

W1.png

W2.png

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楼)
二维码

扫码加我 拉你入群

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

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

关键词:Ketchup weaver Stata tata 日志管理 第三方软件 replace example 日志记录 命令集

weaver.zip

59.64 KB

markdoc.zip

11.85 KB

本附件包括:

  • markdoc.ado
  • markdoc.sthlp
  • markdoccheck.ado
  • markdocpandoc.ado
  • markdocversion.ado
  • txt.ado
  • txt.sthlp

ketchup.zip

29.67 KB

本附件包括:

  • ketchup.ado
  • ketchup.sthlp
  • ketchupcheck.ado
  • ketchuppandoc.ado
  • ketchupprince.ado
  • ketchupversion.ado
  • ketchupwkhtmltopdf.ado

synlight.zip

19.12 KB

本附件包括:

  • syn.ado
  • syn.sthlp
  • synlight.ado
  • synlight.sthlp
  • synlightlist.ado
  • synlightversion.ado

file for Weaving with Markdown in MarkDoc(修改后).rar

1019 Bytes

Example Do‐file for Weaving with Markdown in MarkDoc

本附件包括:

  • Example Do‐file for Weaving with Markdown in MarkDoc(修改后).do

已有 1 人评分经验 论坛币 学术水平 热心指数 信用等级 收起 理由
xddlovejiao1314 + 100 + 100 + 5 + 5 + 5 精彩帖子

总评分: 经验 + 100  论坛币 + 100  学术水平 + 5  热心指数 + 5  信用等级 + 5   查看全部评分

本帖被以下文库推荐

沙发
rrjj101022 发表于 2015-8-26 06:00:34 |只看作者 |坛友微信交流群
谢谢分享~~~
已有 2 人评分经验 论坛币 收起 理由
xddlovejiao1314 + 10 + 3 鼓励积极发帖讨论
niuniuyiwan + 5 感谢支持

总评分: 经验 + 10  论坛币 + 8   查看全部评分

使用道具

藤椅
laojianga 发表于 2015-8-26 08:09:18 来自手机 |只看作者 |坛友微信交流群
niuniuyiwan 发表于 2015-8-25 22:33
1.命令安装
2.举例

已有 2 人评分经验 论坛币 收起 理由
xddlovejiao1314 + 10 + 3 鼓励积极发帖讨论
niuniuyiwan + 5 感谢支持

总评分: 经验 + 10  论坛币 + 8   查看全部评分

使用道具

板凳
laojianga 发表于 2015-8-26 17:29:55 |只看作者 |坛友微信交流群
laojianga 发表于 2015-8-26 08:09
最近也在学习stata  感觉很有用
已有 1 人评分热心指数 收起 理由
niuniuyiwan + 1 鼓励积极发帖讨论

总评分: 热心指数 + 1   查看全部评分

使用道具

报纸
yangruipis 学生认证  发表于 2015-8-26 23:34:14 来自手机 |只看作者 |坛友微信交流群
niuniuyiwan 发表于 2015-8-25 22:33
[/td][/tr]


谢谢楼主分享
已有 2 人评分经验 论坛币 收起 理由
xddlovejiao1314 + 10 + 3 鼓励积极发帖讨论
niuniuyiwan + 5 感谢支持

总评分: 经验 + 10  论坛币 + 8   查看全部评分

使用道具

地板
yangruipis 学生认证  发表于 2015-8-26 23:34:53 来自手机 |只看作者 |坛友微信交流群
niuniuyiwan 发表于 2015-8-25 22:33
[/td][/tr]


谢谢楼主分享
已有 1 人评分论坛币 收起 理由
niuniuyiwan + 5 精彩帖子

总评分: 论坛币 + 5   查看全部评分

使用道具

7
BlackHawk123 在职认证  发表于 2015-8-27 08:02:59 |只看作者 |坛友微信交流群
好贴啊好帖,谢谢分享。
已有 1 人评分经验 论坛币 收起 理由
xddlovejiao1314 + 10 + 3 鼓励积极发帖讨论

总评分: 经验 + 10  论坛币 + 3   查看全部评分

使用道具

8
niuniuyiwan 在职认证  发表于 2015-8-27 21:36:22 |只看作者 |坛友微信交流群
  1. ascii
复制代码

11.PNG



使用道具

9
niuniuyiwan 在职认证  发表于 2015-8-27 21:38:57 |只看作者 |坛友微信交流群
  1. asciiplot
  2.         asciiplot , scheme(lean1) saving(ascii.gph)
复制代码

Graph.png



已有 1 人评分经验 论坛币 收起 理由
xddlovejiao1314 + 100 + 100 精彩帖子

总评分: 经验 + 100  论坛币 + 100   查看全部评分

使用道具

10
Alfred_G 学生认证  发表于 2015-9-1 19:00:57 |只看作者 |坛友微信交流群
清晰又实用,好贴~
已有 2 人评分经验 论坛币 收起 理由
xddlovejiao1314 + 10 + 3 鼓励积极发帖讨论
niuniuyiwan + 5 感谢支持

总评分: 经验 + 10  论坛币 + 8   查看全部评分

使用道具

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注jltj
拉您入交流群

京ICP备16021002-2号 京B2-20170662号 京公网安备 11010802022788号 论坛法律顾问:王进律师 知识产权保护声明   免责及隐私声明

GMT+8, 2024-4-19 13:36