
У меня возникли проблемы с тем, чтобы идеально встроить изображение в строку текста. В идеале изображение должно быть масштабировано до нужного размера, чтобы оно помещалось в строку текста. Это все, что я смог сделать. Изображение хоть и близко, но слишком высокое. Есть идеи? Спасибо!
\documentclass[preprint2]{aastex}
\usepackage{graphicx}
\newcommand*{\img}[1]{%
\raisebox{-.02\baselineskip}{%
\includegraphics[
height=\baselineskip,
width=\baselineskip,
keepaspectratio,
]{#1}%
}%
}
\begin{document}
\begin{enumerate}
\item When ready, click `record \img{Record.png}'. There will be a three second period before the actual data collection begins.
\end{enumerate}
\end{document}
Вот изображение того, что у меня получилось:
решение1
Так?
\documentclass{article}
\usepackage{graphicx,calc}
\newlength\myheight
\newlength\mydepth
\settototalheight\myheight{Xygp}
\settodepth\mydepth{Xygp}
\setlength\fboxsep{0pt}
\begin{document}
This is some arbitrary \raisebox{-\mydepth}{\fbox{\includegraphics[height=\myheight]{tiger}}} line of uninteresting text.
\end{document}
Как написано, это не будет адаптироваться к изменениям размера шрифта в документе. Однако вы можете определить новую \inlinegraphics{}
команду, которая это сделает:
\documentclass{article}
\usepackage{graphicx,calc}
\newlength\myheight
\newlength\mydepth
\settototalheight\myheight{Xygp}
\settodepth\mydepth{Xygp}
\setlength\fboxsep{0pt}
\newcommand*\inlinegraphics[1]{%
\settototalheight\myheight{Xygp}%
\settodepth\mydepth{Xygp}%
\raisebox{-\mydepth}{\includegraphics[height=\myheight]{#1}}%
}
\begin{document}
This is some arbitrary \raisebox{-\mydepth}{\fbox{\includegraphics[height=\myheight]{tiger}}} line of uninteresting text.
This should adapt \inlinegraphics{example-image-a}.
\Huge Will this adapt \inlinegraphics{example-image-b} nicely?
\tiny That is yet to be \inlinegraphics{example-image-a} seen.
\end{document}
решение2
Просто опустите с 0.3\baselineskip
:
\documentclass{article}%[preprint2]{aastex}
\usepackage{graphicx}
\newcommand*{\img}[1]{%
\raisebox{-.3\baselineskip}{%
\includegraphics[
height=\baselineskip,
width=\baselineskip,
keepaspectratio,
]{#1}%
}%
}
\begin{document}
\begin{enumerate}
\item When ready, click `record \img{Vinyl.png}'. There will be a three second period before the actual data collection begins.
\end{enumerate}
\end{document}