在页边距外复制此简历的标题:\colorbox 和相同长度的单词

在页边距外复制此简历的标题:\colorbox 和相同长度的单词

我想复制“Katie Smalls”的标题简历

在此处输入图片描述

这是我的代码:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[]{xcolor}
\usepackage[top=0cm]{geometry}

\begin{document}
\centering
\colorbox{pink}{
\begin{minipage}[t]{0.3\textwidth}
    \centering
    \vspace{3cm}
    \textcolor{white}{\Huge \textbf{KATIE}}\\
    \textcolor{white}{\Huge \textbf{SMALLS}}
\end{minipage}}
\end{document}

在此处输入图片描述

这次尝试主要存在三个问题:

  • 我需要在文档的其余部分留出上边距,因此top=0cm必须进行更改
  • 文档顶部仍有空白
  • 名字和姓氏不一致

答案1

基于 TikZ 的方法可以包装成宏,如下所示:

https://tex.stackexchange.com/a/311031

给定的宏允许指定框的锚点,并使用页面尺寸的分数进行精确定位。无需设置边距或进行其他计算。

在此处输入图片描述

你的例子:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[]{xcolor}

\usepackage{tikz}
\usetikzlibrary{calc}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% absolute positioning of typeset material    
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\placetextbox}[4][center]{%
  % [#1]: box anchor: center (default) | 
  %                 south west | west | north west | north |
  %                 north east | east | south east | south | 
  %                 mid west | mid | mid east |
  %                 base west | base | base east 
  % #2: horizontal position (fraction of page width)
  % #3: vertical position (fraction of page height)
  % #4: content
  %
  \tikz[remember picture,overlay,x=\paperwidth,y=\paperheight]{%
    \node[anchor=#1,inner sep=0pt]
      at ($(current page.south west)+(#2,#3)$) {#4};
  }%
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{document}
\placetextbox[north]{0.5}{1.0}{%
  \colorbox{pink}{%
    \begin{minipage}[t][0.3\textwidth][b]{0.3\textwidth}
      \sffamily
      \resizebox{\linewidth}{!}{\textcolor{white}{\Huge \textbf{KATIE}}}\\[0.5ex]
      \resizebox{\linewidth}{!}{\textcolor{white}{\Huge \textbf{SMALLS}}}
    \end{minipage}}%
}
\end{document}

答案2

这是一个简单的解决方案,使用\raisebox和的resizebox可选参数。诀窍是声明 的高度为 0:height\parbox\raisebox\parbox

\documentclass{article}
\usepackage[utf8]{inputenc} 
\usepackage[T1]{fontenc}
\usepackage{gillius2} 
\usepackage[x11names]{xcolor}
\usepackage{graphicx}

\usepackage[showframe, top = 3cm]{geometry}

\begin{document}

\begin{center}
    \raisebox{\dimexpr 3cm + 7pt\relax}[0pt]{\colorbox{HotPink2!90!OrangeRed1}
    {\parbox[t][4.5cm][c]{0.3\textwidth}
        {\centering\color{white}\bfseries\sffamily\Huge\vskip1.2cm
    \resizebox{0.25\textwidth}{!}{KATIE}\\[-0.5ex]
    \resizebox{0.25\textwidth}{!}{SMALLS}}}
    }
\end{center}

\end{document} 

在此处输入图片描述

答案3

解决了前两个问题:

\documentclass{article}
\usepackage[absolute,overlay]{textpos}
\setlength{\TPHorizModule}{1mm}
\setlength{\TPVertModule}{1mm}
\usepackage[T1]{fontenc}
\usepackage[]{xcolor}

\begin{document}

\begin{textblock}{130}(30,0)
  \colorbox{pink}{
    \begin{minipage}[t]{0.3\textwidth}
        \centering
        \vspace{3cm}
        \textcolor{white}{\Huge \textbf{KATIE}}\\
        \textcolor{white}{\Huge \textbf{SMALLS}}
    \end{minipage}}
\end{textblock}

\end{document}

谢谢埃博感谢大家的帮助!

相关内容