diff --git a/published/20140607 Five things that make Go fast.md b/published/201810/20140607 Five things that make Go fast.md similarity index 100% rename from published/20140607 Five things that make Go fast.md rename to published/201810/20140607 Five things that make Go fast.md diff --git a/published/20161014 Compiling Lisp to JavaScript From Scratch in 350 LOC.md b/published/201810/20161014 Compiling Lisp to JavaScript From Scratch in 350 LOC.md similarity index 100% rename from published/20161014 Compiling Lisp to JavaScript From Scratch in 350 LOC.md rename to published/201810/20161014 Compiling Lisp to JavaScript From Scratch in 350 LOC.md diff --git a/published/20170810 How we built our first full-stack JavaScript web app in three weeks.md b/published/201810/20170810 How we built our first full-stack JavaScript web app in three weeks.md similarity index 100% rename from published/20170810 How we built our first full-stack JavaScript web app in three weeks.md rename to published/201810/20170810 How we built our first full-stack JavaScript web app in three weeks.md diff --git a/published/20170926 Managing users on Linux systems.md b/published/201810/20170926 Managing users on Linux systems.md similarity index 100% rename from published/20170926 Managing users on Linux systems.md rename to published/201810/20170926 Managing users on Linux systems.md diff --git a/published/20171022 Review- Algorithms to Live By by Brian Christian - Tom Griffiths.md b/published/201810/20171022 Review- Algorithms to Live By by Brian Christian - Tom Griffiths.md similarity index 100% rename from published/20171022 Review- Algorithms to Live By by Brian Christian - Tom Griffiths.md rename to published/201810/20171022 Review- Algorithms to Live By by Brian Christian - Tom Griffiths.md diff --git a/published/20171129 How to Install and Use Wireshark on Debian and Ubuntu 16.04_17.10.md b/published/201810/20171129 How to Install and Use Wireshark on Debian and Ubuntu 16.04_17.10.md similarity index 100% rename from published/20171129 How to Install and Use Wireshark on Debian and Ubuntu 16.04_17.10.md rename to published/201810/20171129 How to Install and Use Wireshark on Debian and Ubuntu 16.04_17.10.md diff --git a/published/20171204 Improve your Bash scripts with Argbash.md b/published/201810/20171204 Improve your Bash scripts with Argbash.md similarity index 100% rename from published/20171204 Improve your Bash scripts with Argbash.md rename to published/201810/20171204 Improve your Bash scripts with Argbash.md diff --git a/published/20171208 24 Must Have Essential Linux Applications In 2017.md b/published/201810/20171208 24 Must Have Essential Linux Applications In 2017.md similarity index 100% rename from published/20171208 24 Must Have Essential Linux Applications In 2017.md rename to published/201810/20171208 24 Must Have Essential Linux Applications In 2017.md diff --git a/published/20171214 Peeking into your Linux packages.md b/published/201810/20171214 Peeking into your Linux packages.md similarity index 100% rename from published/20171214 Peeking into your Linux packages.md rename to published/201810/20171214 Peeking into your Linux packages.md diff --git a/published/20180105 The Best Linux Distributions for 2018.md b/published/201810/20180105 The Best Linux Distributions for 2018.md similarity index 100% rename from published/20180105 The Best Linux Distributions for 2018.md rename to published/201810/20180105 The Best Linux Distributions for 2018.md diff --git a/published/20180117 How to get into DevOps.md b/published/201810/20180117 How to get into DevOps.md similarity index 100% rename from published/20180117 How to get into DevOps.md rename to published/201810/20180117 How to get into DevOps.md diff --git a/published/20180123 Moving to Linux from dated Windows machines.md b/published/201810/20180123 Moving to Linux from dated Windows machines.md similarity index 100% rename from published/20180123 Moving to Linux from dated Windows machines.md rename to published/201810/20180123 Moving to Linux from dated Windows machines.md diff --git a/published/20180201 Conditional Rendering in React using Ternaries and.md b/published/201810/20180201 Conditional Rendering in React using Ternaries and.md similarity index 100% rename from published/20180201 Conditional Rendering in React using Ternaries and.md rename to published/201810/20180201 Conditional Rendering in React using Ternaries and.md diff --git a/published/20180201 Rock Solid React.js Foundations A Beginners Guide.md b/published/201810/20180201 Rock Solid React.js Foundations A Beginners Guide.md similarity index 100% rename from published/20180201 Rock Solid React.js Foundations A Beginners Guide.md rename to published/201810/20180201 Rock Solid React.js Foundations A Beginners Guide.md diff --git a/published/20180329 How to configure multiple websites with Apache web server.md b/published/201810/20180329 How to configure multiple websites with Apache web server.md similarity index 100% rename from published/20180329 How to configure multiple websites with Apache web server.md rename to published/201810/20180329 How to configure multiple websites with Apache web server.md diff --git a/published/20180412 A Desktop GUI Application For NPM.md b/published/201810/20180412 A Desktop GUI Application For NPM.md similarity index 100% rename from published/20180412 A Desktop GUI Application For NPM.md rename to published/201810/20180412 A Desktop GUI Application For NPM.md diff --git a/published/20180413 The df Command Tutorial With Examples For Beginners.md b/published/201810/20180413 The df Command Tutorial With Examples For Beginners.md similarity index 100% rename from published/20180413 The df Command Tutorial With Examples For Beginners.md rename to published/201810/20180413 The df Command Tutorial With Examples For Beginners.md diff --git a/published/20180522 Free Resources for Securing Your Open Source Code.md b/published/201810/20180522 Free Resources for Securing Your Open Source Code.md similarity index 100% rename from published/20180522 Free Resources for Securing Your Open Source Code.md rename to published/201810/20180522 Free Resources for Securing Your Open Source Code.md diff --git a/published/20180528 What is behavior-driven Python.md b/published/201810/20180528 What is behavior-driven Python.md similarity index 100% rename from published/20180528 What is behavior-driven Python.md rename to published/201810/20180528 What is behavior-driven Python.md diff --git a/published/20180531 How to create shortcuts in vi.md b/published/201810/20180531 How to create shortcuts in vi.md similarity index 100% rename from published/20180531 How to create shortcuts in vi.md rename to published/201810/20180531 How to create shortcuts in vi.md diff --git a/published/20180601 Download an OS with GNOME Boxes.md b/published/201810/20180601 Download an OS with GNOME Boxes.md similarity index 100% rename from published/20180601 Download an OS with GNOME Boxes.md rename to published/201810/20180601 Download an OS with GNOME Boxes.md diff --git a/published/20180615 How To Rename Multiple Files At Once In Linux.md b/published/201810/20180615 How To Rename Multiple Files At Once In Linux.md similarity index 100% rename from published/20180615 How To Rename Multiple Files At Once In Linux.md rename to published/201810/20180615 How To Rename Multiple Files At Once In Linux.md diff --git a/published/20180703 Install Oracle VirtualBox On Ubuntu 18.04 LTS Headless Server.md b/published/201810/20180703 Install Oracle VirtualBox On Ubuntu 18.04 LTS Headless Server.md similarity index 100% rename from published/20180703 Install Oracle VirtualBox On Ubuntu 18.04 LTS Headless Server.md rename to published/201810/20180703 Install Oracle VirtualBox On Ubuntu 18.04 LTS Headless Server.md diff --git a/published/20180704 Setup Headless Virtualization Server Using KVM In Ubuntu 18.04 LTS.md b/published/201810/20180704 Setup Headless Virtualization Server Using KVM In Ubuntu 18.04 LTS.md similarity index 100% rename from published/20180704 Setup Headless Virtualization Server Using KVM In Ubuntu 18.04 LTS.md rename to published/201810/20180704 Setup Headless Virtualization Server Using KVM In Ubuntu 18.04 LTS.md diff --git a/published/20180709 How To Configure SSH Key-based Authentication In Linux.md b/published/201810/20180709 How To Configure SSH Key-based Authentication In Linux.md similarity index 100% rename from published/20180709 How To Configure SSH Key-based Authentication In Linux.md rename to published/201810/20180709 How To Configure SSH Key-based Authentication In Linux.md diff --git a/published/20180715 Why is Python so slow.md b/published/201810/20180715 Why is Python so slow.md similarity index 100% rename from published/20180715 Why is Python so slow.md rename to published/201810/20180715 Why is Python so slow.md diff --git a/published/20180724 75 Most Used Essential Linux Applications of 2018.md b/published/201810/20180724 75 Most Used Essential Linux Applications of 2018.md similarity index 100% rename from published/20180724 75 Most Used Essential Linux Applications of 2018.md rename to published/201810/20180724 75 Most Used Essential Linux Applications of 2018.md diff --git a/published/20180724 Building a network attached storage device with a Raspberry Pi.md b/published/201810/20180724 Building a network attached storage device with a Raspberry Pi.md similarity index 100% rename from published/20180724 Building a network attached storage device with a Raspberry Pi.md rename to published/201810/20180724 Building a network attached storage device with a Raspberry Pi.md diff --git a/published/20180803 5 Essential Tools for Linux Development.md b/published/201810/20180803 5 Essential Tools for Linux Development.md similarity index 100% rename from published/20180803 5 Essential Tools for Linux Development.md rename to published/201810/20180803 5 Essential Tools for Linux Development.md diff --git a/published/20180810 How To Remove Or Disable Ubuntu Dock.md b/published/201810/20180810 How To Remove Or Disable Ubuntu Dock.md similarity index 100% rename from published/20180810 How To Remove Or Disable Ubuntu Dock.md rename to published/201810/20180810 How To Remove Or Disable Ubuntu Dock.md diff --git a/published/20180813 5 of the Best Linux Educational Software and Games for Kids.md b/published/201810/20180813 5 of the Best Linux Educational Software and Games for Kids.md similarity index 100% rename from published/20180813 5 of the Best Linux Educational Software and Games for Kids.md rename to published/201810/20180813 5 of the Best Linux Educational Software and Games for Kids.md diff --git a/published/20180814 Automating backups on a Raspberry Pi NAS.md b/published/201810/20180814 Automating backups on a Raspberry Pi NAS.md similarity index 100% rename from published/20180814 Automating backups on a Raspberry Pi NAS.md rename to published/201810/20180814 Automating backups on a Raspberry Pi NAS.md diff --git a/published/20180815 How to Create M3U Playlists in Linux [Quick Tip].md b/published/201810/20180815 How to Create M3U Playlists in Linux [Quick Tip].md similarity index 100% rename from published/20180815 How to Create M3U Playlists in Linux [Quick Tip].md rename to published/201810/20180815 How to Create M3U Playlists in Linux [Quick Tip].md diff --git a/published/20180816 Add YouTube Player Controls To Your Linux Desktop With browser-mpris2 (Chrome Extension).md b/published/201810/20180816 Add YouTube Player Controls To Your Linux Desktop With browser-mpris2 (Chrome Extension).md similarity index 100% rename from published/20180816 Add YouTube Player Controls To Your Linux Desktop With browser-mpris2 (Chrome Extension).md rename to published/201810/20180816 Add YouTube Player Controls To Your Linux Desktop With browser-mpris2 (Chrome Extension).md diff --git a/published/20180817 How To Lock The Keyboard And Mouse, But Not The Screen In Linux.md b/published/201810/20180817 How To Lock The Keyboard And Mouse, But Not The Screen In Linux.md similarity index 100% rename from published/20180817 How To Lock The Keyboard And Mouse, But Not The Screen In Linux.md rename to published/201810/20180817 How To Lock The Keyboard And Mouse, But Not The Screen In Linux.md diff --git a/published/20180821 A checklist for submitting your first Linux kernel patch.md b/published/201810/20180821 A checklist for submitting your first Linux kernel patch.md similarity index 100% rename from published/20180821 A checklist for submitting your first Linux kernel patch.md rename to published/201810/20180821 A checklist for submitting your first Linux kernel patch.md diff --git a/published/20180823 CLI- improved.md b/published/201810/20180823 CLI- improved.md similarity index 100% rename from published/20180823 CLI- improved.md rename to published/201810/20180823 CLI- improved.md diff --git a/published/20180823 How To Easily And Safely Manage Cron Jobs In Linux.md b/published/201810/20180823 How To Easily And Safely Manage Cron Jobs In Linux.md similarity index 100% rename from published/20180823 How To Easily And Safely Manage Cron Jobs In Linux.md rename to published/201810/20180823 How To Easily And Safely Manage Cron Jobs In Linux.md diff --git a/published/20180824 5 cool music player apps.md b/published/201810/20180824 5 cool music player apps.md similarity index 100% rename from published/20180824 5 cool music player apps.md rename to published/201810/20180824 5 cool music player apps.md diff --git a/published/20180824 What Stable Kernel Should I Use.md b/published/201810/20180824 What Stable Kernel Should I Use.md similarity index 100% rename from published/20180824 What Stable Kernel Should I Use.md rename to published/201810/20180824 What Stable Kernel Should I Use.md diff --git a/published/20180827 4 tips for better tmux sessions.md b/published/201810/20180827 4 tips for better tmux sessions.md similarity index 100% rename from published/20180827 4 tips for better tmux sessions.md rename to published/201810/20180827 4 tips for better tmux sessions.md diff --git a/published/20180827 A sysadmin-s guide to containers.md b/published/201810/20180827 A sysadmin-s guide to containers.md similarity index 100% rename from published/20180827 A sysadmin-s guide to containers.md rename to published/201810/20180827 A sysadmin-s guide to containers.md diff --git a/published/20180827 Solve -error- failed to commit transaction (conflicting files)- In Arch Linux.md b/published/201810/20180827 Solve -error- failed to commit transaction (conflicting files)- In Arch Linux.md similarity index 100% rename from published/20180827 Solve -error- failed to commit transaction (conflicting files)- In Arch Linux.md rename to published/201810/20180827 Solve -error- failed to commit transaction (conflicting files)- In Arch Linux.md diff --git a/published/20180830 6 places to host your git repository.md b/published/201810/20180830 6 places to host your git repository.md similarity index 100% rename from published/20180830 6 places to host your git repository.md rename to published/201810/20180830 6 places to host your git repository.md diff --git a/published/20180901 5 Ways to Take Screenshot in Linux GUI and Terminal.md b/published/201810/20180901 5 Ways to Take Screenshot in Linux GUI and Terminal.md similarity index 100% rename from published/20180901 5 Ways to Take Screenshot in Linux GUI and Terminal.md rename to published/201810/20180901 5 Ways to Take Screenshot in Linux GUI and Terminal.md diff --git a/published/201810/20180901 Flameshot - A Simple, Yet Powerful Feature-rich Screenshot Tool.md b/published/201810/20180901 Flameshot - A Simple, Yet Powerful Feature-rich Screenshot Tool.md new file mode 100644 index 0000000000..a34c575261 --- /dev/null +++ b/published/201810/20180901 Flameshot - A Simple, Yet Powerful Feature-rich Screenshot Tool.md @@ -0,0 +1,164 @@ +Flameshot:一个简洁但功能丰富的截图工具 +====== + +![](https://www.ostechnix.com/wp-content/uploads/2018/09/Flameshot-720x340.png) + +截图是我工作的一部分,我先前使用深度截图工具来截图,深度截图是一个简单、轻量级且非常简洁的截图工具。它自带许多功能例如窗口识别、快捷键支持、图片编辑、延时截图、社交分享、智能存储以及图片清晰度调整等功能。今天我碰巧发现了另一个具备多种功能的截图工具,它就是 **Flameshot** ,一个简单但功能丰富的针对类 Unix 系统的截图工具。它简单易用,可定制并且有选项可以支持上传截图到在线图片分享网站 **imgur** 上。同时 Flameshot 有一个 CLI 版本,所以你也可以从命令行来进行截图。Flameshot 是一个完全免费且开源的工具。在本教程中,我们将看到如何安装 Flameshot 以及如何使用它来截图。 + +### 安装 Flameshot + +**在 Arch Linux 上:** + +Flameshot 可以从 Arch LInux 的 [community] 仓库中获取。确保你已经启用了 community 仓库,然后就可以像下面展示的那样使用 pacman 来安装 Flameshot : + +``` +$ sudo pacman -S flameshot +``` + +它也可以从 [**AUR**][1] 中获取,所以你还可以使用任意一个 AUR 帮助程序(例如 [**Yay**][2])来在基于 Arch 的系统中安装它: + +``` +$ yay -S flameshot-git +``` + +**在 Fedora 中:** + +``` +$ sudo dnf install flameshot +``` + +在 **Debian 10+** 和 **Ubuntu 18.04+** 中,可以使用 APT 包管理器来安装它: + +``` +$ sudo apt install flameshot +``` + +**在 openSUSE 上:** + +``` +$ sudo zypper install flameshot +``` + +在其他的 Linux 发行版中,可以从源代码编译并安装它。编译过程中需要 **Qt version 5.3** 以及 **GCC 4.9.2** 或者它们的更高版本。 + +### 使用 + +可以从菜单或者应用启动器中启动 Flameshot。在 MATE 桌面环境,它通常可以在 “Applications -> Graphics” 下找到。 + +一旦打开了它,你就可以在系统面板中看到 Flameshot 的托盘图标。 + +**注意:** + +假如你使用 Gnome 桌面环境,为了能够看到系统托盘图标,你需要安装 [TopIcons][3] 扩展。 + +在 Flameshot 托盘图标上右击,你便会看到几个菜单项,例如打开配置窗口、信息窗口以及退出该应用。 + +要进行截图,只需要点击托盘图标就可以了。接着你将看到如何使用 Flameshot 的帮助窗口。选择一个截图区域,然后敲回车键便可以截屏了,点击右键便可以看到颜色拾取器,再敲空格键便可以查看屏幕侧边的面板。你可以使用鼠标的滚轮来增加或者减少指针的宽度。 + +Flameshot 自带一系列非常好的功能,例如: + +* 可以进行手写 +* 可以划直线 +* 可以画长方形或者圆形框 +* 可以进行长方形区域选择 +* 可以画箭头 +* 可以对要点进行标注 +* 可以添加文本 +* 可以对图片或者文字进行模糊处理 +* 可以展示图片的尺寸大小 +* 在编辑图片是可以进行撤销和重做操作 +* 可以将选择的东西复制到剪贴板 +* 可以保存选区 +* 可以离开截屏 +* 可以选择另一个 app 来打开图片 +* 可以上传图片到 imgur 网站 +* 可以将图片固定到桌面上 + +下面是一个示例的视频: + + + +### 快捷键 + +Frameshot 也支持快捷键。在 Flameshot 的托盘图标上右击并点击 “Information” 窗口便可以看到在 GUI 模式下所有可用的快捷键。下面是在 GUI 模式下可用的快捷键清单: + +| 快捷键 | 描述 | +|------------------------|------------------------------| +| `←`、`↓`、`↑`、`→` | 移动选择区域 1px | +| `Shift` + `←`、`↓`、`↑`、`→` | 将选择区域大小更改 1px | +| `Esc` | 退出截图 | +| `Ctrl` + `C` | 复制到粘贴板 | +| `Ctrl` + `S` | 将选择区域保存为文件 | +| `Ctrl` + `Z` | 撤销最近的一次操作 | +| 鼠标右键 | 展示颜色拾取器 | +| 鼠标滚轮 | 改变工具的宽度 | + +边按住 `Shift` 键并拖动选择区域的其中一个控制点将会对它相反方向的控制点做类似的拖放操作。 + +### 命令行选项 + +Flameshot 也支持一系列的命令行选项来延时截图和保存图片到自定义的路径。 + +要使用 Flameshot GUI 模式,运行: + +``` +$ flameshot gui +``` + +要使用 GUI 模式截屏并将你选取的区域保存到一个自定义的路径,运行: + +``` +$ flameshot gui -p ~/myStuff/captures +``` + +要延时 2 秒后打开 GUI 模式可以使用: + +``` +$ flameshot gui -d 2000 +``` + +要延时 2 秒并将截图保存到一个自定义的路径(无 GUI)可以使用: + +``` +$ flameshot full -p ~/myStuff/captures -d 2000 +``` + +要截图全屏并保存到自定义的路径和粘贴板中使用: + +``` +$ flameshot full -c -p ~/myStuff/captures +``` + +要在截屏中包含鼠标并将图片保存为 PNG 格式可以使用: + +``` +$ flameshot screen -r +``` + +要对屏幕 1 进行截屏并将截屏复制到粘贴板中可以运行: + +``` +$ flameshot screen -n 1 -c +``` + +你还需要什么功能呢?Flameshot 拥有几乎截屏的所有功能:添加注释、编辑图片、模糊处理或者对要点做高亮等等功能。我想:在我找到它的最佳替代品之前,我将一直使用 Flameshot 来作为我当前的截图工具。请尝试一下它,你不会失望的。 + +好了,这就是今天的全部内容了。后续将有更多精彩内容,请保持关注! + +Cheers! + +-------------------------------------------------------------------------------- + +via: https://www.ostechnix.com/flameshot-a-simple-yet-powerful-feature-rich-screenshot-tool/ + +作者:[SK][a] +选题:[lujun9972](https://github.com/lujun9972) +译者:[FSSlc](https://github.com/FSSlc) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.ostechnix.com/author/sk/ +[1]: https://aur.archlinux.org/packages/flameshot-git +[2]: https://www.ostechnix.com/yay-found-yet-another-reliable-aur-helper/ +[3]: https://extensions.gnome.org/extension/1031/topicons/ diff --git a/published/20180906 How To Limit Network Bandwidth In Linux Using Wondershaper.md b/published/201810/20180906 How To Limit Network Bandwidth In Linux Using Wondershaper.md similarity index 100% rename from published/20180906 How To Limit Network Bandwidth In Linux Using Wondershaper.md rename to published/201810/20180906 How To Limit Network Bandwidth In Linux Using Wondershaper.md diff --git a/published/20180907 How to Use the Netplan Network Configuration Tool on Linux.md b/published/201810/20180907 How to Use the Netplan Network Configuration Tool on Linux.md similarity index 100% rename from published/20180907 How to Use the Netplan Network Configuration Tool on Linux.md rename to published/201810/20180907 How to Use the Netplan Network Configuration Tool on Linux.md diff --git a/published/20180910 How To List An Available Package Groups In Linux.md b/published/201810/20180910 How To List An Available Package Groups In Linux.md similarity index 100% rename from published/20180910 How To List An Available Package Groups In Linux.md rename to published/201810/20180910 How To List An Available Package Groups In Linux.md diff --git a/published/20180912 How to build rpm packages.md b/published/201810/20180912 How to build rpm packages.md similarity index 100% rename from published/20180912 How to build rpm packages.md rename to published/201810/20180912 How to build rpm packages.md diff --git a/published/20180913 ScreenCloud- The Screenshot-- App.md b/published/201810/20180913 ScreenCloud- The Screenshot-- App.md similarity index 100% rename from published/20180913 ScreenCloud- The Screenshot-- App.md rename to published/201810/20180913 ScreenCloud- The Screenshot-- App.md diff --git a/published/20180915 Backup Installed Packages And Restore Them On Freshly Installed Ubuntu.md b/published/201810/20180915 Backup Installed Packages And Restore Them On Freshly Installed Ubuntu.md similarity index 100% rename from published/20180915 Backup Installed Packages And Restore Them On Freshly Installed Ubuntu.md rename to published/201810/20180915 Backup Installed Packages And Restore Them On Freshly Installed Ubuntu.md diff --git a/published/20180915 Linux vs Mac- 7 Reasons Why Linux is a Better Choice than Mac.md b/published/201810/20180915 Linux vs Mac- 7 Reasons Why Linux is a Better Choice than Mac.md similarity index 100% rename from published/20180915 Linux vs Mac- 7 Reasons Why Linux is a Better Choice than Mac.md rename to published/201810/20180915 Linux vs Mac- 7 Reasons Why Linux is a Better Choice than Mac.md diff --git a/published/20180917 4 scanning tools for the Linux desktop.md b/published/201810/20180917 4 scanning tools for the Linux desktop.md similarity index 100% rename from published/20180917 4 scanning tools for the Linux desktop.md rename to published/201810/20180917 4 scanning tools for the Linux desktop.md diff --git a/published/20180917 Getting started with openmediavault- A home NAS solution.md b/published/201810/20180917 Getting started with openmediavault- A home NAS solution.md similarity index 100% rename from published/20180917 Getting started with openmediavault- A home NAS solution.md rename to published/201810/20180917 Getting started with openmediavault- A home NAS solution.md diff --git a/published/20180918 Linux firewalls- What you need to know about iptables and firewalld.md b/published/201810/20180918 Linux firewalls- What you need to know about iptables and firewalld.md similarity index 100% rename from published/20180918 Linux firewalls- What you need to know about iptables and firewalld.md rename to published/201810/20180918 Linux firewalls- What you need to know about iptables and firewalld.md diff --git a/published/20180918 Top 3 Python libraries for data science.md b/published/201810/20180918 Top 3 Python libraries for data science.md similarity index 100% rename from published/20180918 Top 3 Python libraries for data science.md rename to published/201810/20180918 Top 3 Python libraries for data science.md diff --git a/published/20180919 Host your own cloud with Raspberry Pi NAS.md b/published/201810/20180919 Host your own cloud with Raspberry Pi NAS.md similarity index 100% rename from published/20180919 Host your own cloud with Raspberry Pi NAS.md rename to published/201810/20180919 Host your own cloud with Raspberry Pi NAS.md diff --git a/published/20180919 How Writing Can Expand Your Skills and Grow Your Career.md b/published/201810/20180919 How Writing Can Expand Your Skills and Grow Your Career.md similarity index 100% rename from published/20180919 How Writing Can Expand Your Skills and Grow Your Career.md rename to published/201810/20180919 How Writing Can Expand Your Skills and Grow Your Career.md diff --git a/published/20180919 Linux Has a Code of Conduct and Not Everyone is Happy With it.md b/published/201810/20180919 Linux Has a Code of Conduct and Not Everyone is Happy With it.md similarity index 100% rename from published/20180919 Linux Has a Code of Conduct and Not Everyone is Happy With it.md rename to published/201810/20180919 Linux Has a Code of Conduct and Not Everyone is Happy With it.md diff --git a/published/20180920 8 Python packages that will simplify your life with Django.md b/published/201810/20180920 8 Python packages that will simplify your life with Django.md similarity index 100% rename from published/20180920 8 Python packages that will simplify your life with Django.md rename to published/201810/20180920 8 Python packages that will simplify your life with Django.md diff --git a/published/20180920 WinWorld - A Large Collection Of Defunct OSs, Software And Games.md b/published/201810/20180920 WinWorld - A Large Collection Of Defunct OSs, Software And Games.md similarity index 100% rename from published/20180920 WinWorld - A Large Collection Of Defunct OSs, Software And Games.md rename to published/201810/20180920 WinWorld - A Large Collection Of Defunct OSs, Software And Games.md diff --git a/published/20180921 Clinews - Read News And Latest Headlines From Commandline.md b/published/201810/20180921 Clinews - Read News And Latest Headlines From Commandline.md similarity index 100% rename from published/20180921 Clinews - Read News And Latest Headlines From Commandline.md rename to published/201810/20180921 Clinews - Read News And Latest Headlines From Commandline.md diff --git a/published/20180921 Control your data with Syncthing- An open source synchronization tool.md b/published/201810/20180921 Control your data with Syncthing- An open source synchronization tool.md similarity index 100% rename from published/20180921 Control your data with Syncthing- An open source synchronization tool.md rename to published/201810/20180921 Control your data with Syncthing- An open source synchronization tool.md diff --git a/published/20180924 A Simple, Beautiful And Cross-platform Podcast App.md b/published/201810/20180924 A Simple, Beautiful And Cross-platform Podcast App.md similarity index 100% rename from published/20180924 A Simple, Beautiful And Cross-platform Podcast App.md rename to published/201810/20180924 A Simple, Beautiful And Cross-platform Podcast App.md diff --git a/published/20180924 How To Find Out Which Port Number A Process Is Using In Linux.md b/published/201810/20180924 How To Find Out Which Port Number A Process Is Using In Linux.md similarity index 100% rename from published/20180924 How To Find Out Which Port Number A Process Is Using In Linux.md rename to published/201810/20180924 How To Find Out Which Port Number A Process Is Using In Linux.md diff --git a/published/20180924 Why Linux users should try Rust.md b/published/201810/20180924 Why Linux users should try Rust.md similarity index 100% rename from published/20180924 Why Linux users should try Rust.md rename to published/201810/20180924 Why Linux users should try Rust.md diff --git a/published/20180925 Hegemon - A Modular System Monitor Application Written In Rust.md b/published/201810/20180925 Hegemon - A Modular System Monitor Application Written In Rust.md similarity index 100% rename from published/20180925 Hegemon - A Modular System Monitor Application Written In Rust.md rename to published/201810/20180925 Hegemon - A Modular System Monitor Application Written In Rust.md diff --git a/published/20180925 How to Boot Ubuntu 18.04 - Debian 9 Server in Rescue (Single User mode) - Emergency Mode.md b/published/201810/20180925 How to Boot Ubuntu 18.04 - Debian 9 Server in Rescue (Single User mode) - Emergency Mode.md similarity index 100% rename from published/20180925 How to Boot Ubuntu 18.04 - Debian 9 Server in Rescue (Single User mode) - Emergency Mode.md rename to published/201810/20180925 How to Boot Ubuntu 18.04 - Debian 9 Server in Rescue (Single User mode) - Emergency Mode.md diff --git a/published/20180925 How to Replace one Linux Distro With Another in Dual Boot -Guide.md b/published/201810/20180925 How to Replace one Linux Distro With Another in Dual Boot -Guide.md similarity index 100% rename from published/20180925 How to Replace one Linux Distro With Another in Dual Boot -Guide.md rename to published/201810/20180925 How to Replace one Linux Distro With Another in Dual Boot -Guide.md diff --git a/published/20180926 3 open source distributed tracing tools.md b/published/201810/20180926 3 open source distributed tracing tools.md similarity index 100% rename from published/20180926 3 open source distributed tracing tools.md rename to published/201810/20180926 3 open source distributed tracing tools.md diff --git a/published/20180926 An introduction to swap space on Linux systems.md b/published/201810/20180926 An introduction to swap space on Linux systems.md similarity index 100% rename from published/20180926 An introduction to swap space on Linux systems.md rename to published/201810/20180926 An introduction to swap space on Linux systems.md diff --git a/published/20180926 CPU Power Manager - Control And Manage CPU Frequency In Linux.md b/published/201810/20180926 CPU Power Manager - Control And Manage CPU Frequency In Linux.md similarity index 100% rename from published/20180926 CPU Power Manager - Control And Manage CPU Frequency In Linux.md rename to published/201810/20180926 CPU Power Manager - Control And Manage CPU Frequency In Linux.md diff --git a/published/20180926 How to use the Scikit-learn Python library for data science projects.md b/published/201810/20180926 How to use the Scikit-learn Python library for data science projects.md similarity index 100% rename from published/20180926 How to use the Scikit-learn Python library for data science projects.md rename to published/201810/20180926 How to use the Scikit-learn Python library for data science projects.md diff --git a/published/20180927 5 cool tiling window managers.md b/published/201810/20180927 5 cool tiling window managers.md similarity index 100% rename from published/20180927 5 cool tiling window managers.md rename to published/201810/20180927 5 cool tiling window managers.md diff --git a/published/20180927 How To Find And Delete Duplicate Files In Linux.md b/published/201810/20180927 How To Find And Delete Duplicate Files In Linux.md similarity index 100% rename from published/20180927 How To Find And Delete Duplicate Files In Linux.md rename to published/201810/20180927 How To Find And Delete Duplicate Files In Linux.md diff --git a/published/20180927 How to Use RAR files in Ubuntu Linux.md b/published/201810/20180927 How to Use RAR files in Ubuntu Linux.md similarity index 100% rename from published/20180927 How to Use RAR files in Ubuntu Linux.md rename to published/201810/20180927 How to Use RAR files in Ubuntu Linux.md diff --git a/published/20180928 10 handy Bash aliases for Linux.md b/published/201810/20180928 10 handy Bash aliases for Linux.md similarity index 100% rename from published/20180928 10 handy Bash aliases for Linux.md rename to published/201810/20180928 10 handy Bash aliases for Linux.md diff --git a/published/20180928 A Free And Secure Online PDF Conversion Suite.md b/published/201810/20180928 A Free And Secure Online PDF Conversion Suite.md similarity index 100% rename from published/20180928 A Free And Secure Online PDF Conversion Suite.md rename to published/201810/20180928 A Free And Secure Online PDF Conversion Suite.md diff --git a/published/20180928 How to Install Popcorn Time on Ubuntu 18.04 and Other Linux Distributions.md b/published/201810/20180928 How to Install Popcorn Time on Ubuntu 18.04 and Other Linux Distributions.md similarity index 100% rename from published/20180928 How to Install Popcorn Time on Ubuntu 18.04 and Other Linux Distributions.md rename to published/201810/20180928 How to Install Popcorn Time on Ubuntu 18.04 and Other Linux Distributions.md diff --git a/published/20180930 Creator of the World Wide Web is Creating a New Decentralized Web.md b/published/201810/20180930 Creator of the World Wide Web is Creating a New Decentralized Web.md similarity index 100% rename from published/20180930 Creator of the World Wide Web is Creating a New Decentralized Web.md rename to published/201810/20180930 Creator of the World Wide Web is Creating a New Decentralized Web.md diff --git a/published/20181001 16 iptables tips and tricks for sysadmins.md b/published/201810/20181001 16 iptables tips and tricks for sysadmins.md similarity index 100% rename from published/20181001 16 iptables tips and tricks for sysadmins.md rename to published/201810/20181001 16 iptables tips and tricks for sysadmins.md diff --git a/published/20181001 How to Install Pip on Ubuntu.md b/published/201810/20181001 How to Install Pip on Ubuntu.md similarity index 100% rename from published/20181001 How to Install Pip on Ubuntu.md rename to published/201810/20181001 How to Install Pip on Ubuntu.md diff --git a/published/20181002 How use SSH and SFTP protocols on your home network.md b/published/201810/20181002 How use SSH and SFTP protocols on your home network.md similarity index 100% rename from published/20181002 How use SSH and SFTP protocols on your home network.md rename to published/201810/20181002 How use SSH and SFTP protocols on your home network.md diff --git a/published/20181003 Introducing Swift on Fedora.md b/published/201810/20181003 Introducing Swift on Fedora.md similarity index 100% rename from published/20181003 Introducing Swift on Fedora.md rename to published/201810/20181003 Introducing Swift on Fedora.md diff --git a/published/20181003 Tips for listing files with ls at the Linux command line.md b/published/201810/20181003 Tips for listing files with ls at the Linux command line.md similarity index 100% rename from published/20181003 Tips for listing files with ls at the Linux command line.md rename to published/201810/20181003 Tips for listing files with ls at the Linux command line.md diff --git a/published/20181004 PyTorch 1.0 Preview Release- Facebook-s newest Open Source AI.md b/published/201810/20181004 PyTorch 1.0 Preview Release- Facebook-s newest Open Source AI.md similarity index 100% rename from published/20181004 PyTorch 1.0 Preview Release- Facebook-s newest Open Source AI.md rename to published/201810/20181004 PyTorch 1.0 Preview Release- Facebook-s newest Open Source AI.md diff --git a/published/20181005 Open Source Logging Tools for Linux.md b/published/201810/20181005 Open Source Logging Tools for Linux.md similarity index 100% rename from published/20181005 Open Source Logging Tools for Linux.md rename to published/201810/20181005 Open Source Logging Tools for Linux.md diff --git a/published/20181008 Python at the pump- A script for filling your gas tank.md b/published/201810/20181008 Python at the pump- A script for filling your gas tank.md similarity index 100% rename from published/20181008 Python at the pump- A script for filling your gas tank.md rename to published/201810/20181008 Python at the pump- A script for filling your gas tank.md diff --git a/published/20181009 6 Commands To Shutdown And Reboot The Linux System From Terminal.md b/published/201810/20181009 6 Commands To Shutdown And Reboot The Linux System From Terminal.md similarity index 100% rename from published/20181009 6 Commands To Shutdown And Reboot The Linux System From Terminal.md rename to published/201810/20181009 6 Commands To Shutdown And Reboot The Linux System From Terminal.md diff --git a/published/20181009 Convert Screenshots of Equations into LaTeX Instantly With This Nifty Tool.md b/published/201810/20181009 Convert Screenshots of Equations into LaTeX Instantly With This Nifty Tool.md similarity index 100% rename from published/20181009 Convert Screenshots of Equations into LaTeX Instantly With This Nifty Tool.md rename to published/201810/20181009 Convert Screenshots of Equations into LaTeX Instantly With This Nifty Tool.md diff --git a/published/20181009 How To Create And Maintain Your Own Man Pages.md b/published/201810/20181009 How To Create And Maintain Your Own Man Pages.md similarity index 100% rename from published/20181009 How To Create And Maintain Your Own Man Pages.md rename to published/201810/20181009 How To Create And Maintain Your Own Man Pages.md diff --git a/published/20181010 Cloc - Count The Lines Of Source Code In Many Programming Languages.md b/published/201810/20181010 Cloc - Count The Lines Of Source Code In Many Programming Languages.md similarity index 100% rename from published/20181010 Cloc - Count The Lines Of Source Code In Many Programming Languages.md rename to published/201810/20181010 Cloc - Count The Lines Of Source Code In Many Programming Languages.md diff --git a/published/20181010 Design faster web pages, part 1- Image compression.md b/published/201810/20181010 Design faster web pages, part 1- Image compression.md similarity index 100% rename from published/20181010 Design faster web pages, part 1- Image compression.md rename to published/201810/20181010 Design faster web pages, part 1- Image compression.md diff --git a/published/20181010 How To List The Enabled-Active Repositories In Linux.md b/published/201810/20181010 How To List The Enabled-Active Repositories In Linux.md similarity index 100% rename from published/20181010 How To List The Enabled-Active Repositories In Linux.md rename to published/201810/20181010 How To List The Enabled-Active Repositories In Linux.md diff --git a/published/20181011 A Front-end For Popular Package Managers.md b/published/201810/20181011 A Front-end For Popular Package Managers.md similarity index 100% rename from published/20181011 A Front-end For Popular Package Managers.md rename to published/201810/20181011 A Front-end For Popular Package Managers.md diff --git a/published/20181011 Getting started with Minikube- Kubernetes on your laptop.md b/published/201810/20181011 Getting started with Minikube- Kubernetes on your laptop.md similarity index 100% rename from published/20181011 Getting started with Minikube- Kubernetes on your laptop.md rename to published/201810/20181011 Getting started with Minikube- Kubernetes on your laptop.md diff --git a/published/20181012 Command line quick tips- Reading files different ways.md b/published/201810/20181012 Command line quick tips- Reading files different ways.md similarity index 100% rename from published/20181012 Command line quick tips- Reading files different ways.md rename to published/201810/20181012 Command line quick tips- Reading files different ways.md diff --git a/published/20181012 Happy birthday, KDE- 11 applications you never knew existed.md b/published/201810/20181012 Happy birthday, KDE- 11 applications you never knew existed.md similarity index 100% rename from published/20181012 Happy birthday, KDE- 11 applications you never knew existed.md rename to published/201810/20181012 Happy birthday, KDE- 11 applications you never knew existed.md diff --git a/published/20181012 How To Lock Virtual Console Sessions On Linux.md b/published/201810/20181012 How To Lock Virtual Console Sessions On Linux.md similarity index 100% rename from published/20181012 How To Lock Virtual Console Sessions On Linux.md rename to published/201810/20181012 How To Lock Virtual Console Sessions On Linux.md diff --git a/published/20181013 How to Install GRUB on Arch Linux (UEFI).md b/published/201810/20181013 How to Install GRUB on Arch Linux (UEFI).md similarity index 100% rename from published/20181013 How to Install GRUB on Arch Linux (UEFI).md rename to published/201810/20181013 How to Install GRUB on Arch Linux (UEFI).md diff --git a/published/20181015 How To Browse And Read Entire Arch Wiki As Linux Man Pages.md b/published/201810/20181015 How To Browse And Read Entire Arch Wiki As Linux Man Pages.md similarity index 100% rename from published/20181015 How To Browse And Read Entire Arch Wiki As Linux Man Pages.md rename to published/201810/20181015 How To Browse And Read Entire Arch Wiki As Linux Man Pages.md diff --git a/published/20181015 Running Linux containers as a non-root with Podman.md b/published/201810/20181015 Running Linux containers as a non-root with Podman.md similarity index 100% rename from published/20181015 Running Linux containers as a non-root with Podman.md rename to published/201810/20181015 Running Linux containers as a non-root with Podman.md diff --git a/published/20181016 Turn Your Old PC into a Retrogaming Console with Lakka Linux.md b/published/201810/20181016 Turn Your Old PC into a Retrogaming Console with Lakka Linux.md similarity index 100% rename from published/20181016 Turn Your Old PC into a Retrogaming Console with Lakka Linux.md rename to published/201810/20181016 Turn Your Old PC into a Retrogaming Console with Lakka Linux.md diff --git a/published/20181018 MidnightBSD Hits 1.0- Checkout What-s New.md b/published/201810/20181018 MidnightBSD Hits 1.0- Checkout What-s New.md similarity index 100% rename from published/20181018 MidnightBSD Hits 1.0- Checkout What-s New.md rename to published/201810/20181018 MidnightBSD Hits 1.0- Checkout What-s New.md diff --git a/published/20181018 Understanding Linux Links- Part 1.md b/published/201810/20181018 Understanding Linux Links- Part 1.md similarity index 100% rename from published/20181018 Understanding Linux Links- Part 1.md rename to published/201810/20181018 Understanding Linux Links- Part 1.md diff --git a/published/201810/20181019 How to use Pandoc to produce a research paper.md b/published/201810/20181019 How to use Pandoc to produce a research paper.md new file mode 100644 index 0000000000..3ccbc8df1c --- /dev/null +++ b/published/201810/20181019 How to use Pandoc to produce a research paper.md @@ -0,0 +1,335 @@ +用 Pandoc 生成一篇调研论文 +====== + +> 学习如何用 Markdown 管理章节引用、图像、表格以及更多。 + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/life_paperclips.png?itok=j48op49T) + +这篇文章对于使用 [Markdown][1] 语法做一篇调研论文进行了一个深度体验。覆盖了如何创建和引用章节、图像(用 Markdown 和 [LaTeX][2])和参考书目。我们也讨论了一些棘手的案例和为什么使用 LaTex 是一个正确的做法。 + +### 调研 + +调研论文一般包括对章节、图像、表格和参考书目的引用。[Pandoc][3] 本身并不能交叉引用这些,但是它能够利用 [pandoc-crossref][4] 过滤器来完成自动编号和章节、图像、表格的交叉引用。 + +让我们从重写原本以 LaTax 撰写的 [一个教育调研报告的例子][5] 开始,然后用 Markdown(和一些 LaTax)、Pandoc 和 Pandoc-crossref 重写。 + +#### 添加并引用章节 + +要想章节被自动编号,必须使用 Markdown H1 标题编写。子章节使用 H2-H4 子标题编写(通常不需要更多级别了)。例如一个章节的标题是 “Implementation”,写作 `# Implementation {#sec: implementation}`,然后 Pandoc 会把它转化为 `3. Implementation `(或者转换为相应的章节编号)。`Implementation` 这个标题使用了 H1 并且声明了一个 `{#sec: implementation}` 的标签,这是作者用于引用该章节的标签。要想引用一个章节,输入 `@` 符号并跟上对应章节标签,使用方括号括起来即可: `[@ sec:implementation]` + +[在这篇论文中][5], 我们发现了下面这个例子: + +``` +we lack experience (consistency between TAs, [@sec:implementation]). +``` + +Pandoc 转换: + +``` +we lack experience (consistency between TAs, Section 4). +``` + +章节被自动编号(这在本文最后的 `Makefile` 当中说明)。要创建无编号的章节,输入章节的标题并在最后添加 `{-}`。例如:`### Designing a game for maintainability {-}` 就以标题 “Designing a game for maintainability”,创建了一个无标号的章节。 + +#### 添加并引用图像 + +添加并引用一个图像,跟添加并引用一个章节和添加一个 Markdown 图片很相似: + +``` +![Scatterplot matrix](data/scatterplots/RScatterplotMatrix2.png){#fig:scatter-matrix} +``` + +上面这一行是告诉 Pandoc,有一个标有 Scatterplot matrix 的图像以及这张图片路径是 `data/scatterplots/RScatterplotMatrix2.png`。`{#fig:scatter-matrix}` 表明了用于引用该图像的名字。 + +这里是从一篇论文中进行图像引用的例子: + +``` +The boxes "Enjoy", "Grade" and "Motivation" ([@fig:scatter-matrix]) ... +``` + +Pandoc 产生如下输出: + +``` +The boxes "Enjoy", "Grade" and "Motivation" (Fig. 1) ... +``` + +#### 添加及引用参考书目 + +大多数调研报告都把引用放在一个 BibTeX 的数据库文件中。在这个例子中,该文件被命名为 [biblio.bib][6],它包含了论文中所有的引用。下面是这个文件的样子: + +``` +@inproceedings{wrigstad2017mastery, + Author = {Wrigstad, Tobias and Castegren, Elias}, + Booktitle = {SPLASH-E}, + Title = {Mastery Learning-Like Teaching with Achievements}, + Year = 2017 +} + +@inproceedings{review-gamification-framework, + Author = {A. Mora and D. Riera and C. Gonzalez and J. Arnedo-Moreno}, + Publisher = {IEEE}, + Booktitle = {2015 7th International Conference on Games and Virtual Worlds + for Serious Applications (VS-Games)}, + Doi = {10.1109/VS-GAMES.2015.7295760}, + Keywords = {formal specification;serious games (computing);design + framework;formal design process;game components;game design + elements;gamification design frameworks;gamification-based + solutions;Bibliographies;Context;Design + methodology;Ethics;Games;Proposals}, + Month = {Sept}, + Pages = {1-8}, + Title = {A Literature Review of Gamification Design Frameworks}, + Year = 2015, + Bdsk-Url-1 = {http://dx.doi.org/10.1109/VS-GAMES.2015.7295760} +} + +... +``` + +第一行的 `@inproceedings{wrigstad2017mastery,` 表明了出版物 的类型(`inproceedings`),以及用来指向那篇论文的标签(`wrigstad2017mastery`)。 + +引用这篇题为 “Mastery Learning-Like Teaching with Achievements” 的论文, 输入: + +``` +the achievement-driven learning methodology [@wrigstad2017mastery] +``` + +Pandoc 将会输出: + +``` +the achievement- driven learning methodology [30] +``` + +这篇论文将会产生像下面这样被标号的参考书目: + +![](https://opensource.com/sites/default/files/uploads/bibliography-example_0.png) + +引用文章的集合也很容易:只要引用使用分号 `;` 分隔开被标记的参考文献就可以了。如果一个引用有两个标签 —— 例如: `SEABORN201514` 和 `gamification-leaderboard-benefits`—— 像下面这样把它们放在一起引用: + +``` +Thus, the most important benefit is its potential to increase students' motivation +and engagement [@SEABORN201514;@gamification-leaderboard-benefits]. +``` + +Pandoc 将会产生: + +``` +Thus, the most important benefit is its potential to increase students’ motivation +and engagement [26, 28] +``` + +### 问题案例 + +一个常见的问题是所需项目与页面不匹配。不匹配的部分会自动移动到它们认为合适的地方,即便这些位置并不是读者期望看到的位置。因此在图像或者表格接近于它们被提及的地方时,我们需要调节一下那些元素放置的位置,使得它们更加易于阅读。为了达到这个效果,我建议使用 `figure` 这个 LaTeX 环境参数,它可以让用户控制图像的位置。 + +我们看一个上面提到的图像的例子: + +``` +![Scatterplot matrix](data/scatterplots/RScatterplotMatrix2.png){#fig:scatter-matrix} +``` + +然后使用 LaTeX 重写: + +``` +\begin{figure}[t] +\includegraphics{data/scatterplots/RScatterplotMatrix2.png} +\caption{\label{fig:matrix}Scatterplot matrix} +\end{figure} +``` + +在 LaTeX 中,`figure` 环境参数中的 `[t]` 选项表示这张图用该位于该页的最顶部。有关更多选项,参阅 [LaTex/Floats, Figures, and Captions][7] 这篇 Wikibooks 的文章。 + +### 产生一篇论文 + +到目前为止,我们讲了如何添加和引用(子)章节、图像和参考书目,现在让我们重温一下如何生成一篇 PDF 格式的论文。要生成 PDF,我们将使用 Pandoc 生成一篇可以被构建成最终 PDF 的 LaTeX 文件。我们还会讨论如何以 LaTeX,使用一套自定义的模板和元信息文件生成一篇调研论文,以及如何将 LaTeX 文档编译为最终的 PDF 格式。 + +很多会议都提供了一个 .cls 文件或者一套论文应有样式的模板;例如,它们是否应该使用两列的格式以及其它的设计风格。在我们的例子中,会议提供了一个名为 `acmart.cls` 的文件。 + +作者通常想要在他们的论文中包含他们所属的机构,然而,这个选项并没有包含在默认的 Pandoc 的 LaTeX 模板(注意,可以通过输入 `pandoc -D latex` 来查看 Pandoc 模板)当中。要包含这个内容,找一个 Pandoc 默认的 LaTeX 模板,并添加一些新的内容。将这个模板像下面这样复制进一个名为 `mytemplate.tex` 的文件中: + +``` +pandoc -D latex > mytemplate.tex +``` + +默认的模板包含以下代码: + +``` +$if(author)$ +\author{$for(author)$$author$$sep$ \and $endfor$} +$endif$ +$if(institute)$ +\providecommand{\institute}[1]{} +\institute{$for(institute)$$institute$$sep$ \and $endfor$} +$endif$ +``` + +因为这个模板应该包含作者的联系方式和电子邮件地址,在其他一些选项之间,我们更新这个模板以添加以下内容(我们还做了一些其他的更改,但是因为文件的长度,就没有包含在此处): + +``` +latex +$for(author)$ + $if(author.name)$ + \author{$author.name$} + $if(author.affiliation)$ + \affiliation{\institution{$author.affiliation$}} + $endif$ + $if(author.email)$ + \email{$author.email$} + $endif$ + $else$ + $author$ + $endif$ +$endfor$ +``` +要让这些更改起作用,我们还应该有下面的文件: + +* `main.md` 包含调研论文 +* `biblio.bib` 包含参考书目数据库 +* `acmart.cls` 我们使用的文档的集合 +* `mytemplate.tex` 是我们使用的模板文件(代替默认的) + +让我们添加论文的元信息到一个 `meta.yaml` 文件: + +``` +--- +template: 'mytemplate.tex' +documentclass: acmart +classoption: sigconf +title: The impact of opt-in gamification on `\\`{=latex} students' grades in a software design course +author: +- name: Kiko Fernandez-Reyes +  affiliation: Uppsala University +  email: kiko.fernandez@it.uu.se +- name: Dave Clarke +  affiliation: Uppsala University +  email: dave.clarke@it.uu.se +- name: Janina Hornbach +  affiliation: Uppsala University +  email: janina.hornbach@fek.uu.se +bibliography: biblio.bib +abstract: | +  An achievement-driven methodology strives to give students more control over their learning with enough flexibility to engage them in deeper learning. (more stuff continues) + +include-before: | +   \` ``{=latex} +   \copyrightyear{2018} +   \acmYear{2018} +   \setcopyright{acmlicensed} +   \acmConference[MODELS '18 Companion]{ACM/IEEE 21th International Conference on Model Driven Engineering Languages and Systems}{October 14--19, 2018}{Copenhagen, Denmark} +   \acmBooktitle{ACM/IEEE 21th International Conference on Model Driven Engineering Languages and Systems (MODELS '18 Companion), October 14--19, 2018, Copenhagen, Denmark} +   \acmPrice{XX.XX} +   \acmDOI{10.1145/3270112.3270118} +   \acmISBN{978-1-4503-5965-8/18/10} + +   \begin{CCSXML} +   +   +   10010405.10010489 +   Applied computing~Education +   500 +   +   +   \end{CCSXML} + +   \ccsdesc[500]{Applied computing~Education} + +   \keywords{gamification, education, software design, UML} +   \` `` +figPrefix: +  - "Fig." +  - "Figs." +secPrefix: +  - "Section" +  - "Sections" +... +``` + +这个元信息文件使用 LaTeX 设置下列参数: + +* `template` 指向使用的模板(`mytemplate.tex`) +* `documentclass` 指向使用的 LaTeX 文档集合(`acmart`) +* `classoption` 是在 `sigconf` 的案例中,指向这个类的选项 +* `title` 指定论文的标题 +* `author` 是一个包含例如 `name`、`affiliation` 和 `email` 的地方 +* `bibliography` 指向包含参考书目的文件(`biblio.bib`) +* `abstract` 包含论文的摘要 +* `include-before` 是这篇论文的具体内容之前应该被包含的信息;在 LaTeX 中被称为 [前言][8]。我在这里包含它去展示如何产生一篇计算机科学的论文,但是你可以选择跳过 +* `figPrefix` 指向如何引用文档中的图像,例如:当引用图像的 `[@fig:scatter-matrix]` 时应该显示什么。例如,当前的 `figPrefix` 在这个例子 `The boxes "Enjoy", "Grade" and "Motivation" ([@fig:scatter-matrix])`中,产生了这样的输出:`The boxes "Enjoy", "Grade" and "Motivation" (Fig. 3)`。如果这里有很多图像,目前的设置表明它应该在图像号码旁边显示 `Figs.` +* `secPrefix` 指定如何引用文档中其他地方提到的部分(类似之前的图像和概览) + +现在已经设置好了元信息,让我们来创建一个 `Makefile`,它会产生你想要的输出。`Makefile` 使用 Pandoc 产生 LaTeX 文件,`pandoc-crossref` 产生交叉引用,`pdflatex` 构建 LaTeX 为 PDF,`bibtex ` 处理引用。 + + +`Makefile` 已经展示如下: + +``` +all: paper + +paper: +        @pandoc -s -F pandoc-crossref --natbib meta.yaml --template=mytemplate.tex -N \ +         -f markdown -t latex+raw_tex+tex_math_dollars+citations -o main.tex main.md +        @pdflatex main.tex &> /dev/null +        @bibtex main &> /dev/null +        @pdflatex main.tex &> /dev/null +        @pdflatex main.tex &> /dev/null + +clean: +        rm main.aux main.tex main.log main.bbl main.blg main.out + +.PHONY: all clean paper +``` + +Pandoc 使用下面的标记: + +* `-s` 创建一个独立的 LaTeX 文档 +* `-F pandoc-crossref` 利用 `pandoc-crossref` 进行过滤 +* `--natbib` 用 `natbib` (你也可以选择 `--biblatex`)对参考书目进行渲染 +* `--template` 设置使用的模板文件 +* `-N` 为章节的标题编号 +* `-f` 和 `-t` 指定从哪个格式转换到哪个格式。`-t` 通常包含格式和 Pandoc 使用的扩展。在这个例子中,我们标明的 `raw_tex+tex_math_dollars+citations` 允许在 Markdown 中使用 `raw_tex` LaTeX。 `tex_math_dollars` 让我们能够像在 LaTeX 中一样输入数学符号,`citations` 让我们可以使用 [这个扩展][9]。 + +要从 LaTeX 产生 PDF,按 [来自bibtex][10] 的指导处理参考书目: + +``` +@pdflatex main.tex &> /dev/null +@bibtex main &> /dev/null +@pdflatex main.tex &> /dev/null +@pdflatex main.tex &> /dev/null +``` + +脚本用 `@` 忽略输出,并且重定向标准输出和错误到 `/dev/null` ,因此我们在使用这些命令的可执行文件时不会看到任何的输出。 + +最终的结果展示如下。这篇文章的库可以在 [GitHub][11] 找到: + +![](https://opensource.com/sites/default/files/uploads/abstract-image.png) + +### 结论 + +在我看来,研究的重点是协作、思想的传播,以及在任何一个恰好存在的领域中改进现有的技术。许多计算机科学家和工程师使用 LaTeX 文档系统来写论文,它对数学提供了完美的支持。来自社会科学的研究人员似乎更喜欢 DOCX 文档。 + +当身处不同社区的研究人员一同写一篇论文时,他们首先应该讨论一下他们将要使用哪种格式。然而如果包含太多的数学符号,DOCX 对于工程师来说不会是最简便的选择,LaTeX 对于缺乏编程经验的研究人员来说也有一些问题。就像这篇文章中展示的,Markdown 是一门工程师和社会科学家都很轻易能够使用的语言。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/9/pandoc-research-paper + +作者:[Kiko Fernandez-Reyes][a] +选题:[lujun9972][b] +译者:[dianbanjiu](https://github.com/dianbanjiu) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/kikofernandez +[b]: https://github.com/lujun9972 +[1]: https://en.wikipedia.org/wiki/Markdown +[2]: https://www.latex-project.org/ +[3]: https://pandoc.org/ +[4]: http://lierdakil.github.io/pandoc-crossref/ +[5]: https://dl.acm.org/citation.cfm?id=3270118 +[6]: https://github.com/kikofernandez/pandoc-examples/blob/master/research-paper/biblio.bib +[7]: https://en.wikibooks.org/wiki/LaTeX/Floats,_Figures_and_Captions#Figures +[8]: https://www.sharelatex.com/learn/latex/Creating_a_document_in_LaTeX#The_preamble_of_a_document +[9]: http://pandoc.org/MANUAL.html#citations +[10]: http://www.bibtex.org/Using/ +[11]: https://github.com/kikofernandez/pandoc-examples/tree/master/research-paper