LaTeX Knitting Patterns
原 文:Knitting patterns
译 者:Xovee
翻译时间:2023年7月22日
介绍
本文介绍如何使用kittingpattern
包来更容易地展示LaTeX文档中的一些元素。
首先你需要申明正确的文档类型:
\documentclass{knittingpattern}
\begin{document}
\title{Knitting patterns}
\author{Overleaf team}
\date{\today}
\maketitle
\cpyrght{Overleaf team}
\intro{
Introductory text here. It will look better if it has the
same height as the image next to it.
Introductory text here. It will look better if it has the
same height as the image next to it...
}{lion-logo}
代码\documentclass{knittingpattern}
将文档的类型设置为knittingpattern
,这可以让我们使用相关的命令来改变一些文档元素的布局,例如:
\cpyrgth{...}
:移除页码,并增加一个脚注用于版权声明。\intro{}{}
:第一个参数是一些介绍文字,第二个参数是一个图片。文字将会显示在页面的左边,图片则是右边。
Diagrams
使用knittingpattern
来添加一个图片非常简单:
\diagram{overleaf-logo}
\diagram
命令展示了一个居中的,有黑色边界的图片,它的宽度是页面的一半。
注释和评论
如果你需要强调文档中某一部分的文字,knittingpattern
提供了两种方式来给文字添加边框:
\definecolor{colour0}{HTML}{000000}
\definecolor{colour2}{HTML}{97DE76}
\definecolor{colour4}{HTML}{EDB668}
\begin{document}
\note{colour0}{colour2}{Materials}{
Wool, some wool, and you may also need wool for the
wool parts.
}
There's also this special command
\important{colour0}{colour4}{This note is very important.
That's why it's highlighted}
\end{document}
命令\note{}{}{}{}
有四个参数:
- 边框的颜色
- 背景的颜色
- 标题
- 正文
颜色的代码格式是xcolor的HTML语法。更多信息请参考在LaTeX中使用颜色。
第二个命令\important
的语法与\note
基本相同,只是没有title
参数。
增加knitting指令
Knitting对于LaTeX文档的主要意义在于提供一系列与knitting pattern有关的方向(directions)。knittingpattern
包提供了一个可以输出指令表的环境:
\documentclass{knittingpatern}
\definecolor{colour3}{HTML}{99CCFF}
\definecolor{colour5}{HTML}{CCFFCC}
\begin{document}
\begin{pattern}{colour3}{colour5}
Cast on & (st)\\
Instruction 1 & (st)\\
Instruction 2 & (st)\\
Instruction 3 & (st)\\
Instruction 4 & (st)\\
Instruction 5 & (st)\\
Instruction 6 & (st)\\
Instruction 7 & (st)\\
Instruction 8 & (st)\\
Instruction 9 & (st)\\
Instruction 10 & (st)\\
\quad\vdots & \quad\vdots\\
\end{pattern}
\end{document}
这个环境提供了两个参数来指定表中使用的颜色。适当的颜色选择可以提升文档的可读性。