如何对齐文字和图标?

如何对齐文字和图标?

这是我的代码:

{\hspace{10mm}\textcolor{brown}{2006 - 2010} \hspace{5mm}} 
{\textbf{\textcolor{blue}{BBA Hons (equivalent MBA)} \hspace{6.5mm} 
{\faUniversity}\hspace{2mm}Al Khair University}\hspace{2mm}
\hspace{47mm}  \faMapMarker \hspace{1mm} Pakistan }

{\hspace{10mm}\textcolor{brown}{2005 - 2009} \hspace{5mm}} 
{\textbf{\textcolor{blue}{CA Foundation} \hspace{25mm} 
{\faUniversity}\hspace{2mm}Institute of Chartered Accountants}\hspace{26mm}
\faMapMarker \hspace{1mm} Pakistan}


\hspace{10mm} \textcolor{brown}{2011} \hspace{4mm}
{\textbf{\textcolor{blue}{Certified Internal Auditor (CIA)}}
\hspace{10.4mm} \faUniversity 
\hspace{2mm}\textbf{The Institute of Internal Auditors (IIA)} \hspace{22mm} 
\faMapMarker \hspace{1mm} USA

\hspace{10mm} \textcolor{brown}{2017} \hspace{4mm}
{\textbf{\textcolor{blue}{ Certified Public Accountant (CPA)}}
\hspace{5mm} \faUniversity 
\hspace{2mm} \textbf{American Institute of Certified Public Accountants}
\hspace{3mm} \faMapMarker \hspace{1mm} USA

如您所见,文本(年份未对齐,并且大学和位置图标也未对齐)

答案1

tabulary分别使用和的两个解决方案tabto

如果没有 MWE 来工作,这可能不太适合您的实际文档,但它应该很容易适应您的需求。

姆韦

\documentclass{article}
\usepackage[margin=2cm]{geometry} 
\usepackage{fontspec} 
\usepackage{fontawesome,xcolor}  
% for solution A  only:
\usepackage{tabulary,array} 
% for solution B only:
\usepackage{tabto}  
\TabPositions{.12\linewidth,.46\linewidth,.75\linewidth,.89\linewidth}
\newcommand\myrow[4]{\noindent\textcolor{brown}{#1}\tab%
\textbf{\textcolor{blue}{#2}}\tab%
\faUniversity\quad\parbox[t]{.35\linewidth}{\raggedright #3}\tab%
 \faMapMarker~#4\par}

\begin{document}\sffamily

\section*{Solution A}
\extrarowheight1ex
\noindent\begin{tabulary}{\linewidth}{@{}
>{\color{brown}}l
>{\bfseries\color{blue}}l
>{\faUniversity~}lL
>{\faMapMarker~}ll@{}}
2006 -- 2010 & BBA Hons (equivalent MBA) && Al Khair University && Pakistan\\
2005 -- 2009 & CA Foundation && Institute of Chartered Accountants && Pakistan\\
2011 & Certified Internal Auditor (CIA) && The Institute of Internal Auditors (IIA) && USA\\
2017 & Certified Public Accountant (CPA) && American Institute of Certified Public Accountants && USA\\
\end{tabulary}
\section*{Solution B}
{\parskip1ex
\myrow{2006 - 2010}{BBA Hons (equivalent MBA)}{Al Khair University}{Pakistan}
\myrow{2005 - 2009}{CA Foundation}{Institute of Chartered Accountants}{Pakistan}
\myrow{2011}{Certified Internal Auditor (CIA)}{The Institute of Internal Auditors (IIA)}{USA}
\myrow{2017}{Certified Public Accountant (CPA)}{American Institute of Certified Public Accountants}{USA}}
\end{document}

相关内容