0

In the below code, how can I set up the space in the end of the minipage environment with baselineskip automatically?
Actually I don't want use to \vspace... and the same command, and also I want to be all of my minipages with [t] option.
My code:

\documentclass{book}
\usepackage{amsmath}
\renewcommand{\baselinestretch}{2}
\setlength{\parindent}{0pt}
\begin{document}
\begin{minipage}[t]{.46\linewidth}
 If you face a problem try to find the solution not the reason.
\end{minipage}\hfill
\begin{minipage}[t]{.46\linewidth}
 If you face a problem try to find the solution not the reason.
\end{minipage}
\begin{minipage}[t]{\linewidth}
 If you face a problem try to find the solution not the reason.
\end{minipage}
\begin{minipage}[t]{\linewidth}
 If you face a problem try to find the solution not the reason.
\end{minipage}
\end{document}

My output


enter image description here


Second edit:
I want the space between my lines to be the same (inside and outside the minipage)
I want to have the below output:


enter image description here


1 Answers1

1

I am not sure that I understand the question. Is this the output that you want?

enter image description here

To get this I defined a new environment called Minipage that inserts a [t]-minipage environment with a default line width of \linewidthand which adds \newline\vspace\baselineskip at the end of the environment. The environment always accepts an optional environment for changing the line width. Here's the full code:

\documentclass{book}
\usepackage{amsmath}
\renewcommand{\baselinestretch}{2}
\setlength{\parindent}{0pt}
\newenvironment{Minipage}[1][1]{\minipage[t]{#1\linewidth}}{\endminipage\newline\vspace\baselineskip}
\begin{document}
\begin{Minipage}[0.46]
 If you face a problem try to find the solution not the reason.
\end{Minipage}\hfill
\begin{Minipage}[0.46]
 If you face a problem try to find the solution not the reason.
\end{Minipage}
\begin{Minipage}
 If you face a problem try to find the solution not the reason.
\end{Minipage}
\begin{Minipage}
 If you face a problem try to find the solution not the reason.
\end{Minipage}
\end{document}
  • Thanks a lot my dear Andrew. but I didn't mean it. I change your macro in this way: \newenvironment{Minipage}[1][1]{\minipage[t]{#1\linewidth}}{\endminipage\vspace\baselineskip} It is ok, but now I want the space between my lines to be the same (inside and outside the minipage). – SH.Madadpour Mar 19 '18 at 07:46
  • I edit my question and I show that what I want with the image. – SH.Madadpour Mar 19 '18 at 13:22