4

I'd like to realize the following:

enter image description here

But I can not bond the vertical text and the line together. I use a tabular environment and this is what I get:

enter image description here

My code is this:

%!TEX program = xelatex

\documentclass[a4paper]{article}

\RequirePackage{pgffor}
\RequirePackage{wasysym}
\newcommand{\dotrating}[1]{
    \foreach \n in {1,...,4}{%
        \ifnum\n>#1%
            \fullmoon%
        \else%
            \newmoon%
        \fi%
        ~
    }
}

\RequirePackage{multirow}
\RequirePackage{rotating}
\RequirePackage{ifthen}

\newcounter{skillsNumber}

\newenvironment{skillgroup}[2]{%

    \setcounter{skillsNumber}{0}

    \newcommand{\skill}[2]{
        \addtocounter{skillsNumber}{1}
        \ifthenelse{\equal{1}{\value{skillsNumber}}}{
            \multirow{#2}{*}{
                \rotatebox{90}{\centering
                    \tiny\uppercase{#1}
                }
            }
        }{}
        & \parbox{2.5cm}{\raggedright##1} & \dotrating{##2} \\
    }

    \renewcommand{\arraystretch}{0.5}

    \begin{tabular}{r|ll}
}{%
    \end{tabular}
}

\begin{document}


    \begin{skillgroup}{PROGRAMMATION}{6}
        \skill{C}{3}
        \skill{C++}{3}
        \skill{JAVA}{2}
        \skill{MATLAB}{4}
        \skill{VBA/6/.NET}{4}
        \skill{Shell}{4}
    \end{skillgroup}


\end{document}

How can I stick the vertical line and the text together? Moreover, the width of the multirow is too big. How can I reduce it?

3 Answers 3

4

I'd do something like this (also you had a lot of % where they were not needed \else% and a lot of % missing where they were needed (everywhere else:-)

enter image description here

\documentclass[a4paper]{article}


\RequirePackage{wasysym}
\RequirePackage{graphicx}


\newcommand{\dotrating}{%
        \ifnum\count0<\count2 %
            \newmoon
        \else
            \fullmoon
        \fi
            \hspace{.5em}%
         \ifnum\count0<3
            \advance\count0 1 %
            \expandafter\dotrating
         \fi
}



\newcounter{skillsNumber}

\newenvironment{skillgroup}[2]{%
    \setcounter{skillsNumber}{0}%
    \newcommand{\skill}[2]{%
       ##1&\count0=0\count2=##2\relax
           \dotrating\\%
    }
%
    \renewcommand{\arraystretch}{1.1}%

   \rotatebox{90}{\llap{\tiny\uppercase{#1}}}%
    \begin{tabular}[t]{@{}|ll}%
}{%
    \end{tabular}%
}

\begin{document}


    \begin{skillgroup}{PROGRAMMATION}{6}
        \skill{C}{3}
        \skill{C++}{3}
        \skill{JAVA}{2}
        \skill{MATLAB}{4}
        \skill{VBA/6/.NET}{4}
        \skill{Shell}{4}
    \end{skillgroup}


\end{document}
4

Would this be close to wha you seek? This solution proposes keep your code with minor changes shown by % here and add a raisebox scheme to lower the text

        \raisebox{-1.5ex}[0ex][0ex]{\tiny\uppercase{#1}\hspace{-14ex}}

enter image description here

Code

%!TEX program = xelatex

\documentclass[border=10pt]{standalone}%[a4paper]{article}


\RequirePackage{pgffor}
\RequirePackage{wasysym}
\newcommand{\dotrating}[1]{%
    \foreach \n in {1,...,4}{%
        \ifnum\n>#1%
            \fullmoon
        \else
            \newmoon
        \fi
        ~
    }
}

\RequirePackage{multirow}
\RequirePackage{rotating}
\RequirePackage{ifthen}

\newcounter{skillsNumber}

\newenvironment{skillgroup}[2]{%
    \setcounter{skillsNumber}{0}
    \newcommand{\skill}[2]{%
        \addtocounter{skillsNumber}{1}
        \ifthenelse{\equal{1}{\value{skillsNumber}}}{%
            \multirow{#2}{*}{%
                \rotatebox{90}{%
                    \raisebox{-1.5ex}[0ex][0ex]{\tiny\uppercase{#1}\hspace{-14ex}}  % here
                }
            }
        }{}
        & \parbox{2.5cm}{\raggedright##1} & \dotrating{##2} \\
    }

    \renewcommand{\arraystretch}{1.3}    % here
    \begin{tabular}{r@{}|ll}             % here
}{%
    \end{tabular}
}

\begin{document}

    \begin{skillgroup}{PROGRAMMATION}{6}
        \skill{C}{3}
        \skill{C++}{3}
        \skill{JAVA}{2}
        \skill{MATLAB}{4}
        \skill{VBA/6/.NET}{4}
        \skill{Shell}{4}
    \end{skillgroup}


\end{document}

Updated: Define home-made fullmoon and newmoon without using wasysymb package

enter image description here

Code

%!TEX program = xelatex

\documentclass[a4paper]{article}
\usepackage{tikz}
\newcommand*\circled[1]{\tikz[]{
            \node[shape=circle,draw,inner sep=0.01ex] () {#1};}}

\newcommand*\fullmoon{\tikz[]{
            \draw[] circle(.75em);}}
\newcommand*\newmoon{\tikz[]{
            \draw[fill] circle(.5em);}}


\RequirePackage{pgffor}
%\RequirePackage{wasysym}
\newcommand{\dotrating}[1]{%
    \foreach \n in {1,...,4}{%
        \ifnum\n>#1%
         \fullmoon
        \else
       \circled\newmoon
        \fi
        ~
    }
}

\RequirePackage{multirow}
\RequirePackage{rotating}
\RequirePackage{ifthen}

\newcounter{skillsNumber}

\newenvironment{skillgroup}[2]{%
    \setcounter{skillsNumber}{0}
    \newcommand{\skill}[2]{%
        \addtocounter{skillsNumber}{1}
        \ifthenelse{\equal{1}{\value{skillsNumber}}}{%
            \multirow{#2}{*}{%
                \rotatebox{90}{%
                    \raisebox{-1.5ex}[0ex][0ex]{\tiny\uppercase{#1}\hspace{-14ex}}
                }
            }
        }{}
        & \parbox{2.5cm}{\raggedright##1} & \dotrating{##2} \\
    }

    \renewcommand{\arraystretch}{1.3}
    \begin{tabular}{r@{}|ll}
}{%
    \end{tabular}
}

\begin{document}

    \begin{skillgroup}{PROGRAMMATION}{6}
        \skill{C}{3}
        \skill{C++}{3}
        \skill{JAVA}{2}
        \skill{MATLAB}{4}
        \skill{VBA/6/.NET}{4}
        \skill{Shell}{4}
    \end{skillgroup}


\end{document}
4

Here's a solution that uses a TikZ picture instead of a tabular environment:

\documentclass[border=4pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{positioning}

\makeatletter
\def\aerow{0}
\def\aehu{0.45cm*}%% horizontal unit for placement of circled nodes
\newcommand\ae@parse@current@skill[2]{%%
  \xdef\aerow{\number\numexpr\aerow+1}%%
  \node[anchor=west] (N\aerow) at (0,-\aerow) {\sffamily#1};
  %% \ae@last@node is used to help draw vertical line
  \gdef\ae@last@node{N\aerow}%%
  \foreach \myn in {0,1,2,3}
  {
    \edef\ae@h@position{\dimexpr\ae@longest+\aehu\myn+10pt}%%
    \node [draw,circle,inner sep=3pt] at (\ae@h@position,-\aerow) {};
    \ifnum\myn<#2\relax
      \draw[fill] (\ae@h@position,-\aerow) circle (2.75pt) ;
    \fi
  }
  \def\ae@skill@level{#2}}


\newlength\ae@tmp
\newlength\ae@longest
\newcommand\skillgroup[2]{%%
  \def\ae@title{#1}%%
  \def\ae@skillgroup{#2}%%
  %% first determine the length of the longest skill name
  \foreach \myskill in \ae@skillgroup
  {\expandafter\ae@extract@parts\myskill
    \settowidth\ae@tmp{\ae@current@skill}%%
    \ifdim\ae@tmp>\ae@longest
      %% \global is necessary because of grouping created by \foreach
      \global\setlength\ae@longest{\ae@tmp}%%
    \fi
  }%%
  %% now present all the skills
  \begin{tikzpicture}[y=4ex]
    \foreach \myskill in \ae@skillgroup
    {
      \expandafter\ae@parse@current@skill\myskill
    }
  \node[anchor=south east,rotate=90,inner sep=0pt] at ([xshift=-1pt]N1.north west) {\ae@present@title};
  \draw (N1.north west) -- (\ae@[email protected] west);
  \end{tikzpicture}}

\def\ae@present@title{\textsf{\tiny\expandafter\uppercase\expandafter{\ae@title}}}

\def\ae@extract@parts#1#2{%% 
  \def\ae@current@skill{#1}%%
  \def\ae@current@level{#2}}

\makeatother

\begin{document}

\skillgroup{PROGRAMMATiON}{%%
  {C}{3},
  {C++}{3},
  {JAVA}{2},
  {MATLAB}{4},
  {VBA/6/.NET}{4},
  {Shell}{4}}

\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .