清世何須憂廟廊——漢語詩詞 LaTeX 樣式

Typing some Chinese classical poems, I found most of the early examples are created for layouting English poems. Below I give a layout example of Tang poems anthology. Rather than a general solution, it’s just a particular example. Pls put below packages into the preamble of your document.

%漢字自動注音
\usepackage{xpinyin}
%漢字注音設置
\xpinyinsetup{ratio = .4,font =\ubufont,multiple={\color{black}}}

0 Tang Poem Environment

The Output:

The Codes:

\section{薛正明}
\begin{poemz}{薛正明}{遊鴈蕩}
    東風驛路馬蹄香,曉起行春到夕陽。\\
    三月鶯啼花柳寺,幾家人住水雲鄉。\\
    名山不用問樵字,清世何須憂廟廊。\\
    且脫綸巾隨洞客,紫簫吹月夜天涼。
\end{poemz}
此詩本事又可參見\lref{王績《野望》}。另,\textsf{曹丕}\emph{典論\bn 論文}:
「不假良史之辭,不托飛馳之勢,而聲名自傳於後。」\pref{虞世南《蟬》}

1 Detailed Design Process

1.0 Step 1: Define New Poem Environment

Define New Poem Environment with tcolorbox and xpinyin Packages

The Codes:

\newenvironment{poem}[3] %code={\doublespacing},
{\begin{tcolorbox}[left=1mm,right=1mm,top=3mm,bottom=2mm,enhanced,breakable,pad at break*=.5mm,title=#2,
        colframe=blue!50!black,colback=blue!10!white,colbacktitle=blue!5!myred!10!white,
        fonttitle=\Large\HGBM,coltitle=black,attach boxed title to top center=
        {yshift=-0.25mm-\tcboxedtitleheight/2,yshifttext=2mm-\tcboxedtitleheight/2},
        boxed title style={boxrule=0.5mm,
            frame code={ \path[tcb fill frame] ([xshift=-4mm]frame.west)
                -- (frame.north west) -- (frame.north east) -- ([xshift=4mm]frame.east)
                -- (frame.south east) -- (frame.south west) -- cycle; },
            interior code={ \path[tcb fill interior] ([xshift=-2mm]interior.west)
                -- (interior.north west) -- (interior.north east)
                -- ([xshift=2mm]interior.east) -- (interior.south east) -- (interior.south west)
                -- cycle;} }]
      \index[ian]{#1!#2}\index[ibn]{#2[#1]}\begin{pinyinscope} \begin{center}\subsectionmark{#2}\phantomsection
      \addcontentsline{toc}{subsection}{#2}\label{#1《#2》}\hypertarget{#1《#2》}
      \LARGE\linespread{1.4}\selectfont #3  %\HGBUM\ZSKS
    }
{\end{center}\end{pinyinscope}\end{tcolorbox}}

1.1 Step 2: Define New Cross Referencing Command

The Codes:

%邊註交互引用
\NewDocumentCommand\pref{m}
{\marginpar{\ding{43}\HGB\ubufontc\hyperlink{#1}#1(\pageref{#1})}}
%正文交互引用
\NewDocumentCommand\lref{m}
{{\HGB\ubufontc\hyperlink{#1}#1(\pageref{#1})}}

This will output:

1.2 Step 3: Creat Author or Title Index, etc

As shown in my another article Zhmakeindex and the Indices Creating of Chinese Books, the codes and the outputs will be:

%人名地名書名索引
\printindex[isn] % zhmakeindex -s isn.ist isn.idx
%作者索引
\printindex[ian] % zhmakeindex -s ian.ist ian.idx 
%篇目索引
\printindex[ibn] % zhmakeindex -s ibn.ist ibn.idx


   Reprint policy


《清世何須憂廟廊——漢語詩詞 LaTeX 樣式》 by Mèng Xiànjūn is licensed under a Creative Commons Attribution 4.0 International License
 Previous
電工王師傅 電工王師傅
本頁面測試 MathJax 書寫 LaTeX 公式。 0 測試結論簡單測試,發覺此方法並不能全面滿足公式輸入,還是乖乖回到 LaTeX Book 或 Beamer 本身。電工王師傅畢竟只是電工而已,有高級職稱也沒啥用呢,各人幹各人擅長之事吧
Next 
Tikz Examples in Re-composing McQuail's Textbook Tikz Examples in Re-composing McQuail's Textbook
Last month re-composed the classic Textbook, McQuail’s Mass Communication Theory, the following are some tikz examples i
  TOC