LaTeX Knitting Patterns

本文介绍了如何使用knittingpattern包在LaTeX文档中展示编织图案。通过设定文档类型为knittingpattern,可以添加特殊指令,如版权信息、引言、图表、注释和重要的编织指示。文章详细说明了diagram、 ote和important命令的用法,以及如何创建编织指令表。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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}

在这里插入图片描述
这个环境提供了两个参数来指定表中使用的颜色。适当的颜色选择可以提升文档的可读性。

延伸阅读

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值