
我目前正在使用以下方法處理文檔迪迪簡歷模板
http://www.latextemplates.com/template/deedy-resume-cv
在 LaTeX 中,我有兩個問題導致進退兩難,我無法解決它。
我正在使用該包很棒的在文字中嵌入圖標pgf圖建立圖表。
問題#1:
當我使用 XeLaTeX 編譯文件時,不同檢視器(Adobe Reader、Evince 等)之間的字體圖示縮放有所不同。
解:使用 LuaLaTeX - 無縮放問題
問題#2:
當我用 LuaLaTeX 編譯文檔時,參數
x axis line style={opacity=0},
隱藏邊緣線但保留軸標籤在 tikzpicture 軸環境中無效。不過,它與 XeLaTeX 配合得很好。
相關 LaTeX 片段:
\documentclass[lettera4paper]{deedy-resume}
\usepackage{fontspec}
\usepackage{fontawesome}
\usepackage{pgfplots}
\begin{document}
\section{Icons}
\begin{tabular}{lll}
\faSmile{} Smile :) & \faHospital{} Hospital & plain text
\end{tabular}
\section{Bar chart}
\definecolor{color1}{HTML}{666666}
\begin{tikzpicture}
\begin{axis}[
xbar,
x axis line style={opacity=0},
enlargelimits=0.1,
major tick style={draw=none},
legend style={draw=none},
xmin=0,
symbolic x coords={0,1,2,3,4,5,6},
symbolic y coords={A,B,C,D,E,F},
xtick={0,1,2,3,4,5,6},
ytick={A,B,C,D,E,F},
bar width=0.7em,
xmajorgrids,
major grid style=white,
axis on top,
cycle list={fill=color1, draw=none},
]
\addplot coordinates {(6,A) (5,B) (3,C) (4,D) (3,E) (1,F)};
\end{axis}
\end{tikzpicture}
\end{document}
答案1
adobe reader 中字體過大的問題來自於使用具有特定解析度的 OTF 格式字體時 XeLaTex 的錯誤(請參閱http://typophile.com/node/46451)。為了避免這個問題,我所做的就是在本地使用 FontAwesome 的 .ttf 版本。這樣做的額外好處是讓您可以使用新字體,之後更容易分享您的作品,並且它是獨立於平台的。這是我所做的:
- 我在這裡下載最新版本的字體http://fortawesome.github.io/Font-Awesome/
- 我提取文件並在本地複製名為“fontawesome-webfont.ttf”的文件,其中我的乳膠文檔位於子資料夾中(例如,名為 fonts)。
- 我使用包加載字體
fontspec
以重新定義\FA
字體系列。
以下是您提供的 MWE 的修改範例:
\documentclass[lettera4paper]{deedy-resume}
\usepackage{fontspec}
\usepackage{fontawesome}
\usepackage{pgfplots}
\newfontfamily{\FA}[Path = fonts/]{fontawesome-webfont}
\begin{document}
\section{Icons}
\begin{tabular}{lll}
\faSmile{} Smile :) & \faHospital{} Hospital & plain text
\end{tabular}
\section{Bar chart}
\definecolor{color1}{HTML}{666666}
\begin{tikzpicture}
\begin{axis}[
xbar,
x axis line style={opacity=0},
enlargelimits=0.1,
major tick style={draw=none},
legend style={draw=none},
xmin=0,
symbolic x coords={0,1,2,3,4,5,6},
symbolic y coords={A,B,C,D,E,F},
xtick={0,1,2,3,4,5,6},
ytick={A,B,C,D,E,F},
bar width=0.7em,
xmajorgrids,
major grid style=white,
axis on top,
cycle list={fill=color1, draw=none},
]
\addplot coordinates {(6,A) (5,B) (3,C) (4,D) (3,E) (1,F)};
\end{axis}
\end{tikzpicture}
\end{document}
當使用 XeLaTex 編譯時,Ubuntu 14.04 中的 adobe reader 9 會產生:
如何手動定義新字體:
您也可以自己定義字體的命令,而不是使用套件fontawesome
。讓我們來看看 github 的新字體:
- 繼續字體頁面並檢查它的 Unicode。
像這樣定義和使用它:
\documentclass{article} \usepackage{fontspec} \newfontfamily{\FA}[Path = fonts/]{fontawesome-webfont} \def\githubAlt{{\FA\symbol{"F113}}} \begin{document} GitHub icon: \githubAlt \end{document}
這產生:
答案2
這是第一個問題的解決方案(摘自這裡):
- 從他們的網站下載最新版本的 fontawesome: http://fortawesome.github.io/Font-Awesome/
- 安裝
.ttf
字型版本(只需在大多數作業系統上雙擊該檔案即可) \newfontfamily{\FA}{FontAwesome}
將文件中的行替換fontawesome.sty
為\newfontfamily{\FA}{FontAwesome Regular}
這為我解決了縮放問題。請查看上面的連結以了解技術細節。