나는중앙에 컬러가 있는 파박스, 그러나 패키지를 사용하여 경계선을 정의했지만기하학,parbox는 오른쪽보다 왼쪽에 더 큰 여백이 있습니다.
도와 주셔서 감사합니다
\documentclass[a4paper,10pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{color}
\usepackage[a4paper,top=1cm,left=2cm,right=2cm]{geometry}
\usepackage{graphicx}
\begin{document}
\definecolor{Blau1}{RGB}{0,97,175}
\definecolor{Blau2}{RGB}{86,189,218}
\definecolor{Blau3}{RGB}{212,239,252} % Define a custom color for the heading box
\colorbox{Blau3}{ % Creates a highlight behind the text using the previously-defined navy color
\parbox[t]{\linewidth}{ % Creates a box to take up the entire line width
\centering
\vspace*{14pt} % Whitespace above the text
\color{Blau1} \center{\textbf{\Large REPORT}} % Right-aligned heading text
\vspace*{14pt} % Whitespace below the text
}}
\end{document}
답변1
색상 상자 앞의 들여쓰기와 상자의 자연스러운 패딩(다른 방식으로 호출될 수도 있음, 확실하지 않음)을 제거해야 합니다. 후자의 경우 calc
패키지를 사용하고 parbox의 길이를 로 설정하여 자연 패딩을 뺍니다 \textwidth-2\fboxsep
.textwidth
\documentclass[a4paper,10pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{color}
\usepackage[a4paper,top=1cm,left=2cm,right=2cm]{geometry}
\usepackage{graphicx}
\usepackage{showframe}
\usepackage{calc}
\begin{document}
\definecolor{Blau1}{RGB}{0,97,175}
\definecolor{Blau2}{RGB}{86,189,218}
\definecolor{Blau3}{RGB}{212,239,252}
\noindent\colorbox{Blau3}{% new code here
\parbox[t]{\textwidth-2\fboxsep}{% new code here
\centering
\vspace*{14pt}
\color{Blau1} \center{\textbf{\Large REPORT}}
\vspace*{14pt}
}}
\end{document}