I am currently trying to learn Latex with writing my CV with it. I am stuck at the point that I want to list my skills. I just want to have a simple function that takes a dynamic list of skills and creates a table out of it. I've read a lot of stuff using pggfor or etoolbox and more and I am kinda exhausted. Most of them are not easy to read and seem too complicated for a beginner.
\documentclass{article}
\begin{document}
\newcommand\createskill[2]{%
\textsc{\textbf{#1}} & #2
}
\newcommand\createskills[1]{%
\begin{tabular}{r|l}
\makeatletter
\@for\thisitem:=#1\do{\thisitem \\} %in the last iteration of loop a new line is added also
\makeatother
\end{tabular}
}
% usage
\newcommand{\skillone}{\createskill{programming}{Python Java }}
\newcommand{\skilltwo}{\createskill{math}{Calculus Statistics}}
\createskills{\skillone, \skilltwo}
\end{document}
My problem is that because of \\
in the last iteration a new line is also added and I get a empty table row with only a sperator. I am open to suggestions to have a for loop that won't add this \\
in the last iteration.
I tried another solution with using \foreach
command. Even though I got rid of the unnecessary \\
in the last row, this doesn't work well when contained within tabular
environment.
\newcommand\createtablecontent[1]{%
\foreach \x [count=\xi] in {#1} {\ifthenelse{\xi=1}{\x}{\\ \x}}
}
\newcommand\createskillsanothertry[1]{% called in the same way \createskills
\begin{tabular}{r|l}
\createtablecontent{#1}
\end{tabular}
}
with the above solution I only have the first row, and 22 warnings which seem quite complex.
If I exclude the tabular environment I have the desired behaviour of creating 2 lines of content.
\newcommand\createskillsanothertry[1]{%
\createtablecontent{#1}
}
\documentclass
to\end{document}
.