2023年9月14日 星期四

使用 pandoc 把 LaTeX 文件轉換成 html 檔案

在 Ubuntu 下,可以安裝 pandoc 這個轉換文件檔案格式的程式。安裝的方法是:

$ sudo apt install pandoc

要把一個 LaTeX 檔案轉換成 html 檔案,可以用以下指令:

$ pandoc --toc inputfile.tex -s --mathjax -o outputfile.html

 

參考資料:

https://www.homepages.ucl.ac.uk/~ucahmto/elearning/latex/2019/06/10/pandoc.html

一個 LaTeX 文件格式的自定範例

\documentclass{ctexart}

\setmainfont{Liberation Serif}

\setCJKmainfont{AR PL UMing TW}

\usepackage[T1]{fontenc}
\usepackage[a4paper,textwidth=13.5cm]{geometry}
\usepackage{framed}
\usepackage{color}

\usepackage{hyperref}
\hypersetup{
    colorlinks=true,
    linkcolor=blue,
    filecolor=magenta,      
    urlcolor=cyan,
}

\urlstyle{same}

\definecolor{shadecolor}{rgb}{0.92,0.92,0.92}

\title{健康}
\author{ABC醫師\thanks{作者為家庭醫學科主治醫師 email: \href{emailto: test@xyzmail.com}{test@xyzmail.com}}}

\date{2022年3月10日修訂版}
\begin{document}
\maketitle
\fontsize{12}{20pt}\selectfont

您可以用中文。You can also write English document.

\end{document}

Ubuntu 中的字型安裝問題

 說明:

1. 在 Ubuntu 中,若要安裝 Times New Roman,可以用以下指令:

$ sudo apt install ttf-mscorefonts-installer

2.  如何查看 Ubuntu 中安裝了哪些字型,和字型的名稱?

可以打開 LibreOffice Writer,看可用的字型和名稱。

或是在終端機中,用

$ fc-list :lang=en

$ fc-list :lang=zh

分別查看系統中的英文和中文字型有哪些。

3. 政府有製作開放授權的楷體和宋體的全字庫字型,可以從中文標準交換碼全字庫這個網站下載使用。安裝好後,字型名稱,分別為 TW-Kai (全字庫正楷體)和 TW-Sung(全字庫正宋體) 。

4. 在 Ubuntu 中,剛下載的字型檔,只要用滑鼠點兩下檔案,按 install,幾秒後即完成安裝。