I don't really get the question so I hope this is what you wanted. If you include a full document (such that we copy paste and see the problem on our systems) things are much more easier.
Here, you can change the default setting within a scope but your block
style had a node distance
which was resetting every time it is issued. I've made it 2mm such that we can see the difference easier.
\documentclass[tikz]{standalone}
\usetikzlibrary{arrows,shapes.geometric,positioning}
\begin{document}
\begin{tikzpicture}[decision/.style={diamond, draw, text width=4.5em, text badly centered, node distance=3.5cm, inner sep=0pt},
block/.style ={rectangle, draw, text width=6em, text centered, rounded corners, minimum height=4em, minimum height=2em},
cloud/.style ={draw, ellipse, minimum height=2em},
line/.style ={draw,-latex'},
node distance = 1cm,
auto]
\node [block] (1st) {1st};
\node [block, right= of 1st] (2nd1) {2nd1};
\begin{scope}[node distance=2mm and 10mm]%Here we change it for everything inside this scope
\node [block, above= of 2nd1] (2nd2) {2nd2};
\node [block, below= of 2nd1] (2nd3) {2nd3};
\node [block, right= of 2nd1] (3rd1) {3rd1};
\node [block, above= of 3rd1] (3rd2) {3rd2};
\node [block, above= of 3rd2] (3rd3) {3rd3};
\end{scope}
\node [block, below= of 3rd1] (3rd4) {3rd4};
\node [block, below= of 3rd4] (3rd5) {3rd5};
\path [line] (1st) -- (2nd1);
\path [line] (2nd1) -- (2nd2);
\path [line] (2nd1) -- (2nd3);
\path [line] (2nd2) -- (3rd3);
\path [line] (2nd1) -- (3rd1);
\path [line] (1st) -- (2nd1);
\end{tikzpicture}
\end{document}
When the caption is below the float contents, you can adjust the following caption parameters through \captionsetup
:
aboveskip
(space between the float contents and the caption)
belowskip
(space after the caption)
The default values are, for scrbook
class, aboveskip=10pt
and belowskip=0pt
. Also, a \baselineskip
is added by default before the floating object and 1.2\baselineskip
after it, IIRC.
The above settings don't work for listings. But you can similarly set these parameters for listings through \lstset
:
abovecaptionskip
(space between the float contents and the caption)
belowcaptionskip
(space after the caption)
aboveskip
(space between the float contents and the preceding text)
belowskip
(space between the float contents and the following text)
So leaving figure
parameters untouched and adding in your \lstset
something like
abovecaptionskip=10pt,belowcaptionskip=0pt,aboveskip=\baselineskip,belowskip=1.2\baselineskip
should do what you want.
Complete code
\documentclass[a4paper,12pt,parskip]{scrbook}
\usepackage{float}
\usepackage[demo]{graphicx} %option demo only for the example
\usepackage{caption}
\captionsetup{font=small,labelfont=bf}
\usepackage{listings}
\lstset{
captionpos=b,
frame=single,
abovecaptionskip=10pt,
belowcaptionskip=0pt,
aboveskip=\baselineskip,
belowskip=1.2\baselineskip
}
\begin{document}
Some text
\begin{lstlisting}[caption={Some caption}]
Some code
\end{lstlisting}
Some text
\begin{figure}[H]
\includegraphics[width=\textwidth]{image.png}
\caption{Some caption}
\label{fig:test}
\end{figure}
Some rext
\end{document}
Output
You can adjust these values if you think they don't meet your needs.
Best Answer
Looks can be deceiving. Because of the "p" descending letters, the vertical gap from the bottom of the "p" to the box is the same as the top of the "W" to the box (see second image). Try it with the p's removed (or
\smash
ed as I show in the third image of this MWE). The gap is identical relative, not to the text baselines, but with respect to the actual bottom and top of the text box (second and fourth images).As far as the indent,
will prevent the following text from being indented. However, it will also have the effect of allowing the tcolorboxes to be indented, which you may not want. Furthermore, it will change/eliminate the padding around the box.
As an alternative, a
\noindent
can manually override indentation on the subsequent text.