
テキストの行内に画像を完全に埋め込むのに苦労しています。理想的には、テキストの行内に収まるように、画像を適切なサイズに拡大縮小する必要があります。これが私のできる範囲です。ほぼ近いのですが、画像が高すぎます。何かアイデアはありますか? よろしくお願いします!
\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}