Pandoc
Pandoc은 특히 학자들에 의해 널리 사용되는 기록 도구인 자유-오픈 소스 문서 변환기이며 워크플로를 출판하기 위한 토대로 사용된다. 캘리포니아 대학교 버클리의 철학 교수 John MacFarlane이 개발했다.
Categories
Installation
--pdf-engine=xelatex
쓰고 싶다면:
PDF Engine 적용 방법
#!/usr/bin/env bash
ROOT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" || exit; pwd)
INPUT="$ROOT_DIR/MANUAL.ko.md"
OUTPUT="$ROOT_DIR/MANUAL.ko.pdf"
if ! command -v pandoc &> /dev/null; then
echo "Not found pandoc command" 1>&2
echo "Please install the 'pandoc' package" 1>&2
exit 1
fi
if [[ ! -f "$INPUT" ]]; then
echo "Not found input file: '$INPUT'" 1>&2
exit 1
fi
if ! command -v xelatex &> /dev/null; then
echo "Not found xelatex command" 1>&2
echo "Please install the 'texlive-xetex' and 'latex-cjk-all' package" 1>&2
exit 1
fi
pandoc "$INPUT" \
-f markdown \
-t pdf \
--pdf-engine=xelatex \
-V mainfont="NanumGothic" \
-V CJKmainfont="NanumGothic" \
-o "$OUTPUT"
xelatex not found
다음과 같은 에러가 발생될 수 있다:
xelatex
not found. Please select a different ``--pdf-engine`` or install
xelatex
-- see also ``/usr/share/doc/pandoc/README.Debian
다음과 같이 설치:
다음 명령으로 테스트하자:
File `ctexhook.sty' not found.
다음과 같은 에러 발생:
Error producing PDF.
! LaTeX Error: File `ctexhook.sty' not found.
Type X to quit or <RETURN> to proceed,
or enter new name. (Default extension: sty)
Enter file name:
! Emergency stop.
<read *>
l.55 \prg_new_conditional:Npnn
페이지 마진 지정하기
명령행을 사용하는 방법:
Markdown syntax
중앙 정렬
<p markdown="1">
사이에 입력한 내용은 모두 중앙 정렬된다.
</p>
<h3 markdown="1">
이미지 크기 조절
</h3>
```markdown
{width=90%}
새로운 페이지
<h2 markdown="1">
[YAML Style Meta-Data](YAML_Style_Meta-Data.md)
</h2>
<ul markdown="1">
<li markdown="1">
[Writing Your Docs - MkDocs](https://www.mkdocs.org/user-guide/writing-your-docs/#yaml-style-meta-data)
</li>
</ul>
<p markdown="1">
[YAML전방주석](YAML%EC%A0%84%EB%B0%A9%EC%A3%BC%EC%84%9D.md) ([YAML Front Matter](YAML_Front_Matter.md)) 에 대한 내용이다.
</p>
```yaml
---
title: My Document
summary: A brief description of my document.
authors:
- Waylan Limberg
- Tom Christie
date: 2018-07-10
some_url: https://example.com
---
Pandoc AST
Supported file formats
Input formats
The input format with the most support is an extended version of Markdown. Notwithstanding, pandoc can also read in the following formats:
- Creole
- DocBook
- EPUB
- FictionBook (FB2)
- Haddock
- HTML
- Jira wiki markup
- Journal Article Tag Suite (JATS)
- JSON
- LaTeX
- Lightweight markup language
- man
- Markdown: Strict, CommonMark, GitHub Flavored Markdown (GFM), MultiMarkdown (MMD) and Markdown Extra (PHP Extra) variants
- OpenDocument (ODT)
- OPML
- Office Open XML: Microsoft Word variant
- Org-mode
- reStructuredText
- Textile
- txt2tags (t2t)
- Wiki markup: MediaWiki, Muse, TikiWiki, TWiki and Vimwiki variants
Output formats
Pandoc can create files in the following output formats, which are not necessarily the same set of formats as the input formats:
- AsciiDoc
- ConTeXt
- DocBook: Versions 4 and 5
- EPUB: Versions 2 and 3
- FictionBook (FB2)
- Haddock
- HTML: HTML4 and HTML5 variants, respectively compliant with XHTML 1.0 Transitional and XHTML Strict
- InDesign ICML
- Jira wiki markup
- Journal Article Tag Suite (JATS)
- JSON
- LaTeX
- man
- Markdown: Strict, CommonMark, GitHub Flavored Markdown (GFM), MultiMarkdown (MMD) and Markdown Extra (PHP Extra) variants
- OpenDocument (ODT/ODF)
- OPML
- Office Open XML: Microsoft Word and Microsoft PowerPoint variants
- Org-mode
- PDF (needs a third-party add-on like ConTeXt, pdfroff, wkhtmltopdf, weasyprint or prince)
- Plain text
- reStructuredText
- Rich Text Format (RTF)
- TEI
- Texinfo
- Textile
- Web-based slideshows: LaTeX Beamer, Slideous, Slidy, DZSlides, reveal.js and S5 variants
- Wiki markup: DokuWiki, MediaWiki, Muse, TikiWiki, TWiki and Vimwiki variants
Examples
HTML Output:
MS Word Output:
PDF Output:
PDF Output with Font:
pandoc test.md -o test.pdf --pdf-engine=xelatex -V mainfont="Nanum Gothic"
pandoc test.md -f markdown -t pdf --pdf-engine=xelatex -V CJKmainfont="바탕" -o test.pdf
Troubleshooting
unexpected end of input
Pandoc died with exitcode "64" during conversion: Error at "/home/your/Project/mwfilter/cache/16387.wiki" (line 23, column 1):
unexpected end of input
Pandoc에서 발생한 exit code 64 오류는 일반적으로 입력 파일에 문제가 있다는 것을 의미합니다. "unexpected end of input" 메시지는 파일에 문법적이나 형식적인 문제가 있음을 나타냅니다. 이 경우, /home/your/Project/mwfilter/cache/16387.wiki 파일에서 발생한 문제입니다.
이 오류의 원인으로는 다음과 같은 사항들이 있을 수 있습니다:
- 태그 쌍 미닫힘: 목록, 코드 블록 또는 헤더와 같은 요소가 제대로 닫히지 않으면 구문 분석기가 예기치 않은 끝에 도달할 수 있습니다.
- 예컨데
...
같은 Tag 쌍이 불일치하면 이렇게 되는데 많은 케이스 에서 로그에 출력 된 줄 이 전의 모든 TAG 쌍을 확인해야 한다.
- 예컨데
해결 방법:
- 텍스트 편집기에서 파일을 열고 23번째 줄 주변에서 명백한 형식 오류를 찾아보세요.
-
.wiki
파일을 다시 생성하거나 변환 전에 내용이 올바른지 확인해 보세요.