> For the complete documentation index, see [llms.txt](https://overleaf-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://overleaf-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{编织图案}
\author{Overleaf 团队}
\date{\today}
\maketitle

\cpyrght{Overleaf 团队}

\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}{材料}{
    羊毛，一些羊毛，而且你还可能需要羊毛来做
    羊毛部分。
}

还有这个特殊命令

\important{colour0}{colour4}{这个注释非常重要。
这就是它被高亮显示的原因}
\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-biao-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://overleaf-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.
