所以我对 Latex 还不太熟悉,主要使用 Overleaf 网站来撰写报告。现在我有一个包含有关我学校等信息的特定页面,但我希望学校徽标整齐地放在右上角。
这是我现在正在使用的代码:
\begin{center}
{\LARGE Stagewerkplan over het onderzoek naar}\\[0.1cm]
\LARGE{\textit{"Ricochetbeschadiging op beton"}}
\vspace{2cm}
\begin{figure}[h!]
\centering
\includegraphics[scale=1.4]{Politie_Logo.pdf}
\end{figure}
\end{center}
\vspace{50mm}
\begin{flushleft}
\textbf{Student:}\\ \textit{Emiel Janssen}\\
\textbf{Studentnummer:}\\ \textit{349226}
\textbf{Stagecoördinator:}\\ \textit{Joost Hansté;\\
Senior Wetenschappelijk Forensisch Onderzoeker}
\begin{wrapfigure}{r}{5.5cm}
\includegraphics[width=5.5cm]{Saxion_logo.pdf}
\end{wrapfigure}
\textbf{Organisatie}\\ \textit{Politie Oost-Nederland\\
Afdeling Forensische Opsporing\\
Hermandad 2\\
7511 JN Enschede}
\textbf{Stagebegeleider:}\\ \textit{Drs. Maria Berk}
\end{flushleft}
如您所见,我尝试使用 wrapit 函数,但没有成功。
答案1
wrapfigure
在flushleft
或 方面存在问题flushright
,更普遍的是,在列表环境中存在问题。我建议使用 纯 TeX 宏\InsBoxR
包insbox
。它需要两个强制参数:插入前未触及的行数和插入的框,以及一个可选参数:补充较短行数,以防编译器无法正确计算。
\documentclass[a4paper,12pt]{article}
\usepackage[showframe]{geometry}
\usepackage[demo]{graphicx}
\input{insbox}
\begin{document}
\begin{center}
{\LARGE Stagewerkplan over het onderzoek naar}\\[0.1cm]
\LARGE{\textit{"Ricochetbeschadiging op beton"}}
\vspace{2cm}
\begin{figure}[h!]
\centering
\includegraphics[scale=1.4]{Politie_Logo.pdf}
\end{figure}
\end{center}
\vspace{50mm}
\begin{flushleft}
\textbf{Student:}\\ \textit{Emiel Janssen}\\
\textbf{Studentnummer:}\\ \textit{349226}
\textbf{Stagecoördinator:}\\ \textit{Joost Hansté;\\
Senior Wetenschappelijk Forensisch Onderzoeker}
\InsertBoxR{0}{\includegraphics[width=5.5cm]{Saxion_logo.pdf}}
\textbf{Organisatie}\\ \textit{Politie Oost-Nederland\\
Afdeling Forensische Opsporing\\
Hermandad 2\\
7511 JN Enschede}
\textbf{Stagebegeleider:}\\ \textit{Drs. Maria Berk}
\end{flushleft}
\end{document}
答案2
在这种情况下,我建议使用彩色盒子环境。在我看来,这会更加高效,因为它非常可定制。
\documentclass[a4paper,11pt,draft]{article}
\usepackage{graphicx}
\usepackage{tcolorbox}
\begin{document}
% options for every upcomming tcolorbox environment
\tcbset{sidebyside,
size=minimal,
width=\textwidth,
colback=white,
lower separated=false, % no visible separation
halign lower=flush right, % right side
frame empty, % no borders
}
\begin{tcolorbox}[ halign upper=flush center] % upper = left side
{\LARGE Stagewerkplan over het onderzoek naar}\\[0.1cm]
\LARGE{\textit{"Ricochetbeschadiging op beton"}}
\tcblower %left right separation
\includegraphics[scale=1.4]{Politie_Logo.pdf}
\end{tcolorbox}
\vspace{50mm}
\begin{tcolorbox}
\textbf{Student:}\\ \textit{Emiel Janssen}\\
\textbf{Studentnummer:}\\ \textit{349226}
\textbf{Stagecoördinator:}\\ \textit{Joost Hansté;\\
Senior Wetenschappelijk Forensisch Onderzoeker}
\textbf{Organisatie}\\ \textit{Politie Oost-Nederland\\
Afdeling Forensische Opsporing\\
Hermandad 2\\
7511 JN Enschede}
\textbf{Stagebegeleider:}\\ \textit{Drs. Maria Berk}
\tcblower % left right separation
\includegraphics[width=5.5cm]{Saxion_logo.pdf}
\end{tcolorbox}
\end{document}
答案3
没有令人信服的理由将图像包含在figure
(或类似的)环境中。
\documentclass{article}
\usepackage[margin=2cm]{geometry}
\usepackage{graphicx}
\usepackage{showframe}
\begin{document}
\begin{center}
\begin{minipage}{\textwidth}
\LARGE\centering
Stagewerkplan over het onderzoek naar\\
\textit{"Ricochetbeschadiging op beton"}
\end{minipage}% <-- don't forget
\makebox[0pt][r]{\raisebox{-0.5\height}{\includegraphics[width=2cm,height=2cm]{example-image}}}
\end{center}
\vspace{50mm}
\begin{flushleft}
\makebox[\textwidth][r]{\raisebox{-\height}[0pt][0pt]{\includegraphics[width=5.5cm,height=6cm]{example-image}}}
\textbf{Student:}\\ \textit{Emiel Janssen}\\
\textbf{Studentnummer:}\\ \textit{349226}
\textbf{Stagecoördinator:}\\ \textit{Joost Hansté;\\
Senior Wetenschappelijk Forensisch Onderzoeker}
\textbf{Organisatie}\\ \textit{Politie Oost-Nederland\\
Afdeling Forensische Opsporing\\
Hermandad 2\\
7511 JN Enschede}
\textbf{Stagebegeleider:}\\ \textit{Drs. Maria Berk}
\end{flushleft}
\end{document}
我使用了height
和width
来获取可能与您拥有的图片相似的图片。showframe
仅加载了该包以显示文本块边界。
答案4
该解决方案使用标准 LaTeX/TeX 命令。
无论使用 wrapfig 还是其他任何包,它的工作原理都是,您将图像覆盖在页面上,然后防止文本与该图像重叠。 \rlap
水平重叠,也\raisebox
可用于垂直重叠。 \strut
在这里使用主要是因为它比更容易输入\leavevmode
。
在这种情况下,文本不会在未经修改的情况下与图像重叠。但是,通过设置和重置,\rightskip
您可以保护页面的正确尺寸不受较长行的影响(至少在 flushleft 内)。限制是您只能在段落之间执行此操作。
\documentclass[a4paper,12pt]{article}
\usepackage[showframe]{geometry}
\usepackage[demo]{graphicx}
\begin{document}
\begin{center}
{\LARGE Stagewerkplan over het onderzoek naar}\\[0.1cm]
\LARGE{\textit{``Ricochetbeschadiging op beton''}}
\vspace{2cm}
\includegraphics[scale=1.4]{Politie_Logo.pdf}
\end{center}
\vspace{50mm}
\begin{flushleft}
\textbf{Student:}\\ \textit{Emiel Janssen}\\
\textbf{Studentnummer:}\\ \textit{349226}
\textbf{Stagecoördinator:}\\ \textit{Joost Hansté;\\
Senior Wetenschappelijk Forensisch Onderzoeker}
\rightskip=\dimexpr 5.5cm+\columnsep\relax% not needed in this case
\strut\rlap{\makebox[\textwidth][r]{\raisebox{\dimexpr \ht\strutbox-\height}[0pt][0pt]
{\includegraphics[width=5.5cm]{Saxion_logo.pdf}}}}%
\textbf{Organisatie}\\ \textit{Politie Oost-Nederland\\
Afdeling Forensische Opsporing\\
Hermandad 2\\
7511 JN Enschede}
\rightskip=0pt
\textbf{Stagebegeleider:}\\ \textit{Drs. Maria Berk}
\end{flushleft}
\end{document}
我突然想到您可能正在尝试将文本和图像底部对齐。
\documentclass[a4paper,12pt]{article}
\usepackage[showframe]{geometry}
\usepackage[demo]{graphicx}
\setlength{\parindent}{0pt}%
\begin{document}
\begin{center}
{\LARGE Stagewerkplan over het onderzoek naar}\\[0.1cm]
\LARGE{\textit{``Ricochetbeschadiging op beton''}}
\vspace{2cm}
\includegraphics[scale=1.4]{Politie_Logo.pdf}
\end{center}
\vfill
\hangindent=\bibindent
\textbf{Student:}\\ \textit{Emiel Janssen}
\hangindent=\bibindent
\textbf{Studentnummer:}\\ \textit{349226}
\hangindent=\bibindent
\textbf{Stagecoördinator:}\\ \textit{Joost Hansté;\\
Senior Wetenschappelijk Forensisch Onderzoeker}
\setlength{\rightskip}{\dimexpr 5.5cm+\columnsep}% not needed in this case
\hangindent=\bibindent
\textbf{Organisatie}\\ \textit{Politie Oost-Nederland\\
Afdeling Forensische Opsporing\\
Hermandad 2\\
7511 JN Enschede}
\hangindent=\bibindent
\textbf{Stagebegeleider:}\\
\strut\rlap{\makebox[\dimexpr \textwidth-\bibindent][r]{\smash{\includegraphics[width=5.5cm]{Saxion_logo.pdf}}}}%
\textit{Drs. Maria Berk}
\setlength{\rightskip}{0pt}%
\end{document}