Guidedog 설명서 0.6.3
언어
이 페이지의 내용
Guidedog / 문서 0.6.3

작은 책 만들기

웹에서는 링크를 따라 자유롭게 읽지만, 책에는 분명한 순서와 장 번호, 머리말, 앞부분 구성이 필요합니다.

toctree 지시문은 두 형식을 연결합니다. 같은 트리가 웹의 계층 탐색과 PDF의 장 순서를 정합니다.

루트 toctree가 웹에서는 사이드바와 탐색 경로, 인쇄에서는 번호 있는 장으로 나타납니다.
그림 4 하나의 toctree가 웹 탐색과 책의 장 순서를 함께 만듭니다.

1. 장 추가하기

notes 프로젝트에 measurement.rst 파일을 만듭니다.

코드 1 notes/measurement.rst
Measurement
===========

A scientific measurement consists of a numerical magnitude and an explicit unit.
Always report both. A bare number leaves the reader guessing.

.. _measurement-units:

Units of measurement
--------------------

Maintain a single, consistent unit system within every comparison.

When working with the International System of Units (SI):

* Length is expressed in meters (m).
* Mass is expressed in kilograms (kg).
* Time is expressed in seconds (s).

Prefixes scale units by powers of ten, simplifying very large or small values.

제목 바로 위의 .. _measurement-units: 라벨은 웹과 인쇄 모두에서 쓰는 상호 참조 대상을 정의합니다.

2. 읽는 순서 정하기

notes/index.rst 파일을 열어 목차를 선언합니다.

코드 2 notes/index.rst
Field Notes
===========

These notes explain how to perform reliable physical measurements and document
them clearly.

.. toctree::
   :maxdepth: 2
   :numbered:

   measurement

Next steps:

* Begin with :doc:`measurement`.
* Review the standard unit conventions in :ref:`measurement-units`.

toctree 옵션 설명:

  • :maxdepth: 2 옵션은 목차에 표시할 하위 제목 깊이입니다.
  • :numbered: 옵션은 “1. Measurement”, “1.1 Units of measurement” 같은 계층 번호를 붙입니다.
  • measurement 항목은 확장자 .rst 를 뺀 문서 이름입니다.

상호 참조 문법:

  • :doc:`measurement` 역할은 문서 경로로 장에 연결합니다.
  • :ref:`measurement-units` 역할은 라벨이 있는 절에 연결합니다. PDF에는 절 제목을 쓰고, 책 템플릿의 page-ref 설정으로 페이지도 추가할 수 있습니다. 예제는 프로젝트 테마 만들기 문서를 참고하세요.

3. Graphviz 그림 추가하기

Guidedog는 Graphviz를 네이티브로 통합하여 웹용 SVG와 인쇄용 벡터 그림을 만듭니다. 외부 브라우저 렌더러는 필요 없습니다.

notes/measurement.rst 문서에 그림을 더합니다.

Comparison workflow
-------------------

Before comparing two experimental values, convert both to a shared base unit:

.. graphviz::
   :class: graphviz-adaptive
   :caption: Converting values to a common base unit before comparison.
   :alt: Raw experimental values are converted to a shared unit before comparison.

   digraph comparison {
     graph [rankdir=LR, bgcolor="transparent", pad="0.2"];
     node [shape=box, style="rounded,filled", fillcolor="#edf5f2",
           color="#216553", fontname="Helvetica", fontcolor="#16382f", fontsize=12];
     edge [color="#216553"];

     "Raw values" -> "Unit conversion" -> "Common unit" -> "Comparison";
   }

:caption: 옵션은 그림 설명입니다. 번호는 notes/conf.toml 파일의 numfig = true 설정으로 켭니다. :alt: 옵션은 스크린 리더용 대체 텍스트입니다.

4. 책을 빌드하고 검사하기

프로젝트를 다시 빌드합니다.

guidedog build html notes -W
guidedog build pdf notes -W

두 출력 모두 살펴봅니다.

  • HTML: notes/_build/html/index.html 페이지를 열어 번호 있는 장 계층을 확인합니다. “1. Measurement”를 누르면 탐색 경로와 SVG 그림이 있는 장이 열립니다.
  • PDF: notes/_build/pdf/field-notes-en.pdf 파일을 엽니다. 목차에는 장과 페이지가 있으며, 그림은 벡터로 유지되고 참조는 대상에 연결됩니다.

5. 다음 단계

두 출력의 원리를 알았으니 다음 주제로 진행하세요.