図が段落間で中​​央揃えになっていない

図が段落間で中​​央揃えになっていない

私は float を で使用します[h]。このコマンドを使用する場合:

\setlength{\intextsep}{0pt plus 0pt minus 0pt}

上記のテキストと図の間の間隔は 0 に設定されていますが、図とその後の段落の間の間隔は 0 に設定されていません。何も変更せずにパッケージをロードすることも試しましたparskip。うまくいきませんでした。このトピックに関する質問をたくさん見てきましたが、実際の回答はありません... 図がテキスト間でうまく中央揃えされていません...

\documentclass[11pt,a4paper,addpoints]{exam}
\unframedsolutions
%\printanswers
\usepackage{tikz}
\usepackage{graphicx}
\usepackage{geometry}
\usepackage{calc}
\usepackage{blindtext}
\newgeometry{left=2cm,top=2cm,right=2cm,bottom=2cm}

\begin{document}
\begin{questions}

This is the upper paragraph which has less space between this text and lower figure.

\begin{figure*}[h]
\begin{tikzpicture}[rounded corners=5mm]
\path node[rectangle,draw=green,fill=green!8,inner sep=.70cm] {\parbox{\textwidth-1.4cm-\fboxrule}{

\question[2] What is the first question?
\begin{solutionorlines}[4cm]
This box is smaller than when the solutions are not printed. How do I make this the same dimension as when answers are not printed?
\end{solutionorlines}
}};
\end{tikzpicture}
\end{figure*}

This is the lower paragraph which has more space between this text and above figure.

\end{questions}
\end{document}

答え1

MWE なしで推測しますが、やってみましょう...

0に設定しても\intextsep、図の後に行間スペースができます。\prevdepthを設定すると、これを抑制することができます-1000pt(第15章を参照)。トピック別TeX)。

\documentclass{article}
\usepackage{lipsum}
\setlength\intextsep{0pt plus 0pt minus 0pt}
\begin{document}
\lipsum[1]
\begin{figure}[h]
\rule{4cm}{4cm}
\end{figure}
\prevdepth=-1000pt
\lipsum[2]
\end{document}

立つ瀬がない

これをする良い理由を考えるのは難しいです。

関連情報