컬러박스 왼쪽 정렬하기

컬러박스 왼쪽 정렬하기

나는 여기에 쓰여진 것과 동일한 이력서 템플릿을 사용하고 있습니다.라텍스 - 색상 상자의 너비. 검은색 상자에 있는 단어를 왼쪽으로 정렬하려고 합니다. 기본적으로 오른쪽으로 정렬되어 있는 것 같습니다. 이 작업을 어떻게 수행할 수 있습니까?

%%% ------------------------------------------------------------
\documentclass[paper=a4,fontsize=11pt]{scrartcl}                % KOMA-article class
\usepackage{amsmath,amsfonts,amsthm}                    % Math packages
\usepackage[pdftex]{graphicx}                               % Enable pdflatex
\usepackage[svgnames]{xcolor}                           % Colors by their 'svgnames'
\usepackage{geometry}
\textheight=700px                                   % Saving trees ;-) 
\usepackage{url}                                        % Clickable URL's
\usepackage{wrapfig}                                    % Wrap text along figures

\frenchspacing                                  % Better looking spacings after periods
\pagestyle{empty}                               % No pagenumbers/headers/footers
\usepackage{sectsty}                            % Custom sectioning (see below)

\sectionfont{%                                  % Change font of \section command
\usefont{OT1}{phv}{b}{n}%                   % bch-b-n: CharterBT-Bold font
\sectionrule{0pt}{0pt}{-5pt}{3pt}
}

%%% Macros
%%% ------------------------------------------------------------
\newlength{\spacebox}
\settowidth{\spacebox}{8888888888}              % Box to align text
\newcommand{\sepspace}{\vspace*{1em}}           % Vertical space macro

\newcommand{\MyName}[1]{
\Huge \usefont{OT1}{phv}{b}{n} \hfill #1        % Name
\par \normalsize \normalfont}

\newcommand{\MySlogan}[1]{
\large \usefont{OT1}{phv}{m}{n}\hfill \textit{#1} % Slogan (optional)
\par \normalsize \normalfont}

\newcommand{\NewPart}[1]{\section*{\uppercase{#1}}}

\newcommand{\PersonalEntry}[2]{
\noindent\hangindent=2em\hangafter=0        % Indentation
\parbox{\spacebox}{                     % Box to align text
\textit{#1}}                                % Entry name (birth, address, etc.)
\hspace{1.5em} #2 \par}                 % Entry value

\newcommand{\SkillsEntry}[2]{                       % Same as \PersonalEntry
\noindent\hangindent=2em\hangafter=0        % Indentation
\parbox{\spacebox}{                     % Box to align text
\textit{#1}}                                % Entry name (birth, address, etc.)
\hspace{1.5em} #2 \par}                 % Entry value   

\newcommand{\EducationEntry}[4]{
\noindent \textbf{#1} \hfill                    % Study
\colorbox{Black}{%
\parbox{6em}{%
\hfill\color{White}#2}} \par                % Duration
\noindent \textit{#3} \par                  % School
\noindent\hangindent=2em\hangafter=0 \small #4  % Description
\normalsize \par}

\newcommand{\WorkEntry}[4]{                     % Same as \EducationEntry
\noindent \textbf{#1} \hfill                    % Jobname
\colorbox{Black}{\color{White}#2} \par      % Duration
\noindent \textit{#3} \par                  % Company
\noindent\hangindent=2em\hangafter=0 \small #4  % Description
\normalsize \par}



%%% ------------------------------------------------------------
%%% BEGIN DOCUMENT
%%% ------------------------------------------------------------
\begin{document}
\begin{wrapfigure}{l}{0.5\textwidth}
\vspace*{-2em}
\includegraphics[width=0.15\textwidth]{photo}
\end{wrapfigure}

\MyName{Your Name}
\MySlogan{Curriculum Vitae}

\sepspace

%%% Personal details
%%% ------------------------------------------------------------
\NewPart{Personal details}{}

\PersonalEntry{Birth}{January 1, 1980} 
\PersonalEntry{Address}{111 First St, New York}
\PersonalEntry{Phone}{(123) 000-0000}
\PersonalEntry{Mail}{\url{[email protected]}}

%%% Education
%%% ------------------------------------------------------------
\NewPart{Education}{} 

\EducationEntry{MSc. Name of Education}{2010-2012}{Name of
University}{Descriptive text goes here. In order to maintain a stylish look, try to fill this description with a few lines of text. Do the same for the other entries in the education section.}
\sepspace

\EducationEntry{BSc. Name of Education}{2007-2010}{Name of University}{Descriptive text goes here. In order to maintain a stylish look, try to fill this description with a few lines of text. Do the same for the other entries in the education section.}

%%% Work experience
%%% ------------------------------------------------------------
\NewPart{Work experience}{}

\EducationEntry{Job name}{2011-present}{Company Name inc., Full-time}{Job description goes here. To maintain a stylish look, try to fill this description with a few lines of text. Do the same for the other entries in this section.}
\sepspace

\EducationEntry{Job name}{2010-2011}{Company Name inc., Part-time}{Job description goes here. To maintain a stylish look, try to fill this description with a few lines of text. Do the same for the other entries in this section.}

%%% Skills
%%% ------------------------------------------------------------
\NewPart{Skills}{}

\SkillsEntry{Languages}{Dutch (mother tongue)}
\SkillsEntry{}{English (fluent)}
\SkillsEntry{}{German (fluent)} 

\SkillsEntry{Software}{\textsc{Matlab}, \LaTeX, \textsc{Ansys}, \textsc{Comsol}}


%%% References
%%% ------------------------------------------------------------
\NewPart{References}{}
Available upon request
\end{document}

나는 그것의 핵심이 \colorbox에 있다고 생각하지만 \left를 추가하려고 시도했지만 작동하지 않습니다. 정렬을 변경하는 예도 보이지 않습니다. 어떤 도움이라도 기다리겠습니다!

\newcommand{\EducationEntry}[4]{
    \noindent \textbf{#1} \hfill                    % Study
    \colorbox{Black}{%
    \parbox{6em}{%
    \hfill\color{White}#2}} \par                % Duration
    \noindent \textit{#3} \par                  % School
    \noindent\hangindent=2em\hangafter=0 \small #4  % Description
    \normalsize \par}

편집: 아래는 David Carlisle의 제안을 통합한 MWE입니다. 검은색 상자에 있는 흰색 텍스트를 왼쪽 정렬하려고 합니다. \raggedleft를 사용하든 \raggedright를 사용하든, 컴파일할 때 Software라는 단어가 상자의 오른쪽 정렬된 면에 나타납니다.

%%% ------------------------------------------------------------
\documentclass[paper=a4,fontsize=11pt]{scrartcl}                % KOMA-article class
\usepackage{amsmath,amsfonts,amsthm}                    % Math packages
\usepackage[pdftex]{graphicx}                               % Enable pdflatex
\usepackage[svgnames]{xcolor}                           % Colors by their 'svgnames'
\usepackage{geometry}
\textheight=700px                                   % Saving trees ;-) 
\usepackage{url}                                        % Clickable URL's
\usepackage{wrapfig}                                    % Wrap text along figures

\frenchspacing                                  % Better looking spacings after periods
\pagestyle{empty}                               % No pagenumbers/headers/footers
\usepackage{sectsty}                            % Custom sectioning (see below)

\begin{document}

PUBLICATIONS

\noindent \colorbox{Black}{%
            \parbox{6em}{\raggedleft
            \hfill\color{White} Software}} 

\end{document}

편집 2:

이 편리한 선이 표시된 방향으로 텍스트를 정렬한다는 것을 알았습니다! 그러나 어떤 이유로 텍스트 상자의 너비가 일정하지 않은 것 같습니다. 다음은 이를 보여주는 MWE입니다.

%%% ------------------------------------------------------------
\documentclass[paper=a4,fontsize=11pt]{scrartcl}                % KOMA-article class
\usepackage{amsmath,amsfonts,amsthm}                    % Math packages
\usepackage[pdftex]{graphicx}                               % Enable pdflatex
\usepackage[svgnames]{xcolor}                           % Colors by their 'svgnames'
\usepackage{geometry}
\textheight=700px                                   % Saving trees ;-) 
\usepackage{url}                                        % Clickable URL's
\usepackage{wrapfig}                                    % Wrap text along figures

\frenchspacing                                  % Better looking spacings after periods
\pagestyle{empty}                               % No pagenumbers/headers/footers
\usepackage{sectsty}                            % Custom sectioning (see below)

\begin{document}

PUBLICATIONS

\noindent \colorbox{black}{\makebox[10em][l]{\textcolor{white}{\normalsize Software}}}
\vspace{1mm}

\noindent \small{\textbf{First software here}

\noindent \colorbox{black}{\makebox[10em][l]{\textcolor{white}{\normalsize Articles}}}
\vspace{1mm}

\noindent \small{\textbf{First article here}

\noindent \small{\textbf{Second article here}

\noindent \small{Third article here}

\noindent \colorbox{black}{\makebox[10em][l]{\textcolor{white}{\normalsize Book chapters}}}
\vspace{1mm}

\noindent \small{First book chapter here}

\end{document}

답변1

\parbox용도 에 맞게 텍스트를 오른쪽 정렬하려면

  \parbox{6em}{\raggedleft

(컬러박스는 전혀 관련이 없습니다)

관련 정보