Text FormattingPairs of Functions in enumerated List

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
Cherrys
Posts: 4
Joined: Thu Sep 05, 2013 5:48 pm

Pairs of Functions in enumerated List

Post by Cherrys »

Hello,

I'd like to use an indentation with two or more columns inside an enumeration, so that the two columns have the same indentation, and the left side corresponds to the right side. For example, I have a list of exercises, each requiring two functions f and g, and I'd like to have the f functions on the left, the g functions on the left, with every g function indented the same

What I did was this:

Code: Select all

\begin{multicols}{2}
  \begin{enumerate}
    \item $f(x)=(x-2)^2$
    \item $f(x)=x^n$
    \item $f(x)=\dfrac 13-\sqrt 2x$
    \item $f(x)=\dfrac{2x-7}{9x+3}$
  \end{enumerate}
  \begin{description}
    \item $g(x)=x^3$
    \item $g(x)=x^m$
    \item $g(x)=\dfrac{1}{1-x}$
    \item $g(x)=\dfrac{3x-2}{4x+1}$
  \end{description}
\end{multicols}
It works, but is not very practical when typing, because I have to define the g functions after I've defined every f functions. So if I have to change something to some functions, it's problematic to find it.

What I'd have liked would be to have something like:

Code: Select all

\begin{array}{ll}
  \begin{enumerate}
    \item first f function here & first g function here\\
    \item second f function here & second g function here\\
    \item etc
  \end{enumerate}
\end{array}
Is there any way to do something like that?

Thanks in advance for your help!
Last edited by cgnieder on Sat Sep 07, 2013 10:39 am, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Re: Pairs of Functions in enumerated List

Post by localghost »

Would the usual equation numbering be an option or is the enumerated list a must?


Best regards and welcome to the board
Thorsten
Cherrys
Posts: 4
Joined: Thu Sep 05, 2013 5:48 pm

Re: Pairs of Functions in enumerated List

Post by Cherrys »

Well, I'm coding exercises for students, and sometime, "enumerated" items are only texts, sometimes only equations, sometimes some of both. And in some cases, the indentation I'm trying to get is welcomed. So basically, I use enumerate because that way I get a single enumeration style for all my exercises. But if there's a more suitable alternative, it'd be great!

Thank for the welcome :)
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Pairs of Functions in enumerated List

Post by localghost »

In an enumerated list you can try to give each of the first functions f(x) a fixed width by using \makebox. Click on "Open writeLateX" in the head of the below code box to see the output instantly.

Code: Select all

\documentclass[11pt]{article}
\usepackage[T1]{fontenc}
\usepackage{mathtools}

\begin{document}
  \begin{enumerate}
    \item \makebox[10em][l]{$f(x)=(x-2)^2$} $g(x)=x^3$
    \item \makebox[10em][l]{$f(x)=x^n$} $g(x)=x^m$
    \item \makebox[10em][l]{$f(x)=\dfrac{1}{3}-\sqrt{2}x$} $g(x)=\dfrac{1}{1-x}$
    \item \makebox[10em][l]{$f(x)=\dfrac{2x-7}{9x+3}$} $g(x)=\dfrac{3x-2}{4x+1}$
  \end{enumerate}
\end{document}
Since you are preparing exercise sheets, you might be interested in packages and classes for exams and exercises.
Cherrys
Posts: 4
Joined: Thu Sep 05, 2013 5:48 pm

Pairs of Functions in enumerated List

Post by Cherrys »

The \makebox is perfect, thanks a lot!

As for the exercises/exams packages, I'm already using some :)
Post Reply