
Tengo problemas para insertar perfectamente una imagen dentro de una línea de texto. Lo ideal es escalar la imagen al tamaño correcto para que quepa dentro de la línea de texto. Hasta aquí he llegado. Si bien está cerca, la imagen es demasiado alta. ¿Algunas ideas? ¡Gracias!
\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}
Aquí hay una imagen de lo que obtengo con esto:
Respuesta1
¿Como esto?
\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}
Tal como está escrito, esto no se adaptará a los cambios de tamaño de fuente dentro del documento. Sin embargo, puedes definir un nuevo \inlinegraphics{}
comando que lo haga:
\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}
Respuesta2
Simplemente baje desde 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}