posquit0 / Awesome-CV

:page_facing_up: Awesome CV is LaTeX template for your outstanding job application
LaTeX Project Public License v1.3c
22.28k stars 4.71k forks source link

Colored highlighter removes spaces if spaces are in the first 3 tokens #414

Open schrauger opened 2 years ago

schrauger commented 2 years ago

With the default highlighter mode, which highlights the first 3 tokens/characters, the highlighting function causes spaces to be removed if any of the first three characters is a space.

Input: {A Section Here}

Expected Output: "A Section Here" or "A Section Here"

Actual Output: "ASection Here"

Most headers are more than 3 characters, and the non-highlighted portions keep the spaces, so this problem doesn't appear to affect the average resume created.

If you change the highlight function to increase the number of characters highlighted, this become a more noticeable problem. However, even with 3 characters, I ran into this issue when I wanted to start a section with a single character or two character word, followed by a space, and another word. The coloring functionality removes the space.

github-actions[bot] commented 2 years ago

:wave: Welcome! Looks like this is your first issue.

Hey, thanks for your contribution! Please give us a bit of time to review it. 😄

schrauger commented 2 years ago

I found a workaround for now. If you use a backslash before the space, it prints correctly.

Input: {A\ Section Here}

Output: "A Section Here"

dcsim commented 2 years ago

This is most likely a result of the spaces not being tokenized and thus "accidentally' removed when passed here:

% Awesome section color
\def\@sectioncolor#1#2#3{%
  \ifbool{acvSectionColorHighlight}{{\color{awesome}#1#2#3}}{#1#2#3}%
}

Using a ~ instead of a space solves it, e.g. A~Section, as does using a \ as suggested by @schrauger.

This might be addressed more easily with documentation than trying to push a fix and could probably be included with some friendly documentation about other common headaches, e.g. using \& rather than &.