> For the complete documentation index, see [llms.txt](https://ayakaleaf-pro.ayaka.space/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ayakaleaf-pro.ayaka.space/latex/zh-cn/te-ding-ling-yu/06-knitting-patterns.md).

# 编织图样

## 引言

LaTeX 提供了一种特殊的文档类，使带有针织图案和图片的文档排版更容易。本文解释如何使用该宏包 [`knittingpattern`](https://ctan.org/pkg/knittingpattern?lang=en).

使用针织图案非常简单。你只需要声明正确的文档类

```latex
\documentclass{knittingpattern}

\begin{document}

\title{Knitting patterns}
\author{Overleaf team}
\date{\today}
\maketitle

\cpyrght{Overleaf team}

\intro{
    这里是引言文本。如果它具有
    与旁边图片相同的高度，效果会更好。
    这里是引言文本。如果它具有
    与旁边图片相同的高度...
}{lion-logo}
```

![KnittingPatternsEx1OverleafV2.png](/files/27bc62b6e1e537255bfee505183a7c8630b0d4d1)

文档顶部的命令

```latex
\documentclass{knittingpattern}
```

提供了多个命令，可通过这些命令更轻松地改变某些元素的布局。例如

* `\cpyrght{...}` 移除页码并添加脚注。用于版权说明。
* `\intro{}{}` 在花括号中接受两个参数。第一个是一些（引言）文本，第二个是一张图片。文本显示在左侧，图片显示在旁边。

[打开一个……的示例 `knitpattern` 在 Overleaf 中的宏包](https://www.overleaf.com/project/new/template/19507?id=65965453\&templateName=Knitting+Patterns+Demo\&latexEngine=pdflatex\&texImage=texlive-full%3A2020.1\&mainFile=)

## 图示

要添加包含图表的图片 **knittingpattern** 提供了一个特殊命令

```latex
\diagram{overleaf-logo}
```

![KnittingPatternsEx2OverleafV2.png](/files/31a84c11fbff749eeae46747e0aee9ecfe4576c4)

命令 `\diagram` 输出一张居中、带边框的图片，其宽度为页面的一半。

[打开一个……的示例 `knitpattern` 在 Overleaf 中的宏包](https://www.overleaf.com/project/new/template/19507?id=65965453\&templateName=Knitting+Patterns+Demo\&latexEngine=pdflatex\&texImage=texlive-full%3A2020.1\&mainFile=)

## 注释和说明

如果你需要在文档中突出显示一段特殊文本，可以使用两个命令向文档添加带框的注释和说明。

```latex
\definecolor{colour0}{HTML}{000000}
\definecolor{colour2}{HTML}{97DE76}
\definecolor{colour4}{HTML}{EDB668}

\begin{document}

\note{colour0}{colour2}{Materials}{
    羊毛，一些羊毛，而且你可能还需要用于
    羊毛部分的羊毛。
}

还有这个特殊命令

\important{colour0}{colour4}{This note is very important.
这就是它被高亮显示的原因}
\end{document}
```

![KnittingPatternsEx3.png](/files/93dce328c1ca8dd70afbe633a9eb9e4356ab13f0)

命令 `\note{}{}{}{}` 接受 4 个参数：

* 边框颜色，
* 背景颜色，
* 标题，以及
* 要打印在框内的文本。

这些颜色使用 **xcolor** HTML 语法。参见 [在 LaTeX 中使用颜色](/latex/zh-cn/ge-shi-hua/13-using-colors-in-latex.md) 以了解更多信息。

第二个命令， `\important`，其语法与 `\note`基本相同，但省略了标题。

[打开一个……的示例 `knitpattern` 在 Overleaf 中的宏包](https://www.overleaf.com/project/new/template/19507?id=65965453\&templateName=Knitting+Patterns+Demo\&latexEngine=pdflatex\&texImage=texlive-full%3A2020.1\&mainFile=)

## 添加编织说明

关于编织的文档的主要目的是实际提供一个编织图案的说明。该宏包 **knittingpatern** 提供了一个用于打印说明表格的环境。

```latex
\documentclass{knittingpatern}
\definecolor{colour3}{HTML}{99CCFF}
\definecolor{colour5}{HTML}{CCFFCC}

\begin{document}
\begin{pattern}{colour3}{colour5}
起针 & (st)\\
说明 1 & (st)\\
说明 2 & (st)\\
说明 3 & (st)\\
说明 4 & (st)\\
说明 5 & (st)\\
说明 6 & (st)\\
说明 7 & (st)\\
说明 8 & (st)\\
说明 9 & (st)\\
说明 10 & (st)\\
\quad\vdots & \quad\vdots\\
\end{pattern}
\end{document}
```

![KnittingPatternsEx4.png](/files/f8a5e7e54807f451faa1b328294f97f7c39b82f7)

该环境接受两个参数，用于确定表格中使用的交替颜色，以提高可读性。参见 [在 LaTeX 中使用颜色](/latex/zh-cn/ge-shi-hua/13-using-colors-in-latex.md) 了解 LaTeX 中颜色处理的更多信息。

[打开一个……的示例 `knitpattern` 在 Overleaf 中的宏包](https://www.overleaf.com/project/new/template/19507?id=65965453\&templateName=Knitting+Patterns+Demo\&latexEngine=pdflatex\&texImage=texlive-full%3A2020.1\&mainFile=)

## 进一步阅读

更多信息请参见：

* [创建你的第一个 LaTeX 文档](/latex/zh-cn/latex-ji-chu/01-learn-latex-in-30-minutes.md)
* [粗体、斜体和下划线](/latex/zh-cn/latex-ji-chu/03-bold-italics-and-underlining.md)
* [插入图片](/latex/zh-cn/geng-duo-zhu-ti/27-inserting-images.md)
* [图片和表格的定位](/latex/zh-cn/tu-xing-he-biao-ge/02-positioning-images-and-tables.md)
* [段落格式设置](/latex/zh-cn/ge-shi-hua/04-articles-how-to-change-paragraph-spacing-in-latex.md)
* [在 LaTeX 中使用颜色](/latex/zh-cn/ge-shi-hua/13-using-colors-in-latex.md)
* [字体大小、字体族和样式](/latex/zh-cn/zi-ti/01-font-sizes-families-and-styles.md)
* [字体类型](/latex/zh-cn/zi-ti/02-font-typefaces.md)
* [该 `knittingpattern` 包文档](https://ctan.org/pkg/knittingpattern?lang=en)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://ayakaleaf-pro.ayaka.space/latex/zh-cn/te-ding-ling-yu/06-knitting-patterns.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
