我有一个图形,我想在它周围环绕文字,同时在左下角有一个标题,这可能吗?
第一个示例图像的代码如下所示:
\begin{document}
\usepackage{graphicx,caption}
\usepackage{subcaption}
\usepackage{wrapfig} %im not sure which of these are necessary
\newpage
\textit{RANDOM HEADER}
\begin{wrapfigure}[14]{r}{0.5\linewidth}
\begin{minipage}{2cm}
\centering
\caption{This is a caption, with exactly this specific number of lines in it. The caption has to be in the lower left corner of the figure}
\label{fig:stoejfralandevej}
\end{minipage}
%
\begin{minipage}{1\linewidth}
\includegraphics[width=1\linewidth]{Lister/Figurer/000000.jpg}
\end{minipage}
\end{wrapfigure}
RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT
RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT
RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT
RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT
RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM
\vspace{5cm}
\subsection{RANDOM HEADER}
RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT
RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM
TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT
RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM
TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT
RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM
TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT
RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM
TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT
RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT
RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM
TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT
RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM
TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT
\end{document}
有人能帮我使它看起来像示例图 2 吗?
谢谢 :)
答案1
如果您知道或测量了图像的高度,则可以将标题minipage
与文本放在一起。
\documentclass{article}
\usepackage{graphicx,caption}
\begin{document}
\noindent\begin{minipage}[t][10cm][s]{\dimexpr 0.5\textwidth-\columnsep}
\textit{RANDOM HEADER}
RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT
RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT
RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT
RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT
RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM
\vfill
\abovecaptionskip=0pt
\captionof{figure}{This is a caption, with exactly this specific number of lines in it. The caption has to be in the lower left corner of the figure}
\label{fig:stoejfralandevej}
\end{minipage}\hfill
\raisebox{\dimexpr \ht\strutbox - \height}{%
\includegraphics[width=0.5\textwidth, height=10cm]{example-image}}
\vspace{5cm}
\subsection{RANDOM HEADER}
RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT
RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM
TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT
RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM
TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT
RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM
TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT
RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM
TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT
RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT
RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM
TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT
RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM
TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT
\end{document}
这会将超链接锚点置于图的顶部。
\documentclass{article}
\usepackage{graphicx,caption}
\usepackage{hyperref}
\usepackage{hypcap}
\makeatletter
\newcommand{\setcaptype}[1]% #1 = figure or table
{\def\@captype{#1}}
\makeatother
\begin{document}
\noindent\begin{minipage}[t][10cm][s]{\dimexpr 0.5\textwidth-\columnsep}
\setcaptype{figure}%
\hspace{\textwidth}\capstart\vspace{-\baselineskip}
\textit{RANDOM HEADER}
RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT
RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT
RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT
RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT
RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM
\vfill
\abovecaptionskip=0pt
\caption{This is a caption, with exactly this specific number of lines in it. The caption has to be in the lower left corner of the figure}
\label{fig:stoejfralandevej}
\end{minipage}\hfill
\raisebox{\dimexpr \ht\strutbox - \height}{%
\includegraphics[width=0.5\textwidth, height=10cm]{example-image}}
\ref{fig:stoejfralandevej}
\vspace{5cm}
\subsection{RANDOM HEADER}
RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT
RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM
TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT
RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM
TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT
RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM
TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT
RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM
TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT
RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT
RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM
TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT
RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM
TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT RANDOM TEXT
\end{document}