2

I would like to define a new environment, which I can use to change the appearance of my text locally.

Specifically, I would like to have certain sections look like this, with indentation, smaller and title in bold.

indent_everything_that_follows{
     {\footnotesize
          \textbf{Example: } a few paragraphs here
     }
}

Thank you!

  • I've recently added an example in https://tex.stackexchange.com/questions/16494/generating-lists-of-custom-environment/423825#423825 . It automatically adds a number and a title to the env and you can create a listof with the title in it. You might have to rearrange some things for your needs. – Shade Apr 18 '18 at 13:52

2 Answers2

0

Starting from here, I defined an environment myindent that takes a title is mandatory argument and prints the text indented by 1cm, in \scriptsize and with the title in boldface.

\documentclass{article}
\usepackage{lipsum}
\newenvironment{myindent}[1]{\list{}{\leftmargin=1cm}\item\footnotesize\textbf{#1}}{\endlist}

\begin{document}

\lipsum[1]

\begin{myindent}{Example:}
    \lipsum[2-3]
\end{myindent}

\lipsum[3]

\end{document}

enter image description here

Tiuri
  • 7,749
0

Here is one approach, assuming you always want the title to be Example:

\documentclass{article}
\usepackage{lipsum}
\newenvironment{myindent}{%
\setlength{\leftskip}{3em}
\footnotesize
\noindent\textbf{Example:}\par\smallskip
}
{}
\begin{document}
\lipsum[1]
\begin{myindent}
\lipsum[2-3]
\end{myindent}
\lipsum[4]
\end{document}

enter image description here

erik
  • 12,673