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 tex.stackexchange.com/questions/16494/… . 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
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

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.