1
\begin{example}
Is there a way to modify the color of the word "Example 1" and also being able to tpye 
on the same line with the word Example 1?
\end{example}

enter image description here

  • Surely, but it depends on how you defined the example environment. – Bernard Sep 7 '16 at 23:45
1

Changing the foreground <colour> for the example environment is achieved using

\setbeamercolor{block title example}{fg=<colour>}

For using an "inline example", you can define your own environment, say inlineexample:

enter image description here

\documentclass{beamer}

\let\Tiny\tiny% http://tex.stackexchange.com/a/94159/5764
\setbeamertemplate{theorems}[numbered]

\newenvironment{inlineexample}
  {\par\vskip\medskipamount
   \refstepcounter{theorem}%
   {\usebeamercolor[fg]{block title example}\translate{Example}~\theexample}:}
  {\par\vskip\smallskipamount}

\begin{document}

\begin{frame}
  \frametitle{Frame title}

  \begin{example}
    Is there a way to modify the color of the word ``Example~\theexample'' and 
    also being able to type on the same line with the word Example~\theexample?
  \end{example}

  \setbeamercolor{block title example}{fg=red}
  \begin{example}
    Is there a way to modify the color of the word ``Example~\theexample'' and 
    also being able to type on the same line with the word Example~\theexample?
  \end{example}

  \begin{inlineexample}
    Is there a way to modify the color of the word ``Example~\theexample'' and 
    also being able to type on the same line with the word Example~\theexample?
  \end{inlineexample}

\end{frame}

\end{document}

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.