> 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-tw/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/8dea5b460494f358a882a894de91cc59b85413b1)

文件頂端的命令

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

提供了數個命令，可透過一些命令更容易變更某些元素的版面配置。例如

* `\cpyrght{...}` 移除頁碼並新增註腳。供版權註記使用。
* `\intro{}{}` 在大括號內接受兩個參數。第一個是一些（導言）文字，第二個是一張圖片。文字印在左側，圖片則在旁邊。

[在 Overleaf 中開啟 `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/d8bbab0a3813e542e61bd08b5c0b853e08181c31)

指令 `\diagram` 會輸出一張置中、帶邊框的圖片，其寬度為頁面的一半。

[在 Overleaf 中開啟 `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/c111414ecbb494609418bb2ea4413ec45a382854)

指令 `\note{}{}{}{}` 接受 4 個參數：

* 邊框的顏色，
* 背景顏色，
* 一個標題，以及
* 要印在方框內的文字。

這些顏色使用 **xcolor** HTML 語法。請參見 [在 LaTeX 中使用顏色](/latex/zh-tw/ge-shi-hua/13-using-colors-in-latex.md) 以了解更多資訊。

第二個命令 `\important`，其語法基本上與 `\note`相同，但省略了標題。

[在 Overleaf 中開啟 `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/21285db76cfe341013d26cd3f2241735a2fbcaf2)

這個環境接受兩個參數，用來決定表格中交替使用的顏色，以提升可讀性。請參見 [在 LaTeX 中使用顏色](/latex/zh-tw/ge-shi-hua/13-using-colors-in-latex.md) 以取得更多關於 LaTeX 中顏色操作的資訊。

[在 Overleaf 中開啟 `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-tw/latex-ji-chu/01-learn-latex-in-30-minutes.md)
* [粗體、斜體與底線](/latex/zh-tw/latex-ji-chu/03-bold-italics-and-underlining.md)
* [插入圖片](/latex/zh-tw/geng-duo-zhu-ti/27-inserting-images.md)
* [圖片與表格的定位](/latex/zh-tw/tu-biao-yu-biao-ge/02-positioning-images-and-tables.md)
* [段落格式](/latex/zh-tw/ge-shi-hua/04-articles-how-to-change-paragraph-spacing-in-latex.md)
* [在 LaTeX 中使用顏色](/latex/zh-tw/ge-shi-hua/13-using-colors-in-latex.md)
* [字型大小、字族與樣式](/latex/zh-tw/zi-xing/01-font-sizes-families-and-styles.md)
* [字型字體](/latex/zh-tw/zi-xing/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-tw/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.
