GeneralFormatting a page with many small math problems

LaTeX specific issues not fitting into one of the other forums of this category.
Xiphias
Posts: 12
Joined: Thu Aug 13, 2015 9:02 am

Formatting a page with many small math problems

Post by Xiphias »

Hello!

Sorry if this topic already has been covered and I could not find it.

I am currently making a math problem compendium for a lower level high school class. It consists of many smaller problems and I am having some issues in making it look good in terms of spacing and lining up problems without having to manually space out every single line.

Here is a part of my code:

Code: Select all

\documentclass[14pt,norsk,a4paper,twoside]{memoir}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{babel,graphicx,varioref}
\DeclareSymbolFont{letters}{OML}{ztmcm}{m}{it}
\DeclareSymbolFontAlphabet{\mathrm}{letters}
\title{Oppgaver 2P}
\begin{document}

\maketitle

\chapter{Potenser og tall på standardform}
\section{Negative tall}
\subsection{Addisjon} Regn ut \\
\textbf{1.10 a)} $2+(-1) $ \: \: \: \textbf{b)} $2-3 $ \: \: \: \textbf{c)} $1-3 $ \: \: \: \textbf{d)} $-3+4 $ \: \: \: \textbf{e)} $-5+2 $ \: \: \: \textbf{f)} $-1-4 $ \\

\noindent \textbf{1.11 a)} $-2+3-2 $ \: \: \: \textbf{b)} $5-1-2 $ \: \: \: \textbf{c)} $3-4-1 $ \: \: \: \textbf{d)} $-5+1-5 $ \: \: \: \textbf{e)} $3+2-1-3 $ \: \: \: \textbf{f)} $-3+(-1)-2+5 $ \\

\subsection{Multiplikasjon} Regn ut \\
\noindent \textbf{1.12 a)} $3\cdot(-2) $ \: \: \: \textbf{b)} $(-2)\cdot 2 $ \: \: \: \textbf{c)} $(-4)\cdot (-2) $ \: \: \: \textbf{d)} $(-3)\cdot 2\cdot (-1) $ \: \: \: \textbf{e)} $3\cdot 1 \cdot (-1) $ \: \: \: \textbf{f)} $(-1)\cdot (-2) \cdot (-3)$

\end{document}
How could this be organized to look better and also be less work? Would having an entire set of problems in math mode and allign it somehow be better?

Thanks in advance :)

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Formatting a page with many small math problems

Post by Johannes_B »

Welcome, you are dealing with LaTeX, manually adjusting stuff is seldomly needed. There shouldn't be any real work for this kind of document.

Have a look at the example below, using dedicated packages, you can easily do what you want. Using chapters might be a bit overkill here, personally i would probably go one level lower.

Code: Select all

\documentclass[14pt,norsk,a4paper,twoside,article]{memoir}
\usepackage{libertine}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{babel,graphicx,varioref}
\usepackage{libertine}
\usepackage{exsheets}
\SetupExSheets{headings-format={\normalsize\sffamily}}
%\DeclareTranslation{Norsk}{exsheets-exercise-name}{}
\usepackage{tasks}
\settasks{label-format={\sffamily}}
\DeclareSymbolFont{letters}{OML}{ztmcm}{m}{it}
\DeclareSymbolFontAlphabet{\mathrm}{letters}
\title{Oppgaver 2P}
\begin{document}
\chapter{math stuff}

\subsection{Addisjon} Regn ut% \\%Don't do that

\begin{question}
\begin{tasks}(4)
\task  $2+(-1) $ 
\task $2-3 $
\task $1-3 $ 
\task $-3+4 $
\task $-5+2 $ 
\task $-1-4 $ 
\end{tasks}
\end{question}

\begin{question}{6}
\begin{tasks}(3)
\task $-2+3-2 $ 
\task $5-1-2 $ 
\task $3-4-1+1-1+1-1+1-1 $ 
\task $-5+1-5 $ 
\task $3+2-1-3 $ 
\task $-3+(-1)-2+5 $
%\\%Don't do that
\end{tasks}
\end{question}

\setcounter{question}{23}%just for demonstration
\subsection{Multiplikasjon} Regn ut% \\%Argh
\begin{question}
\begin{tasks}
\task $3\cdot(-2) $ 
\task $(-2)\cdot 2 $ 
\task $(-4)\cdot (-2) $
\task $(-3)\cdot 2\cdot (-1) $ 
\task $3\cdot 1 \cdot (-1) $ 
\task $(-1)\cdot (-2) \cdot (-3)$
\end{tasks}
\end{question}

\end{document}
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
Xiphias
Posts: 12
Joined: Thu Aug 13, 2015 9:02 am

Re: Formatting a page with many small math problems

Post by Xiphias »

Perfect! This is exactly what I needed. Thank you so much! Had no idea there was a task environment.

I use chapters because the memoir environment has sections start at "0.1"
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Formatting a page with many small math problems

Post by Johannes_B »

Memoir is primarily used for reports and books, but you can use global option article to get into article-mmode.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
Xiphias
Posts: 12
Joined: Thu Aug 13, 2015 9:02 am

Re: Formatting a page with many small math problems

Post by Xiphias »

I used memoir to get bigger font size by default. This is also probably possible in article environment, but I did not know how.
Xiphias
Posts: 12
Joined: Thu Aug 13, 2015 9:02 am

Re: Formatting a page with many small math problems

Post by Xiphias »

A small follow up question. Is it possible to have questions be numbered with "1.1 , 1.2 ..." instead of "1, 2, 3 ..."?
User avatar
Stefan Kottwitz
Site Admin
Posts: 10290
Joined: Mon Mar 10, 2008 9:44 pm

Formatting a page with many small math problems

Post by Stefan Kottwitz »

Sure, with

Code: Select all

\usepackage{amsmath}
which should be used for math in any case, and

Code: Select all

\numberwithin{question}{section}
or the same with chapter or any sectioning.

Stefan
LaTeX.org admin
Xiphias
Posts: 12
Joined: Thu Aug 13, 2015 9:02 am

Formatting a page with many small math problems

Post by Xiphias »

Hmmm, that is having an effect. I did \numberwithin{question}{section} which reset the counter per section. But it did not change the numbering of questions from "1, 2, 3,..." to "1.1, 1.2, 1.3..." It just started as "1, 2, 3..." for the next section.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10290
Joined: Mon Mar 10, 2008 9:44 pm

Formatting a page with many small math problems

Post by Stefan Kottwitz »

Ok, then you may also need

Code: Select all

\renewcommand*{\thequestion}{\thesection.\arabic{question}}
Stefan
LaTeX.org admin
Xiphias
Posts: 12
Joined: Thu Aug 13, 2015 9:02 am

Re: Formatting a page with many small math problems

Post by Xiphias »

I don't want to be naggy, but that did not do anything it seems.
Post Reply