# Intended Paragraphs Inside Environment

I have decided to come back to beautiful LaTeX typesetting after several years. I have just decided to hone up my LaTeX skills but have found out that it will be not easy.

Here is my question: I have found this code from book class file (World Scientific Publishing), which makes a numbered framed box.

But this code doesn't allow me to indent paragraphs coming after the 1st paragraph (In the figure below, the second paragraph starts with "Let", which is intended.) I wonder how I indent paragraphs after the first paragraph like the figure below.

The code as follows:

\documentclass[12pt,a4paper]{book}
\usepackage{boxedminipage}

\newcounter{boxcnt}[chapter]
\renewcommand\theboxcnt{\thechapter.\arabic{boxcnt}}
\newenvironment{boxedtxt}[1]{%
\vskip6pt
\parindent0pt\leftskip0pt
\itemindent0pt\leftmargin0pt
\fboxsep=8pt
\normalfont
\refstepcounter{boxcnt}
\begin{boxedminipage}[0.5pt]{\hsize}
\selectfont
{\bfseries{Box\ \theboxcnt\enspace}#1}
\vskip 6pt plus2pt minus1pt
\par\noindent\ignorespaces
}{%
\end{boxedminipage}%
\vskip6pt\noindent\ignorespacesafterend
}

\begin{document}

\begin{boxedtxt}{Summation and series}
Summation is the operation of addition. The result of summation is called the
sum. The summation operation can be conveniently indicated by the the summation
symbol (the capital sigma, $\sum$). For instance, the sum of the square of the
first four natural numbers can be written as
$\sum_{k=1}^{4}{k^2}= 1 + 2^2+3^2 +4^2 = 30,$
where $k=1$ in the subscript and 4 in the superscript denote that the summation
index $k$ takes integer values from 1 to 4.

Let $\{a_k\}_{k=1}^{n} = {a_1+a_2+\cdots.+a_n}$ be a sequence of n numbers bla
bla \ldots
\end{boxedtxt}
It is noted that the matrix bla bla \ldots
\end{document}

• Welcome to TeX.SX! When I compile your example none of the paragraphs inside the box get indented... – Ruben Jul 8 '15 at 22:13
• Don't set \parindent=0pt. Plain TeX sets \parindent=20pt default. base.sty only uses 0pt and 1em. – John Kormylo Jul 8 '15 at 22:26
• And as a tiny remark: I edited $$...$$ into $...$. You should avoid the first syntactic form to create display math as it is deprecated and non-expacted things might happen. – Ruben Jul 8 '15 at 22:41
• Also \bfseries does not take an argument. It is a switch (i.e. a toggle). So \bfseries{...} ... is just the same as \bfseries ... .... – cfr Jul 8 '15 at 22:55

I've corrected the code so that it does what you want. However I also propose another similar environment, that I've called fboxedtxt, based on the framed package, which has the advantage to break across pages if necessary. Also, if required, it's not too difficult to modify the code to obtain coloured frames and/or shaded environment.

\documentclass[12pt,a4paper]{book}
\usepackage{fourier, erewhon}
\usepackage[showframe]{geometry}
\usepackage[x11names]{xcolor}
\usepackage{boxedminipage}
\usepackage{framed}
\usepackage{amsmath}

\newcounter{boxcnt}[chapter]
\renewcommand\theboxcnt{\thechapter.\arabic{boxcnt}}
\newenvironment{boxedtxt}[1]
{\vskip6pt
\leftskip0pt
\itemindent0pt\leftmargin0pt
\fboxsep=8pt
\normalfont
\refstepcounter{boxcnt}\noindent
\begin{boxedminipage}[0.5pt]{\hsize}\selectfont{\bfseries{Box\
\theboxcnt\enspace}#1}\vskip 6pt plus2pt minus1pt
\par\noindent\ignorespaces\parindent1em}
{\end{boxedminipage}%
\vskip6pt \noindent\ignorespacesafterend}

\newcounter{fboxcnt}[chapter]
\renewcommand\thefboxcnt{\thechapter.\arabic{fboxcnt}}
\newenvironment{fboxedtxt}[1]
{
\FrameSep=8pt
\OuterFrameSep=6pt
\FrameRule=1pt
\normalfont
\refstepcounter{fboxcnt}\noindent
\begin{oframed}\noindent\selectfont{\bfseries{Box\
\theboxcnt\enspace}#1}\vskip 6pt plus2pt minus1pt
\par\noindent\ignorespaces}
{\end{oframed}%
\vskip6pt \noindent\ignorespacesafterend}
\begin{document}
Some text. Sometext. Some text. Sometext. Some text. Sometext. Some text. Sometext.
\setcounter{chapter}{3}\setcounter{boxcnt}{1}
\begin{boxedtxt}{Summation and series}
Summation is the operation of addition. The result of summation is called the
sum. The summation operation can be conveniently indicated by the the summation
symbol (the capital sigma, $\sum$). For instance, the sum of the square of the
first four natural numbers can be written as
$\sum_{k=1}^{4}{k^2}= 1 + 2^2+3^2 +4^2 = 30,$
where $k=1$ in the subscript and 4 in the superscript denote that the summation
index $k$ takes integer values from 1 to 4.

Let $\{a_k\}_{k=1}^{n} = \bigl\{a_1,a_2,\dots, a_n\bigr\}$ be a sequence of $n$ numbers in which each term $a_k$ is given by a certain rule, whose character is here irrelevant. A series is the sum of a sequence and can be written in summation notation as
$\sum_{k = 1}^{n} = a_1 + a_2 + \dotsm + a_n$%
If the number of terms is finite, the series is called a finite series; otherwise it is called an infinite series. An example of an infinite series is the geometric series
$\sum_{k = 0}^{\infty}\frac{1}{2^k} = 1 + \frac{1}{2} + \frac{1}{4} + \frac{1}{8} + \frac{1}{16} + \dotsm$%
\end{boxedtxt}
It is noted that the matrix bla bla \ldots
\setcounter{boxcnt}{1}
\begin{fboxedtxt}{Summation and series}
Summation is the operation of addition. The result of summation is called the
sum. The summation operation can be conveniently indicated by the the summation
symbol (the capital sigma, $\sum$). For instance, the sum of the square of the
first four natural numbers can be written as
$\sum_{k=1}^{4}{k^2}= 1 + 2^2+3^2 +4^2 = 30,$
where $k=1$ in the subscript and 4 in the superscript denote that the summation
index $k$ takes integer values from 1 to 4.

Let $\{a_k\}_{k=1}^{n} = \bigl\{a_1,a_2,\dots, a_n\bigr\}$ be a sequence of $n$ numbers in which each term $a_k$ is given by a certain rule, whose character is here irrelevant. A series is the sum of a sequence and can be written in summation notation as
$\sum_{k = 1}^{n} = a_1 + a_2 + \dotsm + a_n$%
If the number of terms is finite, the series is called a finite series; otherwise it is called an infinite series. An example of an infinite series is the geometric series
$\sum_{k = 0}^{\infty}\frac{1}{2^k} = 1 + \frac{1}{2} + \frac{1}{4} + \frac{1}{8} + \frac{1}{16} + \dotsm$%
\end{fboxedtxt}

\end{document}


• "Summation" isn't indented, though the OP required this. – Ruben Jul 8 '15 at 23:39
• ??? I understood the first paragraph after title should not be intended (as is standard in English, by the way). Did I misunderstand? – Bernard Jul 8 '15 at 23:45
• I guess you don't misunderstood. I was confused because in the original version of the MWE nothing was indented... – Ruben Jul 8 '15 at 23:49
• Nice alternative environment by the way! – Ruben Jul 8 '15 at 23:49
• In my code, the first paragraph was not indented (which I wanted) but after the first paragraph, the code doesn't allow me to indent the others. So this property is similar to LaTeX book class: no indentation in the first paragraph in a section, but indentation for paragraphs after it. – ofenerci Jul 9 '15 at 7:17