Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redefinition of skill and language bars to circles or squares within polycvsidebar #7

Open
evensure opened this issue Aug 24, 2020 · 4 comments · May be fixed by #9
Open

Redefinition of skill and language bars to circles or squares within polycvsidebar #7

evensure opened this issue Aug 24, 2020 · 4 comments · May be fixed by #9
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@evensure
Copy link

Using the \renewcommand\cvlanguage[2]{\cvline{\levelbarsquares[0.7\linewidth]{#2}}{#1}} in the preamble is ignored by the progressbars within the polycvsidebar environment.

What did work was using this command within the sidebar, however this also badly affects the list's format in 2 ways:

  1. language on the right side and squares on the left
  2. general spacing (text and squares are not bound to the left and right side

I also did some experimenting by manually redefining \cvlanguage and \cvskill and got a similarly bad format (I currently can't find these modifications anymore)

Is there a way to redefine the language and skill commands for polycvsidebar as well while not keeping the original format?

@polyluxus polyluxus self-assigned this Aug 24, 2020
@polyluxus polyluxus added the enhancement New feature or request label Aug 24, 2020
@polyluxus
Copy link
Owner

Analysis

I have to admit this was nothing I anticipated. The circles and squares are late additions, and didn't make it to the final release of the sidebar. As such, the mechanism is (still) internal and needs to be overwritten explicitly. The culprit is in the following code:

polycv/source/latex/polycv.dtx

Lines 1989 to 1998 in 0d17e7d

\providecommand\polycv@sidebar@skill[3][\polycvhintcolsep]{%
\parbox{1.0\linewidth}{%
\hspace{#1}%
\parbox[b]{2\linewidth/3-4#1}{#2}%
\hspace{#1}\hfill%
\parbox[b]{\linewidth/3}{%
\progressbar[\linewidth]{#3}%
}%
\vspace{0.2\baselineskip}}%
}

To be honest, I don't exactly know how I came up with this form of template and why I used exactly these lengths. I guess it felt right at the time.

This is how the skill is defined and later used in the sidebar:

polycv/source/latex/polycv.dtx

Lines 2017 to 2022 in 0d17e7d

\let\cvlanguage\save@polycvlanguage%
\newcommand{\cvlanguage}[2]{%
\polycv@sidebar@skill{##1}{##2}}%
\let\cvskill\save@polycvskill%
\newcommand{\cvskill}[2]{%
\polycv@sidebar@skill{##1}{##2}}%

So you could indeed redefine these commands within the sidebar, since the original definition will be restored at the end:

polycv/source/latex/polycv.dtx

Lines 2035 to 2036 in 0d17e7d

\let\save@polycvlanguage\cvlanguage%
\let\save@polycvlanguage\cvskill%

Current Workarounds

This is not as straightforward as for the main body, because there is (currently) no accessible template for a single (skill) line. However, you can define it yourself to whatever you want with quite low-level commands. A very simple reimplementation would be:

  \begin{polycvsidebar}%
% [...] 
  \renewcommand{\cvskill}[2]{%
    \parbox{1.0\linewidth}{#1\hfill\levelbarsquares[0.4\linewidth]{#2}}%
  }
% [...]
  \end{polycvsidebar}

For long descriptions this might look odd and brake. More complicated and possibly a little bit more robust:

  \begin{polycvsidebar}%
% [...] 
  \renewcommand{\cvskill}[2]{%
    \parbox{0.6\linewidth}{#1}\hfill%
    \parbox{0.3\linewidth}{%
      \levelbarsquares[\linewidth]{#2}%
    }%
  }
% [...]
  \end{polycvsidebar}

This would allow for different implementations of skill and language.

Alternatively, you can change the internal definition of the command that will be loaded automatically. This will simultaneously effect cvskill and cvlanguage. So keeping it close to the original definition, putting the following code into the preamble will change the progress indicator to circles:

\makeatletter
\renewcommand\polycv@sidebar@skill[3][\polycvhintcolsep]{%
  \parbox{1.0\linewidth}{%
    \hspace{#1}%
    \parbox[b]{2\linewidth/3-4#1}{#2}%
    \hspace{#1}\hfill%
    \parbox[b]{\linewidth/3}{%
      \levelbarcircles[\linewidth]{#3}%
      }%
    \vspace{0.2\baselineskip}}%
}
\makeatother

Further considerations and development

I guess the easiest to make this more customisable is to mirror what is happening in the main environment.
That probably means to define alternative templates for a skill line, which can be redefined and would be loaded automatically. Something like \cvsbskill and \cvsblanguage and a more generic version of a line. I have not yet made up my mind and ideas will be welcome.

Since these are not really breaking changes, but additions and internal redefinitions, I assume they can go into a v1.1.

@polyluxus polyluxus added this to the v1.1 milestone Aug 24, 2020
polyluxus added a commit that referenced this issue Aug 24, 2020
Added To allow for better customisation of the side bar (#7) a line template.
Removed an internal macro and replaced it with several user-level
macros. Options to control the new lengths have been added.

To do: Extend the user manual with these new commands.
polyluxus added a commit that referenced this issue Aug 24, 2020
The user-level commands for the sidebar line and the corresponding skill
and language templates have been addded to the manual.
The options for the hint width and the indentation have also been added.
The progressbar linewdith option is documented and described.
The examples have been recompiled to check for inconsistencies.

This commit should properly complete #7 (after necessary further testing).
@polyluxus
Copy link
Owner

The change is now live in the development version. This should be as easy as for the main body:
(The workaround line is carelessly left in from the previous attempt.)

% Redefine the skill setup in the sidebar
% This is a v1.0 workaround
\renewcommand{\sidebarskill}[2]{%
\sbline{#1}{\levelbarcircles[\linewidth]{#2}}}

Please test this and let me know what you think.

@evensure
Copy link
Author

evensure commented Aug 26, 2020

This workaround is working fine. It does what it's supposed to do.

In the same style I also added \newcommand{\sidebarline}[1]{\sbline{#1}{}} neglecting the rating bars for lines in which they are not necessary or wanted (e.g. certificates, hobbies or whatever floats your boat).

@polyluxus
Copy link
Owner

This is already the new implementation, no longer a workaround (which was to redefine the internal commands).

I'm not sure, beyond what I have already tested, there is anything left to do. I guess I could escalate this to a release candidate status soon then.

polyluxus added a commit that referenced this issue Sep 8, 2020
* Added line template for sidebar

Added To allow for better customisation of the side bar (#7) a line template.
Removed an internal macro and replaced it with several user-level
macros. Options to control the new lengths have been added.

* Fixes for progress and level bars

The line width for the outline of the progress bar can now be set with
the options. It was previously to 'thick', now the default is 0.2 mm.
The line thickness is now also used for the symbols in the level bars.
The total width of the progress bar now also considers this thickness.
This was previously 'accounted for' by scaling the x axis. It will now
be properly subtracted.

* Documentation for new sidebar line

The user-level commands for the sidebar line and the corresponding skill
and language templates have been added to the manual.
The options for the hint width and the indentation have also been added.
The progressbar linewidth option is documented and described.
The examples have been recompiled to check for inconsistencies.

* Update version and date, recompile and adapted examples, push #7 to RC
@polyluxus polyluxus linked a pull request Sep 9, 2020 that will close this issue
@polyluxus polyluxus linked a pull request Sep 9, 2020 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants