%% Copyright 2016 Christophe Roger % % Author: % Christophe Roger (Darwiin) % % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3c % of this license or (at your option) any later version. % The latest version of this license is in % http://www.latex-project.org/lppl.txt % and version 1.3 or later is part of all distributions of LaTeX % version 2005/12/01 or later. % % This work has the LPPL maintenance status `maintained'. % % The Current Maintainer of this work is M. C. Roger. % % This work consists of the files awesome-source-cv.cls \ProvidesClass{awesome-source-cv}[2016/11/05 v1.6.1 Awesome Source CV Class] \LoadClass[a4paper]{article} \DeclareOption{green}{ \def\@green{green} } \DeclareOption{red}{ \def\@red{red} } \DeclareOption{indigo}{ \def\@indigo{indigo} } \DeclareOption{orange}{ \def\@orange{orange} } \DeclareOption{localFont}{ \def\@local{local} } \DeclareOption{alternative}{ \def\@alternative{alternate} } \ProcessOptions % Dependences %A Few Useful Packages \RequirePackage[frenchb]{babel} %\RequirePackage[utf8]{luainputenc} % luatex \RequirePackage{fontspec} % for loading fonts \RequirePackage{url,parskip} % other packages for formatting \RequirePackage[usenames,dvipsnames]{xcolor} \RequirePackage{fullpage} \RequirePackage[margin=1.5cm]{geometry} \RequirePackage{fontawesome} \RequirePackage{hyperref}\hypersetup{hidelinks} \RequirePackage{titlesec} \RequirePackage{array} \RequirePackage{enumitem} \RequirePackage{longtable} \RequirePackage{etoolbox} \RequirePackage{tikz} \RequirePackage[skins]{tcolorbox} % \DeclareUnicodeCharacter{00E9}{\'{e}} %luatex % Define default accent colors %\definecolor{basecolor}{HTML}{000066} %BLUE \definecolor{basecolor}{HTML}{0f4c81} \ifundef{\@green} { \ifundef{\@red} { \ifundef{\@indigo}{ \ifundef{\@orange} {} { \definecolor{basecolor}{HTML}{e68a00} } } { \definecolor{basecolor}{rgb}{0.2, 0.07, 0.48} } } { \definecolor{basecolor}{HTML}{b30000} } %RED } { \definecolor{basecolor}{rgb}{0.0, 0.62, 0.38} } \definecolor{darkGrey}{HTML}{989898} \colorlet{linkcolor}{basecolor} \colorlet{accentcolor}{linkcolor!90} \colorlet{symbolcolor}{linkcolor!85} % Setup hyperref package, and colours for links %\definecolor{linkcolour}{rgb}{0,0.2,0.6} \hypersetup{breaklinks} \pagestyle{empty} % non-numbered pages %\font\fb=''[cmr10]'' % for use with \LaTeX command % Setup CV sections \titleformat{\section}{\Large\raggedright}{}{0em}{}[\titlerule] \titlespacing{\section}{0pt}{2pt}{2pt} % Configure list \setlist[itemize,1]{label=\faAngleRight, nosep, leftmargin=2em} % Setup Array : new column type \newcolumntype{R}[1]{>{\hfill}m{#1}} %Italian hyphenation for the word: ''corporations'' \hyphenation{im-pre-se} % Setup fonts \defaultfontfeatures{Mapping=tex-text} % %------------------------------------------------------------------------------- % Configuration for fonts %------------------------------------------------------------------------------- % ⚠️⚠️ 本文件已被改写:字体**全部**取自仓库公共字体包 ../fonts.tex。 % % 上游 awesom e-cv 的中文版原来这么配(共三处,都已删除): % ① zh_cn-adobefonts_external.sty 里 \setCJKmainfont{AdobeSongStd-Light.otf} % —— Adobe 宋/黑/楷/仿四款共 56 MB,商业授权,**不能随仓库分发**。 % 而且那份文件还拿 HarmonyOS Sans 去冒充 Bold/Italic/SmallCaps: % BoldFont = HarmonyOS_Sans_SC_Regular.ttf % ItalicFont = HarmonyOS_Sans_SC_Regular.ttf % 等于"加粗=不变"、"斜体=不变",标题的层次全靠字号撑,是个将就做法。 % ② \setmainfont{SourceSansPro-Light}(localFont 分支) % 9 个 .otf,SIL OFL 1.1 可用,但本仓库不打算为一份字体再带 4 MB。 % ③ \setfontfamily\FA[Path=fonts/]{FontAwesome} % Path 指向本目录下不存在的 fonts/ —— 那份图标字体在 TeX Live 里。 % % 现在的映射: % 西文正文 Source Sans Pro Light → TeX Gyre Termes(本仓库自带) % 中文正文 Adobe Song / HarmonyOS → OUC Serif(思源宋体子集,自带) % 中文粗体 (原来=不变) → OUC Serif Bold(真粗体) % 中文斜体 无 → OUC Kai(楷体代斜体,中文惯例) % FontAwesome TeX Live 系统包 → 仓库 fonts/fontawesome/ % % ⚠️ 字体文件本体在 ../fonts/ 下,由 ../fonts.tex 统一设置, % **不要在本文档或 .tex 里再写 \setCJKmainfont / \setmainfont**。 % 下面只做"西文用哪一档"的局部调整。 %------------------------------------------------------------------------------- % FontAwesome:图标字体已经放进仓库公共字体目录, % ⚠️ 但**不要在这里重新声明 \FA** —— fontawesome.sty 自己在正文里就做了 % \newfontfamily{\FA}[Path=../fonts/fontawesome/]{FontAwesome.otf} % 且它在 \RequirePackage{fontawesome} 时就执行(早于本 cls 的后面几句)。 % 这里再声明一次会报 "Font \FA already defined"(LaTeX3 的 % \NewDocumentCommand 语义),所以只留注释说明。 % % 上游原来是 \setfontfamily\FA[Path=fonts/]{FontAwesome}, % Path 指向本目录下并不存在的 fonts/ —— 只能靠系统字体兜底。 % 现在路径写进 fontawesome.sty 了。 % 西文正文:上游用 Source Sans Pro Light(很细),本模板改用 Termes。 % 注意这里**不能**再 \setmainfont —— 那会把 fonts.tex 设好的 Termes % 整套换掉。只把上游代码里对 Light/Semibold 的引用映射到 Termes 的 % 常规/粗体两档,保持"正文常规、强调加粗"的层级不变。 \providecommand{\sourcesanslight}{\tnr} \providecommand{\sourcesanssemibold}{\tnrb} %New length definition % % ⚠️ 这两个长度原来写死 14.8cm / 2.5cm,加起来 17.3cm,看着小于版心宽 % 18cm(A4 21cm − 2×1.5cm 边距)。但 longtable 每列还有 \tabcolsep % 各占左右一侧(默认 6pt),两列共 4 个 \tabcolsep = 24pt ≈ 0.85cm, % 于是实际占宽 18.15cm → 溢出 4.48pt,报 % Overfull \hbox (4.48311pt too wide) in alignment at lines 20--70 % 这种"算着够、实际差一点"的溢出,换字号/字体后会时有时无,很难查。 % % 改法:不让它猜,直接用 \linewidth 减去左列与列间距。 % 这样改页边距(geometry)后不用再跟着调数字。 \newlength{\rightcolumnlength} \newlength{\leftcolumn} \setlength{\leftcolumn}{2.5cm} \setlength{\rightcolumnlength}{% \dimexpr\linewidth-\leftcolumn-4\tabcolsep\relax} % Font Awesome icons aliases \newcommand{\mailSymbol}{\faEnvelope} \newcommand{\mailSymbolO}{\faEnvelopeO} \newcommand{\locationSymbol}{\faMapMarker} \newcommand{\infoSymbol}{\faInfo} \newcommand{\homeSymbol}{\faLink} \newcommand{\weiboSymbol}{\faWeibo} \newcommand{\linkedinSymbol}{\faLinkedin} \newcommand{\mobileSymbol}{\faMobilePhone} \newcommand{\githubSymbol}{\faGithub} \newcommand\link[2]{\color{linkcolor}\href{#1}{#2}\color{Black} } \newcommand\important[1]{\textbf #1} % Create a tag % Usage: \cvtag{} \newcommand{\cvtag}[1]{% %\tikz[baseline]\node[anchor=base,draw=darkGrey!70,rounded corners=0.5ex,inner xsep=1ex,inner ysep =0.55ex,text height=1.3ex,text depth=.25ex]{#1}; \begin{tikzpicture} \node[anchor=base,draw=darkGrey!70,rounded corners=0.5ex,inner xsep=1ex,inner ysep =0.4ex,text height=2ex,text depth=.25ex]{#1}; \end{tikzpicture} } % Create a chinese tag % Usage: \cvtag{} \newcommand{\cvtagcn}[1]{% %\tikz[baseline]\node[anchor=base,draw=darkGrey!70,rounded corners=0.5ex,inner xsep=1ex,inner ysep =0.55ex,text height=1.3ex,text depth=.25ex]{#1}; \begin{tikzpicture} \node[anchor=base,draw=darkGrey!70,rounded corners=0.5ex,inner xsep=1ex,inner ysep =0.4ex,text height=2ex,text depth=.25ex]{#1}; \end{tikzpicture} } % Render author's name % Usage: \user{}{} \newcommand\user[2]{\color{accentcolor}{\LARGE #1 \textbf{#2}}\color{Black}} % Render a text with its symbol % Usage; \socialtext{}{