0

I am writing some math homework in LaTex and I would like to format somehow like this:

10.2) Question Statement

My Answer


Meaning, I would like the question statement stand out, either in a colored box like above, or in some other way. Is this possible? Thank you.

EDIT: Here is an example of how I would like to to look like:

10.2) Let $R$ be an integral domain. Show that if $R[x]$ is a principal ideal domain, then $R$ is a field.

Proof: The map $\varphi : R[x] \to R$ defined by $\varphi: p(x) \mapsto p(0)$ is a surjective homomorphism with kerned $(x)$. By the first isomorphism theorem, we have $R[x]/(x) \cong R$. Furthermore, $(x)$ is a maximal ideal, is a prime ideal, and because $R[x]$ is a principal ideal domain, $(x)$ is maximal. Therefore $R[x]/(x)$ is a field, so $R$ is a field as well.

  • 1
    Please add a minimal example of what you tried so far. It makes much easier to help you! – CarLaTeX Jan 2 at 21:30
  • Some inspiration on how to achieve a colored background might be found here: Changing background color of text in Latex – leandriis Jan 2 at 21:31
  • @CarLaTeX Honestly I have zero ideas, I know only very minimal LaTex. I will try to google around and see if I can find something. – Ovi Jan 2 at 21:34
  • @Ovio Just set up a little example of question-answer, we'll do the coloring and all the rest. – CarLaTeX Jan 2 at 21:41
  • @CarLaTeX Done! – Ovi Jan 2 at 21:50
2

As others have pointed out, there are a massive range of options for doing boxed and colored text. Here's just one example. Whichever you use, you probably want to set it up as a personally defined environment: that way you can easily change the precise implementation without having to alter your document in more than one place. If you learn anything from this, learn that!

\documentclass[12pt]{article}
\usepackage{tcolorbox}% Here's the package we will use. Many options for sure.

\newenvironment{question}[1]% We set up an environment which takes one mandatory argument: the question number.
{\begin{tcolorbox}[title=#1]}% Its start is to begin a tcolorbox with our question-number as the title
{\end{tcolorbox}}% And its end is just to end tcolorbox

\tcbset{colback=orange!20!white,colframe=orange!75,fonttitle=\sffamily\bfseries}% Fiddle with colors, fonts etc here

\begin{document}
\begin{question}{10.2}
    Let \(R\) be an integral domain. Show that if \(R[x]\) is a principal ideal domain, then \(R\) is a field.
  \end{question}
Proof: The map \(\varphi : R[x] \to R\) defined by \(\varphi: p(x) \mapsto p(0)\) is a surjective homomorphism with kerned \((x)\). By the first isomorphism theorem, we have \(R[x]/(x) \cong R\). Furthermore, \((x)\) is a maximal ideal, is a prime ideal, and because \(R[x]\) is a principal ideal domain, \((x)\) is maximal. Therefore \(R[x]/(x)\) is a field, so \(R\) is a field as well.

\end{document}

Boxed text image

You could start by experimenting with tcolorbox: find its documentation with texdoc tcolorbox at the terminal or on CTAN.

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.