4

I want to write a section of Skills in resume where the output will be like-

Personal Attributes

Independent | Curious | Adaptable | Problem Solver

Technical Skills

Java | Python | AWS

the above outtput I want to achieve with something like

\begin{skills}

\skilltype{Personla Attributes} \begin{skilllist}

\item{Independent}
\item{curious}
\item{adaptable}

\end{skilllist}

. . . . \begin{skills}

How sould I write the .cls file to have \textpipes in between? P.s. I don't want to write it like Curious \textpipe Adaptable etc.

additionally

would be great if possible a solution where the items are equally distributed and spacing between them is auto generated accordingly

  • Define "equally distributed". Would 3 items (say) take up the same space as 5 items? Or should it just be spread across \textwidth? – Werner Nov 20 '21 at 19:26
  • @Werner i mean irrespictive of 3 items or 5 items, they should occupy whole line (not equal width per items, but spacing should auto adjust) – theSwapnilSaste Nov 20 '21 at 19:35

2 Answers2

6

Use an inline list:

\documentclass{article}
\usepackage[inline]{enumitem}

\newlist{skillset}{enumerate*}{1} \setlist[skillset]{label={}, afterlabel={}, itemjoin={{ \textbar{} }}}

\begin{document} \begin{skillset} \item Java \item Python \item AWS \end{skillset} \end{document}

enter image description here

To make the list take the whole line add \hfill to the itemjoin. Margins shown:

\documentclass{article}
\usepackage[inline]{enumitem}
\usepackage[showframe]{geometry} % to show margins
\newlist{skillset}{enumerate*}{1}
\setlist[skillset]{label={}, afterlabel={}, itemjoin={{\hfill \textbar{} \hfill}}}
\begin{document}
\noindent\begin{skillset}
  \item Java
  \item Python
  \item AWS
\end{skillset}
\end{document}

enter image description here

Dan
  • 3,699
2
\NewDocumentEnvironment{skilllist}{}
   {%
     \RenewDocumentCommand{\item}{m} % ❶
        {%
          #1%
          \RenewDocumentCommand{\item}{m} % ❷
            { \textpipe\ ##1}% ❸
        }%
   }
   {%
     \par % ❹
   }

In the \begin{skilllist} definition we redefine \item ❶ to take a single argument which will be your skill. And within that redefinition, we will redefine \item again ❷ so that after the first \item each item will have | printed to separate it from the preceding items (with spaces before and after the |). Note also the use of ##1 in the inner redefinition so that LaTeX knows that we're referring to the definition of the defined command and not an outer command.

I've done no other real formatting since you'll likely handle that on your own other than to end the paragraph ❹ in the \end{skilllist} definition, but you can obviously add whatever additional formatting is necessary (e.g., enclosing each skill in \mbox to prevent line breaks in the middle of a skill).

Don Hosek
  • 14,078