1

I have code like this:

\begin{align}
  c_{i,p} = \frac{c_{i,p}}{IQR(c_{i})}\label{eq:1}\\  
  c_{i,p} = \frac{c_{i,p})}{Median(c_{i})}\label{eq:1}\\  
  c_{i,p} = \frac{c_{i,p})}{MAD(c_{i})}\label{eq:1}\\  
  c_{i,p} = \frac{c_{i,p})}{max(c_{i,p})-c_{i,p}}\label{eq:1}\\  
  c_{i,p} = \frac{c_{i,p})}{max(c_{i,p})-c_{i,p}}\label{eq:1}\\  
\end{align}

That looks like:

enter image description here

However, I came across the formatting of this textbook like so and would love to add captions in this way. There are two types of ways the author captions the formulas.

  1. Each formula is in a block grid and each has a label between (1) to (3). I want to achieve this and also allow captioning around the whole figure created so that it goes in my \listoffigures.

  2. Each formula has its own subsubsection number. I want to achieve this too or at least see how it is done.

enter image description here

  • 1
    There's nothing fancy about the book typesetting. A list-like environment (perhaps sectioning) followed by a bunch of equations... Your little code snippet is a far cry from the look of the book, so it's not entire clear how you want to caption the equations and place these captions inside the \listoffigures. Can you elaborate? Perhaps draw a picture showing your expected output? – Werner Aug 24 '16 at 18:14
  • Maybe you need \intertext to break up the align with text. – Steven B. Segletes Aug 24 '16 at 18:46
  • 1
    Sigmund Freud would say: An equation is an equation, so why using a caption to make it appear in the LoF? What's the purpose of that? –  Aug 24 '16 at 18:53
  • @StevenB.Segletes: That would only make sense if the alignment needs to be preserved, and from the book view it seems not. And for that we have the following: How can I add left aligned text to an equation? – Werner Aug 24 '16 at 18:53
  • 1
    @Werner You are right the book does not show it; however, the OP seemed to emphasize the notion of breaking up an align block with text. I guess some clarification from the OP would help. – Steven B. Segletes Aug 24 '16 at 18:55
  • @ChristianHupfer: Sigmund analysed equations? ;o) – Bernard Aug 24 '16 at 19:17
  • 1
    @Bernard: Sure, in Austria 'Calculus' is named 'Analysis' :-P He was in fact a \Psi-cho-analysist ;-) –  Aug 24 '16 at 19:50
  • 1
    @ChristianHupfer - Groan/smirk. :-) – Mico Aug 24 '16 at 19:58
  • @Mico: One bad joke a day keeps the doctor away ;-) –  Aug 24 '16 at 20:00
  • 1
    Or \Psi-\chi? It's also named « Analyse » in France (and, I suppose, in Greece!). – Bernard Aug 24 '16 at 20:00
  • 1
    I absolutely love the LaTex stack exchange :) – Dhruv Ghulati Aug 24 '16 at 20:09

1 Answers1

1

Some comments:

  • What you call "captions" of equations appear to be, in LaTeX jargon, nothing but \paragraph-level headers. To wit, it's straightforward to replicate the "look" of your textbook using \paragraph instructions; see also the code below.

  • Use of the \paragraph approach provides a high degree of flexibility of where page breaks may occur. With an align-based approach, you'd have to worry about where to allow page breaks.

  • In your textbook excerpt, the equations do not appear to be aligned relative to each other. Put differently, they are individually and independently centered on their respective lines. I suggest you use individual equation environments.

Aside: Since "IQR", "MAD", and "Median" would appear to be operators (in the TeX/LaTeX sense of the word), they should be typeset in upright letters. The amsmath package lets you create math operators via the \DeclareMathOperator directive. By the way, \max is already defined -- use it!

enter image description here

\documentclass{article}
\setcounter{secnumdepth}{4} % default is "3" for article document class
% Paragraph-level headers: italic, not bold
\usepackage{sectsty}
\paragraphfont{\mdseries\itshape} 

\usepackage{amsmath} % for \DeclareMathOperator and \numberwithing macros
\DeclareMathOperator{\IQR}{IQR}
\DeclareMathOperator{\Median}{Median}
\DeclareMathOperator{\MAD}{MAD}
\numberwithin{equation}{section}

\begin{document}
% Just for this example:
\setcounter{section}{2}
\setcounter{subsection}{2}
\setcounter{subsubsection}{23}
\setcounter{equation}{36}

\paragraph{Interquartile range}
\begin{equation}
  c_{i,p} = \frac{c_{i,p}}{\IQR(c_{i})}\label{eq:1}
\end{equation}
\paragraph{Median}
\begin{equation} 
  c_{i,p} = \frac{c_{i,p}}{\Median(c_{i})}\label{eq:2}
\end{equation}
\paragraph{Minimum absolute distance}
\begin{equation} 
  c_{i,p} = \frac{c_{i,p}}{\MAD(c_{i})}\label{eq:3}
\end{equation}
\paragraph{Max 1}
\begin{equation} 
  c_{i,p} = \frac{c_{i,p}}{\max(c_{i,p})-c_{i,p}}\label{eq:4} 
\end{equation}
\paragraph{Max 2}
\begin{equation} 
  c_{i,p} = \frac{c_{i,p}}{\max(c_{i,p})-c_{i,p}}\label{eq:5}  
\end{equation}
\end{document}
Mico
  • 506,678
  • Hi @Mico, for the first example in the textbook example, it seems like these are subcaptions e.g. (1), (2), (3)? How do I have it so all of those could be named using (1) (2) (3) and have a figure caption at the bottom of the group which maybe has "Figure 1: List of Cost Functions"? Which appears in my listoffigures? – Dhruv Ghulati Aug 24 '16 at 20:30
  • @DhruvGhulati - Please note that "\caption" is something of a reserved word in LaTeX. For sure, even though the textbook would appear to have been generated by TeX and friends, nothing you describe as "captions" is generated via a \caption instruction. The (1), (2), etc almost certainly come for an enumerated list, i.e., \begin{enumerate} followed by \item, \item etc \end{enumerate}. Incidentally, I'm afraid I absolutely don't "get" why these formulas as supposed to be part of a figure environment. That's certainly not what the textbook excerpt is showing. – Mico Aug 24 '16 at 20:36
  • Understood. My goal is to have a grid of equations which each individually go into the list of equations I have (the index I create), but the overarching group of them appears as one thing in the list of figures. – Dhruv Ghulati Aug 24 '16 at 20:47