0

I would like to change the appearance of a whole section in a text with math content. I have for instance a half page with several equations in it which I would like to be differentiated from the rest of the text by being written in italic or in another font. When I use the command \textit` for instance the compiler tells me:

Paragraph ended before text@command was complete}

Too many }'s }

Is there a way to do this?

EDIT: I am writing my master thesis using:

\documentclass[a4paper,10pt]{report}

\newcommand{\separator}{\begin{center}
\vspace{5mm}
 $* \qquad * \qquad * \qquad * \qquad * \qquad * \qquad * \qquad * \qquad * \qquad * \qquad * \qquad * \qquad * \qquad * \qquad * \qquad *$
\vspace{5mm}
\end{center}}

\separator

Text and equations ...

\separator

What I would like is additionally to have everything between separator to be written in a different font or textstyle. I tried putting a \textit{...} wrapped all around, but it gave the errors mentioned above.

  • Welcome to TeX.SX! Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – Astrinus Jun 8 '15 at 9:22
  • Well, the error is very clear, you must have left or unintentionally added an extra } somewhere. Seeing your code would help find the culprit. If you do a "Find and replace" search for { and then for }, you'll see the count won't be the same. – Alenanno Jun 8 '15 at 9:28
  • @Alenanno Yes, I understand that. The error comes only when I add the \textit{...} all around, which means that obtaining what I want does not work in that way. – Löwe Simon Jun 8 '15 at 9:31
  • 3
    \textit{something} is not the command to use here, use \itshape instead, you need to limit the scope using a group But i don't understand your intention here, to be honest. – Johannes_B Jun 8 '15 at 9:38
  • 1
    I would define a new environment for this material, that way it is a group by itself, and you can globally change the appearance. Can you give a visual of that book and the style? – Johannes_B Jun 8 '15 at 11:01
3

\textit is command that takes an argument, it also is short, meaning you cannot have multiple paragraphs in there. A proper way would be to use \itshape and use it in a group, best to define your own environment.

There are many ways to make this material stand out and recognized not to be part of the usual text. Below, i decided to use lines as well as a shift into the margin to make a clear distinction.

loewesimonSuppmat

\listfiles
\documentclass{article}
\usepackage{blindtext}
\usepackage{scrextend}
\usepackage{mathtools}[2015/06/17]
\newenvironment{suppmat}{\begin{addmargin}[1cm]{-1cm}\noindent\rule{\linewidth}{.3pt}\smallbreak\itshape}{%
        \smallbreak\noindent\rule{\linewidth}{.3pt}\end{addmargin}\medbreak}
\begin{document}
\blindtext
\begin{suppmat}
    \begin{equation}
        p=mv
    \end{equation}
    Muss man wissen!
\end{suppmat}
\blindtext
\begin{suppmat}
    This could be some explaining text, we need it to show
    that this stuff can break. \blindtext
    \begin{align}
        E &=mc^2
        \shortintertext{this is short text}
        a^2 + b^2 &= c^2
    \end{align}
\blindtext
\end{suppmat}
\blindtext
\end{document}
0

As Johannes_B was correctly pointing out, \textit can only take an argument (e.g. a few written lines) and cannot handle multiple paragraphs.

The simplest solution for me was to use itshape as follows:

{\itshape
Write here everything that you want in italics. 

It can handle different paragraphs and equations (although the equations will not be in italics)
}

Another option is to use \begingroup \itshape text here will be italics \endgroup or \begin{itshape} text here will be in italics \end{itshape} (Thanks @ChristianHupfer for the suggestion, and mentioning that the last solution works but it's not elegant)

  • 2
    Although this works, itshape is not really an environment. You could use \begingroup \itshape \endgroup or a { \itshape ....} as well – user31729 Apr 11 '16 at 12:16
  • @ChristianHupfer thanks for the suggestion, I edited the answer – pietro Apr 11 '16 at 18:14

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.