我怎样才能得到我在图中描述的结果?
\documentclass[%
draft=false,
paper=a4
paper=portrait,
pagesize=auto,
fontsize=11pt
version=last,
english,
]{scrbook}
\usepackage{graphicx}
\usepackage{wrapfig}
\begin{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Description and examples of I do not want}
\includegraphics[width=4ex]{symbols/symbol_q.PNG} The text should be automatically always in he middle of the symbol. Here it is wrong. And the second line is at the beginning not in vertical line with the first line.\\ \\
\includegraphics[width=4ex]{symbols/symbol_l.PNG} The text should be automatically always in he middle of the symbol. Here it is wrong. And the second line is at the beginning not in vertical line with the first line.\\ \\
\includegraphics[width=4ex]{symbols/symbol_q.PNG} Not perfect in he middle of the symbol. It is at the bottem.\\ \\
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{This is almost perfect}
\begin{wrapfigure}[3]{l}[0pt]{0.05\textwidth}
\includegraphics[width=4ex]{symbols/symbol_q.PNG}
\vspace{-2\baselineskip}
\end{wrapfigure}
The text should be automatically always in he middle of the symbol. Here it is almost \textbf{perfect}. And the second line is at the beginning \textbf{perfect} in vertical line with the first line!
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{The first is almost perfect. How I can handle the others? I did not know!}
\begin{wrapfigure}{l}{0.05\textwidth}
\includegraphics[width=4ex]{symbols/symbol_q.PNG}
\vspace{-2\baselineskip}
\end{wrapfigure}
The text should be automatically always in he middle of the symbol. Here it is almost \textbf{perfect}. And the second line is at the beginning \textbf{perfect} in vertical line with the first line!
\\
\begin{wrapfigure}{l}{0.05\textwidth}
\includegraphics[width=4ex]{symbols/symbol_l.PNG}
\vspace{-2\baselineskip}
\end{wrapfigure}
The text should be automatically always in he middle of the symbol. And the second line should be at the beginning in vertical line with the first line.
\\
\begin{wrapfigure}{L}{0.05\textwidth}
\includegraphics[width=4ex]{symbols/symbol_q.PNG}
\vspace{-2\baselineskip}
\end{wrapfigure}
The text should be automatically always in he middle of the symbol. And the second line should be at the beginning in vertical line with the first line.
\vspace{5\baselineskip}
\end{document}
您需要至少 10 点声誉才能发布超过 2 个链接。
因此,抱歉,只有一个符号 - 图片可能!
答案1
以下内容不会跨越页面边界,但会根据提供的文本将图像垂直居中设置:
\documentclass{article}
\usepackage{graphicx, tabularx}
\usepackage[nopar]{lipsum}
\newenvironment{centerentry}[2][]
{\renewcommand{\tabularxcolumn}[1]{m{##1}}
\noindent
\tabularx{\linewidth}{ @{} m{\imagecolwidth} X @{} }
\includegraphics[width=\linewidth,#1]{#2} &
}{%
\endtabularx%
}
\newlength{\imagecolwidth}
\setlength{\imagecolwidth}{2em}
\sloppy% Just for this example
\begin{document}
\section{A section}
\begin{centerentry}{example-image-a}
\lipsum[1]
\end{centerentry}
\begin{centerentry}[height=5em]{example-image-b}
\lipsum[2]
\end{centerentry}
\end{document}
您可以调整图像列的宽度(是的,结构是在tabularx
)通过调整长度来改变\imagecolwidth
。例如,
\setlength{\imagecolwidth}{5em}
答案2
我认为你可以使用简单的 parboxes
\documentclass[%
draft=false,
paper=a4
paper=portrait,
pagesize=auto,
fontsize=11pt
version=last,
english,
]{scrbook}
\usepackage{graphicx}
\newcommand\zz[2]{%
\begin{flushleft}%
\parbox{3em}{\includegraphics[width=\linewidth]{#1}}%
\hfil
\parbox{\dimexpr\textwidth-3.5em}{#2}%
\end{flushleft}}
\begin{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Description and examples of I do not want}
\zz{example-image}
{The text should be automatically always in he middle of the
symbol. Here it is wrong. And the second line is at the beginning
not in vertical line with the first line.}
\zz{example-image}
{The text should be automatically always in he middle of the
symbol. Here it is wrong. And the second line is at the beginning
not in vertical line with the first line.}
\zz{example-image}
{Not perfect in he middle of the symbol. It is at the bottem.}% never do this!!!!\\ \\
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{This is almost perfect}
\zz{example-image}
{The text should be automatically always in he middle of the
symbol. Here it is almost \textbf{perfect}. And the second line is
at the beginning \textbf{perfect} in vertical line with the first
line!}
\section{The first is almost perfect. How I can handle the others? I did not know!}
\zz{example-image}
{The text should be automatically always in he middle of the
symbol. Here it is almost \textbf{perfect}. And the second line is
at the beginning \textbf{perfect} in vertical line with the first
line!}
\zz{example-image}
{The text should be automatically always in he middle of the
symbol. And the second line should be at the beginning in vertical
line with the first line.}
\zz{example-image}
{The text should be automatically always in he middle of the
symbol. And the second line should be at the beginning in vertical
line with the first line.}
\end{document}