๋จธ๋ฆฌ๋ง
๋งํฌ๋ค์ด์ ๊ฐ๋จํ ์ดํค๋ฆญ์ฒด์ ๋ณผ๋์ฒด ์์์ ์ฌ์ฉํ์ฌ ์งง์ ๊ธฐ์ฌ๋ฅผ ์์ฑํ ์ ์๋ ์ข์ ๋ฐฉ๋ฒ์ด๋ฉฐ ๋๋ก๋ ์๋นํ ๋ง์ ํ ์คํธ๋ฅผ ์์ฑํ ์ ์์ต๋๋ค. Markdown์ ์์ค ์ฝ๋๊ฐ ํฌํจ๋ ๊ธฐ์ฌ๋ฅผ ์์ฑํ๋ ๋ฐ์๋ ์ข์ต๋๋ค. ๊ทธ๋ฌ๋ ๋๋๋ก ๋น์ ์ ์์ค์์ด ํฌ๋ฒ๋ฆฐ๊ณผ ์ถค์ ์ถ๊ณ ๊ท์น์ ์ด๊ณ ์ ๊ตฌ์ฑ๋ PDF ํ์ผ๋ก ์ถ์ํ๊ณ ๋ณํ ์ค์ ๋ฌธ์ ๊ฐ ์๋๋กํ๊ณ ์ถ์ต๋๋ค. ์๋ฅผ ๋ค์ด ๋ฌ์์์ด๋ก ์ธ ์ ์์ต๋๋ค. ์์ค ์ฝ๋์ ์ฃผ์, ๋๋ฌด ๊ธด ์ค์ ์ ์ก๋์ง ์์ง๋ง ์๋ฆผ ๋ฐ ๊ธฐํ ์ฌ์ํ ๋ฌธ์ . ์ง์นจ์ ํตํด ๋ณํ๊ธฐ๋ฅผ ๋น ๋ฅด๊ฒ ์ค์ ํ ์ ์์ต๋๋ค. md2pdf ์๋ ๋ฐฉ์์ ์ค์ ๋ก ์ดํดํ์ง ๋ชปํ ์ฑ. ์ด๋ ์ ๋ ์๋ ์ค์น๋ฅผ ์ํ ์คํฌ๋ฆฝํธ๋ ์๋์ ํด๋น ์น์ ์ ์์ต๋๋ค.
๋ณํ์ ์ํ ๋ด ์ํ TeX ํ ํ๋ฆฟ์ Microsoft ๊ธ๊ผด ์ง์์ ํฌํจํ๋ PSCyr ๊ธ๊ผด ํจํค์ง๋ฅผ ์ฌ์ฉํฉ๋๋ค. ํ์์ฆ ์๋ก์ด ๋ก๋ง์ด๊ฒ๋ค์ GOST์์ ์๊ตฌํ๋ ํ์ ์๊ฑด์ ๋๋ค. GOST์ ์ต์ํ์๋ค๋ฉด ํ์์ ๋ง๊ฒ ํ ํ๋ฆฟ์ ์์ ํ์ค ์ ์์ต๋๋ค. ์ ์ง์นจ์ ๋ฐ๋ผ ๋จผ์ TexLive์์ PSCyr์ ์ค์ ํด์ผ ํฉ๋๋ค. ์ค์ ์ ๋ฐฐํฌํ์์ ์งํ๋ฉ๋๋ค. Linux Mint Mate ์ฌ์ฉ์๋ผ๋ฉด ํด๋น ์์คํ ์ ๊ธฐ๋ณธ TexLive ํจํค์ง ํด๋๋ฅผ ๊ตฌ๊ธ์์ ๊ฒ์ํด์ผ ํ ์๋ ์์ต๋๋ค. ๋ค๋ฅธ ๋ฐฐํฌํ์ ๊ฒฝ์ฐ ํด๋น ์์คํ ์ ๊ธฐ๋ณธ TexLive ํจํค์ง ํด๋๋ฅผ ๊ฒ์ํด ๋ณด์ธ์.
TexLive ์ค์น
๋ฌผ๋ก ์ด ํจํค์ง์ ํ์ํ ๋ถ๋ถ๋ง ์ค์นํ ์ ์์ต๋๋ค. ๊ทธ๋ฌ๋ ๊ฐ์ธ์ ์ผ๋ก ๋๋ ์์งํ ํ์ํ ์ต์ํ์ ์์ ์ค์น๋ฅผ ์ฐพ๊ธฐ์๋ ๋๋ฌด ๊ฒ์ผ๋ฅด๋ค. ๋ชจ๋ ๊ฒ์ด ์ ๋๋ก ์๋ํ๋์ง ํ์ธํ๋ ค๋ฉด ์ ์ฒด TexLive ํจํค์ง๋ฅผ ์ค์นํ์ญ์์ค. ๊ทธ๊ฒ์์ด๋ผ๊ณ texlive ์ ์ฒด ๋ฌด๊ฒ๋ 2GB๊ฐ ์กฐ๊ธ ๋์ต๋๋ค. ์ด ์ฌ์ค์ ๋ช ์ฌํ์ญ์์ค. ๋ค์ ๋ช ๋ น์ ์คํํฉ๋๋ค.
user@hostname:~$ sudo apt install texlive-full -y์ถฉ๋ถํ ๊ธด ์ค์น๊ฐ ๋๋๋ฉด ๋ค์ ํญ๋ชฉ์ผ๋ก ์งํํ ์ ์์ต๋๋ค.
Pandoc ๋ณํ๊ธฐ ์ค์น
Pandoc โ ํจํค์ง LinuxPandoc์ ์ฌ๋ฌ ํ ์คํธ ํ์์ ๋ค๋ฅธ ํ์์ผ๋ก ๋ณํํ ์ ์๋ ๋๊ตฌ์ ๋๋ค. ๋ค์ํ ํฅ๋ฏธ๋ก์ด ๊ธฐ๋ฅ์ด ์์ผ๋ ์จ๋ผ์ธ์์ ์ดํด๋ณด์ธ์. ์ฐ๋ฆฌ๋ Markdown ํ์ผ์ PDF๋ก ๋ณํํ๋ ๋ฐ๋ง ๊ด์ฌ์ด ์์ต๋๋ค. Pandoc์ด ์ค์น๋์ด ์๋์ง ํ์ธํ๊ณ , ์ค์น๋์ด ์์ง ์๋ค๋ฉด ์ค์นํด ๋ณด๊ฒ ์ต๋๋ค. ์๋ฅผ ๋ค์ด ๋ค์๊ณผ ๊ฐ์ด ์ค์นํ๋ฉด ๋ฉ๋๋ค.
user@hostname:~$ dpkg -s pandoc์ถ๋ ฅ์ ์ค์น๋์ง ์์๋ค๊ณ ํ์๋๋ฉด ๋ค์์ ์ค์นํ์ญ์์ค.
user@hostname:~$ sudo apt install pandoc -yTexLive์ฉ PSCyr ํจํค์ง ์ค์น
๋จผ์ PSCyr๋ฅผ ๋ค์ด๋ก๋ํด์ผ ํฉ๋๋ค. ์ง๊ธ์ ์ด ํ์ด์ง์์ ๊ณ์ ์ฌ์ฉํ ์ ์์ต๋๋ค. , ๊ธฐ์ฌ๋ฅผ ์ฝ์ ๋ ์ด๋ค ์ด์ ๋ก ์ฌ์ฉํ ์ ์๋ ๊ฒฝ์ฐ ์ ๋งํ์ง ๋ง์ญ์์ค. Google์ "PsCyr texlive ์ค์น"์ ๊ฐ์ ๊ฒ์ ์ ๋ ฅํ์ฌ ์ค์น ์ง์นจ๊ณผ ํจ๊ป ์ฝ๊ฒ ์ฐพ์ ์ ์์ต๋๋ค. ์ฌ์ฉ ๊ฐ๋ฅํ ๊ฒฝ์ฐ ๋ค์ด๋ก๋ํ๋ ๊ฒ์ด ๋ ์ฝ์ต๋๋ค. ์์นด์ด๋ธ๋ฅผ ํ ํด๋์ ํ์๋ค๊ณ ๊ฐ์ ํ๋ฏ๋ก ์์นด์ด๋ธ์ ํฌํจ๋ ํด๋์ ๊ฒฝ๋ก๋ ๋ค์๊ณผ ๊ฐ์ต๋๋ค. ~/PSCyr. ๊ทธ๋ฐ ๋ค์ ํฐ๋ฏธ๋๋ก ์ด๋ํ์ฌ ๋ค์ ๋ช ๋ น์ ์์๋๋ก ์คํํฉ๋๋ค.
user@hostname:~$ cd
user@hostname:~$ mkdir ./PSCyr/fonts/map ./PSCyr/fonts/enc
user@hostname:~$ cp ./PSCyr/dvips/pscyr/*.map ./PSCyr/fonts/map/
user@hostname:~$ cp ./PSCyr/dvips/pscyr/*.enc ./PSCyr/fonts/enc/
user@hostname:~$ echo "fadr6t AdvertisementPSCyr "T2AEncoding ReEncodeFont"" > ./PSCyr/fonts/map/pscyr.map๋ค์์ผ๋ก ๋ก์ปฌ ๋๋ ํ ๋ฆฌ๊ฐ ์๋ ์์น๋ฅผ ์ฐพ์ผ์ญ์์ค. texmf. ๋ค์ ๋ช ๋ น์ ์คํํฉ๋๋ค.
user@hostname:~$ kpsewhich -expand-var='$TEXMFLOCAL'์ด ๋๋ ํ ๋ฆฌ๊ฐ ์์ ๊ฐ๋ฅ์ฑ์ด ๋์ต๋๋ค. /usr/local/share/texmf/, ๊ทธ๋ฐ ๋ค์ ๋ค์์ ์ํํฉ๋๋ค.
user@hostname:~$ sudo cp -R ./PSCyr/* /usr/local/share/texmf/๊ธ์, ์๋๋ฉด ํด๋์ ๋ณต์ฌํ๋ ๋ช ๋ น์ ๊ท์ฐฎ๊ฒ ์คํํ ์ ์์ต๋๋ค. texmf ๊ทธ๋ ๊ฐ ์ด๋์ ์๋ :
user@hostname:~$ sudo cp -R ./PSCyr/* $(kpsewhich -expand-var='$TEXMFLOCAL')PSCyr ๊ธ๊ผด ์ค์น, TexLive์ ์ฐ๊ฒฐ:
user@hostname:~$ sudo texhash
user@hostname:~$ updmap --enable Map=pscyr.map
user@hostname:~$ sudo mktexlsrmd2pdf ๋ณํ์ ์ํ LaTeX ํ ํ๋ฆฟ
์ด ํ ํ๋ฆฟ์ด ์ด๋ป๊ฒ ๊ตฌ์ฑ๋์ด ์๋์ง ์ ํํ ์ค๋ช ํ์ง ์๊ณ ๋ง์ ์ค๋ช ์์ด ์คํฌ์ผ๋ฌ ์๋์ ๊ฐ๋จํ ์ค๋ช ํ๊ฒ ์ต๋๋ค. ์ ์ด๋ ๋ง์ ์์ค ์ฝ๋๊ฐ ์๋ ํ ์คํธ๋ฅผ ์ฒ๋ฆฌํ๋ ๋ฐฉ๋ฒ ์ธก๋ฉด์์ ์ ๊ตฌ์ฑ๋์ด ์๋ค๊ณ ๋งํ๋ฉด ์ถฉ๋ถํฉ๋๋ค. ๋ค์ฌ ์ฐ๊ธฐ ํฌ๊ธฐ, ์ค ๊ฐ๊ฒฉ, ์น์ ๋ฐ ํ์ ์น์ ์ ๋ฒํธ ๋งค๊ธฐ๊ธฐ ๋ถ์กฑ์ ๋ง์กฑํ์ง ์๋ ๊ฒฝ์ฐ ์ธํฐ๋ท์์ "๋ผํ ์ค์์ ์ํํ๋ ๋ฐฉ๋ฒ ..."์ด๋ผ๋ ์ง๋ฌธ์ Google์ ๊ฒ์ํ๋ ๊ฒ์ด ๋งค์ฐ ์ฝ์ต๋๋ค. ๊ทธ๋ฐ ๋ค์ ๋น์ ์ ํ์. ๋ช ํํ์ง ์์ ๊ฒฝ์ฐ ์๊ฒฌ์ ์์ฑํ์ญ์์ค. 4 ๋ ์ ๋ด ์ค์ ์ ์กฐ์ฌํ๊ณ ํ ํ๋ฆฟ์ ์ด๋ค ์ค์ด ๋ฌด์์ ๋ด๋นํ๋์ง ์ค๋ช ํ๊ฒ ์ต๋๋ค. ๊ทธ ๋์ ๋๋ ๋ด PC์์ ์ด๋ป๊ฒ ํ๋์ง ์ ์ด๋ ๊ฒ์ด๊ณ , ๋น์ ์ ์์ ๋กญ๊ฒ ๋ฐ๋ณตํ๊ฑฐ๋ ์ค์ค๋ก ์์ ํ ์ ์๋ค.
ํ์ผ ๋ง๋ค๊ธฐ ํ ํ๋ฆฟ.tex ์นดํ๋ก๊ทธ์ /usr/๊ณต์ /texlive/:
user@hostname:~$ sudo touch /usr/share/texlive/template.tex์ฝ๊ธฐ ๊ถํ์ ๋ถ์ฌํ์ญ์์ค.
user@hostname:~$ sudo chmod 444 /usr/share/texlive/template.tex๋ฃจํธ ์๋์์ ์ด๊ณ ์๋ ์คํฌ์ผ๋ฌ ์๋์ ์จ๊ฒจ์ง ๋ด์ฉ์ ๋ถ์ฌ ๋ฃ์ผ์ญ์์ค.
user@hostname:~$ sudo nano /usr/share/texlive/template.texํ ํ๋ฆฟ ๋ด์ฉ /usr/share/texlive/template.tex
documentclass[oneside,final,14pt]{extreport}
usepackage{extsizes}
usepackage{pscyr}
renewcommand{rmdefault}{ftm}
usepackage[T2A]{fontenc}
usepackage[utf8]{inputenc}
usepackage{amsmath}
usepackage{mathtext}
usepackage{multirow}
usepackage{listings}
usepackage{ucs}
usepackage{hhline}
usepackage{tabularx}
usepackage{booktabs}
usepackage{longtable}
usepackage{titlesec}
usepackage{hyperref}
usepackage{graphicx}
usepackage{setspace}
usepackage[center,it,labelsep=period]{caption}
usepackage[english,russian,ukrainian]{babel}
usepackage{vmargin}
newcommand{specialcell}[2][c]{%
begin{tabular}[#1]{@{}c@{}}#2end{tabular}}
setpapersize{A4}
setmarginsrb {1cm}{1cm}{1cm}{1cm}{0pt}{0mm}{0pt}{13mm}
usepackage{indentfirst}
setlengthparindent{1cm}
renewcommand{baselinestretch}{1}
renewcommandthechapter{}
renewcommandthesection{}
renewcommandthesubsection{}
renewcommandthesubsubsection{}
titleformat
{chapter} % command
{bfseriesnormalsizecentering} % format
{thechapter} % label
{0.5ex} % sep
{
centering
}
[
vspace{-1.5ex}
] % after-code
titleformat
{section}
[block]
{normalfontbfseries}
{thesection}{0.5em}{}
sloppy
letoldenumerateenumerate
renewcommand{enumerate}{
oldenumerate
setlength{itemsep}{1pt}
setlength{parskip}{0pt}
setlength{parsep}{0pt}
}
letolditemizeitemize
renewcommand{itemize}{
olditemize
setlength{itemsep}{1pt}
setlength{parskip}{0pt}
setlength{parsep}{0pt}
}
providecommand{tightlist}{%
setlength{itemsep}{0pt}setlength{parskip}{0pt}}
titlespacing{subsubsection}{parindent}{3mm}{3mm}
titlespacing{subsection}{parindent}{3mm}{3mm}
usepackage{color}
lstset{
basicstyle=footnotesizettfamily,
inputencoding=utf8,
extendedchars=true,
showspaces=false,
keepspaces=true
showstringspaces=false,
showtabs=false,
tabsize=4,
captionpos=b,
breaklines=true,
breakatwhitespace=true,
breakautoindent=true,
linewidth=textwidth
}
begin{document}
$if(title)$
maketitle
$endif$
$if(abstract)$
begin{abstract}
$abstract$
end{abstract}
$endif$
$for(include-before)$
$include-before$
$endfor$
$if(toc)$
{
$if(colorlinks)$
hypersetup{linkcolor=$if(toccolor)$$toccolor$$else$black$endif$}
$endif$
setcounter{tocdepth}{$toc-depth$}
tableofcontents
}
$endif$
$if(lot)$
listoftables
$endif$
$if(lof)$
listoffigures
$endif$
$body$
$if(natbib)$
$if(bibliography)$
$if(biblio-title)$
$if(book-class)$
renewcommandbibname{$biblio-title$}
$else$
renewcommandrefname{$biblio-title$}
$endif$
$endif$
bibliography{$for(bibliography)$$bibliography$$sep$,$endfor$}
$endif$
$endif$
$if(biblatex)$
printbibliography$if(biblio-title)$[title=$biblio-title$]$endif$
$endif$
$for(include-after)$
$include-after$
$endfor$
end{document}ํ์ผ์ ์ ์ฅํ์ธ์ /usr/share/texlive/template.tex Makrdown ํ์ผ์ PDF๋ก ๋ณํํ๋ ์คํฌ๋ฆฝํธ๋ฅผ ์์ฑํ์ฌ ๋์ผํ ํด๋์ ์ ๋์ฌ๊ฐ .pdf์ธ Markdown ํ์ผ์ด๋ผ๋ ํ์ผ์ ์์ฑํฉ๋๋ค. ์ฆ, ๋ณํ ํ ํ์ผ๋ช .md ํด๋์ ๋ํ๋ฉ๋๋ค. ํ์ผ๋ช .md.pdf. ์คํฌ๋ฆฝํธ๋ฅผ ํธ์ถํ์ md2pdf ๊ทธ๋ฆฌ๊ณ ๊ธธ์ ๊ฐ๋ค / usr / bin. ๋ช ๋ น์ ์์๋๋ก ์คํํด ๋ณด๊ฒ ์ต๋๋ค.
user@hostname:~$ cd
user@hostname:~$ touch md2pdf
user@hostname:~$ echo "#!/bin/bash" > md2pdf
user@hostname:~$ echo "pandoc --output=$1.pdf --from=markdown_github --latex-engine=pdflatex --listings --template=/usr/share/texlive/template.tex $1" >> md2pdf
user@hostname:~$ sudo cp md2pdf /usr/bin/
user@hostname:~$ sudo chmod 111 /usr/bin/md2pdf๋ค ๋ฒ์งธ ์ค์๋ ์ค์ ๋ก ๋ณํ ๋ช
๋ น์ด ํฌํจ๋์ด ์์ต๋๋ค. ์ฃผ์๋ฅผ ๊ธฐ์ธ์ด๋ค --from=markdown_github. ๋งํฌ๋ค์ด์ ๊นํ๋ธ ๋ฒ์ ์ ๊ธฐ์กด ๋งํฌ๋ค์ด๊ณผ ์ญํธํ์ด ๊ฐ๋ฅํ๊ธฐ ๋๋ฌธ์ ๊ฑฐ๊ธฐ์ ๊ธ์ ์ด๋ค๋ฉด ๊ฑฑ์ ํ ํ์๊ฐ ์๋ค. MD ํ์ผ์ด ํน์ Markdown ๋ฐฉ์ธ์ผ๋ก ์์ฑ๋ ๊ฒฝ์ฐ Pandoc ์ค๋ช
์(man pandoc), ๊ตฌํ์ด ์ง์๋๋์ง ํ์ธํ๊ณ ์กฐ์ ํ์ญ์์ค. /usr/bin/md2pdf ํ์ํ๋ค๋ฉด.
๋ค์๊ฐ ์๋ ์ค์น๋ฅผ ์ํ ์คํฌ๋ฆฝํธ
๋ง์ฝ ์๋ฌด๊ฒ๋ ์ค์ ํ๊ณ ์ถ์ง ์๋ค๋ฉด, Ubuntu๋ฐฐํฌ ๋ฐฉ์๊ณผ ์ ์ฌํ๊ฒ, ์คํฌ์ผ๋ฌ ์๋์ ๋ด์ฉ์ ์จ๊ธด ์คํฌ๋ฆฝํธ๋ฅผ ์์ฑํ๋ฉด ๋๋ถ๋ถ์ ๊ฒฝ์ฐ ๋ชจ๋ ๊ฒ์ด ์๋์ผ๋ก ์ค์น๋ ๊ฒ์ ๋๋ค. ๋จ, ์ ์คํฌ์ผ๋ฌ ์๋์ ์๋ TeX ํ ํ๋ฆฟ์ ํ์ํ ๊ณณ์ ๋ณต์ฌํด์ผ ํฉ๋๋ค. ํฐ๋ฏธ๋์ ์ด๊ณ ๋ค์ ๋ช ๋ น์ ์คํํ์ธ์.
user@hostname:~$ cd
user@hostname:~$ touch installmd2pdf.sh๊ทธ๋ฐ ๋ค์ ๋ค์ ๋ด์ฉ์ผ๋ก ์ฑ์๋๋ค.
$HOME/installmd2pdf.sh ์คํฌ๋ฆฝํธ์ ๋ด์ฉ
#!/bin/bash
cd /tmp
sudo apt install texlive-full pandoc -y
wget http://blog.harrix.org/wp-content/uploads/2013/02/PSCyr.zip
unzip -qq PSCyr.zip
cd
mkdir ./PSCyr/fonts/map ./PSCyr/fonts/enc
cp ./PSCyr/dvips/pscyr/*.map ./PSCyr/fonts/map/
cp ./PSCyr/dvips/pscyr/*.enc ./PSCyr/fonts/enc/
echo "fadr6t AdvertisementPSCyr "T2AEncoding ReEncodeFont"" > ./PSCyr/fonts/map/pscyr.map
sudo cp -R ./PSCyr/* $(kpsewhich -expand-var='$TEXMFLOCAL')
sudo texhash
updmap --enable Map=pscyr.map
sudo mktexlsr
sudo touch /usr/share/texlive/template.tex
touch md2pdf
echo "#!/bin/bash" > md2pdf
echo "pandoc --output=$1.pdf --from=markdown_github --latex-engine=pdflatex --listings --template=/usr/share/texlive/template.tex $1" >> md2pdf
sudo cp md2pdf /usr/bin/
sudo chmod 111 /usr/bin/md2pdf๋ค์ ๋ช ๋ น์ผ๋ก ์คํํ์ญ์์ค.
user@hostname:~$ sudo bash $HOME/installmd2pdf.sh์์ง ๋ง๋ผ /usr/share/texlive/template.tex " ์น์ ์ ํ์๋ ๋๋ก ์ ๋ ฅํด์ผ ํฉ๋๋ค.md2pdf ๋ณํ์ ์ํ LaTeX ํ ํ๋ฆฟ" ์ฝํ ์ธ .
md2pdf ์ฌ์ฉ
Markdown ํ์ผ(some_file.md) ํฐ๋ฏธ๋์์ ๋ค์ ๋ช ๋ น์ ์คํํฉ๋๋ค.
user@hostname:~$ md2pdf some_file.md๊ฒฐ๊ณผ์ ์ผ๋ก ํด๋์ ํ์ผ์ด ๋ํ๋ฉ๋๋ค. some_file.md.pdf.
๊ฒฐ๋ก
์ค๋ช ๋ ๋ฐฉ๋ฒ์ ๊ธฐ๋ฐ์ผ๋ก PDF ํ์ผ์ ๋ชจ๋ ์คํ์ผ์ ๋น๋ํ ์ ์์ผ๋ฉฐ Pandoc์์ ์ง์ํ๋ md ๋์ ๋ค๋ฅธ ํ์์ ๋ณํํ ์๋ ์์ต๋๋ค. ์ธ์ ๊ฐ ์ด ์ง์นจ์ด 3๋ช ๋ฐ์๊ฒ ๋์์ด ๋๊ธฐ๋ฅผ ๊ฐํ ๋ฐ๋๋๋ค.
์ถ์ฒ : habr.com
