我正在尝试在页面上水平对齐图像和文本。
这是我所问问题的附加问题这里。我在评论中得到了一些建议:比如添加[t]
到小页面,但它似乎不起作用。
提前致谢!
我的代码:
\noindent\fbox{\includegraphics[width = 0.5\linewidth, valign=c]{graph_southampton.PNG}}\hfill
\begin{minipage}{0.40\textwidth}\centering
The picture on the left represents \\
a \textcolor{blue}{graph}. The \textcolor{blue}{source} point is \\
corresponds to Southampton whereas \\
the \textcolor{blue}{destinations} are the other cities. \newline
The edges are also labeled with the shortest path between the cities.
\end{minipage}
答案1
对于这种对齐,您不需要任何特殊的东西。(我不确定我是否会选择这种布局,但这是您的选择。)
\documentclass{article}
\usepackage{graphicx,xcolor}
\begin{document}
$\vcenter{\hbox{\fbox{\includegraphics[width=4cm]{example-image-duck}}}}%
\vcenter{\begin{minipage}{0.5\textwidth}\centering
The picture on the left represents \\
a \textcolor{blue}{graph}. The \textcolor{blue}{source} point is \\
corresponds to Southampton whereas \\
the \textcolor{blue}{destinations} are the other cities. \newline
The edges are also labeled with the shortest path between the cities.
\end{minipage} }$
\end{document}
我个人会使用,tcolorbox
因为这样您很可能会拥有一个可以用来解决所有布局愿望的工具。