您好,我在 TexStudios 中使用 MikTex。我有这个文档:
\documentclass[paper=letter,fontsize=11pt]{scrartcl} % KOMA-article class
\usepackage[english]{babel}
\usepackage[utf8x]{inputenc}
\usepackage[protrusion=true,expansion=true]{microtype}
\usepackage{amsmath,amsfonts,amsthm} % Math packages
\usepackage{graphicx} % Enable pdflatex
\usepackage[svgnames]{xcolor} % Colors by their 'svgnames'
\usepackage{geometry}
\usepackage[colorlinks=true,linkcolor=blue,urlcolor=blue]{hyperref}
\usepackage{float}
\usepackage{etaremune}
\usepackage{wrapfig}
\usepackage{layout}
\usepackage{multicol}
\usepackage{sectsty} % Custom sectioning}{sectsty package)
\usepackage[export]{adjustbox}
\frenchspacing % Better looking spacings after periods
\pagestyle{empty} % No pagenumbers/headers/footers
%\addtolength{\voffset}{-40pt}
%\addtolength{\textheight}{20pt}
\setlength\topmargin{0pt}
\addtolength\topmargin{-\headheight}
\addtolength\topmargin{-\headsep}
\setlength\oddsidemargin{0pt}
\setlength\textwidth{\paperwidth}
\addtolength\textwidth{-2in}
\setlength\textheight{\paperheight}
\addtolength\textheight{-2in}
\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{\NewPart}[2]{\section*{\uppercase{#1} #2}}
%%% Begin Document
%%% ------------------------------------------------------------
\begin{document}
\begin{wrapfigure}{r}{0.2\linewidth}
\centering
\includegraphics[height=2cm, keepaspectratio=true]{batman.jpg}
\end{wrapfigure}
{\noindent\Huge\usefont{OT1}{phv}{b}{n}{Bruce Wayne}}\\
Address line 1\\
Address line 2\\
\href{mailto:[email protected]}{[email protected]}\\
%\sepspace
\NewPart{Overview}{}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent volutpat sapien neque, id elementum turpis tincidunt sed. Suspendisse potenti. Quisque malesuada odio sit amet blandit commodo. Sed sed dolor massa. Aliquam erat volutpat. Proin suscipit enim risus, id vehicula risus facilisis ac. Nullam et libero vitae mi viverra tincidunt vitae ac purus. Pellentesque ac justo et augue tincidunt maximus. Morbi velit metus, consectetur ac orci sit amet, gravida suscipit lacus. Interdum et malesuada fames ac ante ipsum primis in faucibus. Curabitur est leo, rutrum eget laoreet at, imperdiet id velit. Phasellus dignissim mi sed lacus porttitor tempor et tempus justo. Aliquam at congue augue. Quisque sed velit ac neque tristique sagittis.
Relocation is NOT a problem.
\NewPart{Skills}{}
\begin{multicols}{3}
\begin{itemize}
\item 1
\item 2
\item 3
\item 4
\item 5
\item 6
\item 7
\item 8
\item 9
\item 10
\item 11
\item 12
\item 13
\item 14
\end{itemize}
\end{multicols}
\end{document}
我希望图片位于纸张的右上方,但位于文本边距内。问题是环绕图会将所有规则和其后面的文本偏移很多!
答案1
不要wrapfigure
在这里使用,因为它适用于连续文本,即段落,而不是像这样的虚线。您可以使用 来适应图像adjustbox
,无论如何您都会加载它。只需\hfill
在名称后添加 以将图像推到右侧,然后使用垂直和/或水平键对齐图像adjustbox
并删除其官方高度和深度,这样图像大小就不再考虑行高等。
只需将第一行替换为:
\begin{document}
{\noindent\Huge\usefont{OT1}{phv}{b}{n}{Bruce Wayne}%
\hfill\adjustimage{height=2cm,valign=t,set height={0pt},set depth={0pt}}{example-image}%
}\\
我\adjustimage
在这里使用 而不是\includegraphics
,但它使用相同的内部结构,但可以更好地adjustbox
集成。valign=t
根据名称的大小进行垂直对齐(此处为“Bruce Wayne”),键set ..
用于减小其官方大小。如果您需要在周围留出一些白色边距,请使用margin
或center=<some width, not to wide>
或left=...
或right=...
。adjustbox
有关这些键的详细说明,请参阅手册。
答案2
wrapfig
不是合适的工具。
\documentclass[paper=letter,fontsize=11pt]{scrartcl} % KOMA-article class
\usepackage[english]{babel}
\usepackage[utf8x]{inputenc}
\usepackage[protrusion=true,expansion=true]{microtype}
\usepackage{amsmath,amsfonts,amsthm} % Math packages
\usepackage{graphicx} % Enable pdflatex
\usepackage[svgnames]{xcolor} % Colors by their 'svgnames'
\usepackage{geometry}
\usepackage[colorlinks=true,linkcolor=blue,urlcolor=blue]{hyperref}
\usepackage{float}
\usepackage{etaremune}
\usepackage{layout}
\usepackage{multicol}
\usepackage{sectsty} % Custom sectioning}{sectsty package)
\usepackage[export]{adjustbox}
\frenchspacing % Better looking spacings after periods
\pagestyle{empty} % No pagenumbers/headers/footers
%\addtolength{\voffset}{-40pt}
%\addtolength{\textheight}{20pt}
\setlength\topmargin{0pt}
\addtolength\topmargin{-\headheight}
\addtolength\topmargin{-\headsep}
\setlength\oddsidemargin{0pt}
\setlength\textwidth{\paperwidth}
\addtolength\textwidth{-2in}
\setlength\textheight{\paperheight}
\addtolength\textheight{-2in}
\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{\NewPart}[2]{\section*{\uppercase{#1} #2}}
%%% Begin Document
%%% ------------------------------------------------------------
\begin{document}
\noindent
\begin{minipage}{\textwidth}
\raggedright
{\Huge\usefont{OT1}{phv}{b}{n}{Bruce Wayne}\\}
Address line 1\\
Address line 2\\
\href{mailto:[email protected]}{[email protected]}
\end{minipage}%
\makebox[0pt][r]{\raisebox{-0.5\height}{\includegraphics[height=2cm]{example-image}}}
%\sepspace
\NewPart{Overview}{}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent volutpat sapien neque, id elementum turpis tincidunt sed. Suspendisse potenti. Quisque malesuada odio sit amet blandit commodo. Sed sed dolor massa. Aliquam erat volutpat. Proin suscipit enim risus, id vehicula risus facilisis ac. Nullam et libero vitae mi viverra tincidunt vitae ac purus. Pellentesque ac justo et augue tincidunt maximus. Morbi velit metus, consectetur ac orci sit amet, gravida suscipit lacus. Interdum et malesuada fames ac ante ipsum primis in faucibus. Curabitur est leo, rutrum eget laoreet at, imperdiet id velit. Phasellus dignissim mi sed lacus porttitor tempor et tempus justo. Aliquam at congue augue. Quisque sed velit ac neque tristique sagittis.
Relocation is NOT a problem.
\NewPart{Skills}{}
\begin{multicols}{3}
\begin{itemize}
\item 1
\item 2
\item 3
\item 4
\item 5
\item 6
\item 7
\item 8
\item 9
\item 10
\item 11
\item 12
\item 13
\item 14
\end{itemize}
\end{multicols}
\end{document}
一些说明:
utf8x
已经好几年没有维护了;使用utf8
- 手动加载
geometry
然后进行所有页面设置似乎效率不高 sectsty
相处得scrartcl
不好
编辑版本:
\documentclass[letterpaper,11pt]{article} % KOMA-article class
\usepackage[english]{babel}
\usepackage[protrusion=true,expansion=true]{microtype}
\usepackage{amsmath,amsfonts,amsthm} % Math packages
\usepackage{graphicx} % Enable pdflatex
\usepackage[svgnames]{xcolor} % Colors by their 'svgnames'
\usepackage{geometry}
\usepackage{float}
\usepackage{etaremune}
\usepackage{layout}
\usepackage{multicol}
\usepackage{sectsty} % Custom sectioning}{sectsty package)
\usepackage[export]{adjustbox}
\usepackage[colorlinks=true,linkcolor=blue,urlcolor=blue]{hyperref}
\frenchspacing % Better looking spacings after periods
\pagestyle{empty} % No pagenumbers/headers/footers
\geometry{margin=1in,headheight=0pt,headsep=0pt}
\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{\NewPart}[2]{\section*{\uppercase{#1} #2}}
%%% Begin Document
%%% ------------------------------------------------------------
\begin{document}
\noindent
\begin{minipage}{\textwidth}
\raggedright
{\Huge\usefont{OT1}{phv}{b}{n}{Bruce Wayne}\\}
Address line 1\\
Address line 2\\
\href{mailto:[email protected]}{[email protected]}
\end{minipage}%
\makebox[0pt][r]{\includegraphics[height=2cm,valign=c]{example-image}}
%\sepspace
\NewPart{Overview}{}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent volutpat sapien neque, id elementum turpis tincidunt sed. Suspendisse potenti. Quisque malesuada odio sit amet blandit commodo. Sed sed dolor massa. Aliquam erat volutpat. Proin suscipit enim risus, id vehicula risus facilisis ac. Nullam et libero vitae mi viverra tincidunt vitae ac purus. Pellentesque ac justo et augue tincidunt maximus. Morbi velit metus, consectetur ac orci sit amet, gravida suscipit lacus. Interdum et malesuada fames ac ante ipsum primis in faucibus. Curabitur est leo, rutrum eget laoreet at, imperdiet id velit. Phasellus dignissim mi sed lacus porttitor tempor et tempus justo. Aliquam at congue augue. Quisque sed velit ac neque tristique sagittis.
Relocation is NOT a problem.
\NewPart{Skills}{}
\begin{multicols}{3}
\begin{itemize}
\item 1
\item 2
\item 3
\item 4
\item 5
\item 6
\item 7
\item 8
\item 9
\item 10
\item 11
\item 12
\item 13
\item 14
\end{itemize}
\end{multicols}
\end{document}