TransWikia.com

How to reorder content in of autogenerated list of equations

TeX - LaTeX Asked on November 1, 2021

I am creating a combined Notesheet/ formula sheet for one of my courses. I found this: Automatically list all equations from document

This is almost exactly what I want to do, however I want to slightly modify this and take this one step forward. I want the’List of Equations’ to be ordered. I found this link that is similar to what I would like to do (Reorder Table of Contents). However I am struggling on how to combine the two concepts. I currently am using the code from the first link.

My question is: I would like all the PV formulas appear together and all of the r formulas to appear together. Also with a header that says ‘PV Formulas’ and ‘r_r Formulas’ If that is not possible, then I would like there to at least be some space between the the PV formulas and the r_r formulas so that they visually appear to be chunked together.

UPDATE: been working on this since i last posted and wanted this question to reflect this progress.

I have two different ideas of how to approach this, however I don’t know what would be more automatic. Either creating an appendix for each PV and r_r and automatically send each of these formulas into their respective appendix.
My other possible solution is to create multiple saveboxes with different names and put the formulas in those respective boxes and print at the end.

One Answer

So after some work and looking at different ways to find code that make solve this, I have this partial solution that works well enough for my own purposes. It does require some manual labor and I know that there are probably better solutions. I hope that this helps in the meantime.

documentclass{article}

usepackage{amsmath}
usepackage{amssymb}
usepackage{latexsym}
usepackage{imakeidx} %allows for multiple indexes
usepackage[colorlinks=true,linkcolor=yellow,citecolor=red, linktoc=page]{hyperref} %links hyperlinks to the page, and colors the hyperlink to yellow to make the link barely visible
usepackage{xcolor} %allows for colors

%%%%%%Title formatting %%%%%%%%%%%
 title{Notes I}
    date{vspace{-5ex}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


%%%%%%%% Table of Content Formatting %%%%%%%%%%%%%%%%%%%%%%
%to suppresses page numbers in TOC:
usepackage{hyperref}
letContentslinecontentsline
renewcommandcontentsline[3]{Contentsline{#1}{#2}{}} %to suppress the dottfill in the subsection
makeatletter
renewcommand{@dotsep}{10000} 
makeatother
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


%%%%%%%%%%%%%%%%%% catcode to create shortcuts %%%%%%%%%%%%%%%%%%%%%%%%%
catcode`"=active
def"#1" {textcolor{white}{#1}} %catcode to color words white, as to hide it on the the compile format

catcode`!=active
def!#1! {underline{underline{double underline}}} %to create a short cut to double underline stuff
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


%%%%%%%%%%%%%%%%%%Index formatting%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%define special character ~ to allow for automatic indexing without retyping everything. the #numbers are place holders that corresponds with one another. 
catcode`~=active
def~#1 #2~ {#1 index[S>A]{#1 #2}}  %catcode for OBJECT  DEFINITION like in Symbols and Abbreviations

catcode`@=active
def@#1[#2]#3@ {#1index[#2]{$square$ "#3" #1}}  %catcode for FORMULAS that are sent to specific indexes as needed, here I use the catcode for "" in order to hide the letter that will allow for the index to be rearranged. so #3 will denote the order of the index, however it will be invisible to the naked eye on white paper so that the formula indexes are easier to read


%%% IndexStyleFile.ist %%%
%   delim_0 "\hfill "              
%   delim_1 " "                     
%   delim_2 " "                     
%   delim_n " "                     
%%%%%%%%%%%%%%%%%%%%%%%%%%


%making indexes as needed
%  makeindex[name=NICKNAME, title={INDEX_TITLE},columns=1, intoc,options= -s IndexStyleFile.ist]

makeindex[name=S>A, title={Symbols and Abbreviations},columns=1, intoc,options= -s IndexStyleFile.ist]

makeindex[name=PV, title={Present Value},columns=1, intoc,options= -s IndexStyleFile.ist]

makeindex[name=r.r, title={r_r},columns=1, intoc,options= -s IndexStyleFile.ist]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


usepackage{lipsum} %creating filler text for demonstration/test purposes

begin{document}

    maketitle
    tableofcontents
    pagebreak

    section*{Color and Formatting Notes}
    begin{itemize}
        item underline{single underline} ||-- is for definitions
        item !double underline!  |----- is to attention too something
        item (ex)|||||||--- works as an appositive, it will give real examples or further details
        item underline{Example} |||||-- is a example problem
        end{itemize}
    pagebreak

    section{Section 1}

    underline{Present Value} ~:= is defined as~ discounted value, is the value of an expected income stream determined as of the date of valuation 
    begin{itemize}
        item[$ast$] (ex) blah 
        item[$ast$] (ex) blah blah 
    end{itemize} 
    @$PV =(1+i)^{-n}$[PV]b@
    \lipsum[2]
    @$PV$=summation $frac{C}{(1+r)^n}$[PV] c@ lipsum[2]
    @$r_r = frac{r-i}{1+i}$[r.r] b@
    noindent lipsum[2]

    subsection{subsection title}
    lipsum[5]
    @$PV =(frac{1}{(1+i)})^{n}$[PV] a@
    noindent lipsum[3]

    section{title 2}
       lipsum[1]
        @$PV=e^{delta t}$[PV] 1@


    lipsum[6]
    @$r_r approx r-i$[r.r] a@
    lipsum[5]

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%print indexes
%indexprologue{textit{DESCRIPTION}}
%printindex[NAME]    


printindex[S>A]    

indexprologue{Present Value is the discounted value, is the value of an expected income stream determined as of the date of valuation}
printindex[PV]    

printindex[r.r]

end{document}

Notes

  1. every time that there is something that you want to append into a index, you have to type it all out again in the index[NAME]{rewritten text to appear in appendix} >this has been completely addressed by the catcode with symbols ~ and @
  2. This sorts ALPHABETICALLY, so my cheap solution to reordering formulas within each appendix is to to just add a 1) or a) before the formula, and as needed I would just change the first letter within each rewritten text. which can make the index a little cluttered and difficult to read > this has also been partially fixed by making the first letter in the formula for the index white. it is not ideal, would ultimately want to find a better way to reorder objects in an index
  3. in the index itself, the page number appears right after the formula which can make reading a little difficult. >this has been partially addressed making the page number references a hyperlink, and turning them yellow/white. Yellow makes the hyperlink barely visible, but allows for quick page referencing on the document, and the color can be changed to white immediately. Again this not the most ideal way of suppressing page numbers in an index
  4. this updated code does not seem to allow for more complicated formulas to be sent to the index(see PV formula that is a summation of a fraction). The summation code was caused the entire formula to not appear in the index. So for now, I have just written out the word summation, ideally the formula would appear nicely in the index as well as the main text without compiling problems.

Overall, this is a plausible solution to what I originally wanted to do. I will continue to work on this to make it more automated and reader-friendly.As this happens, the code will be updated and the notes will reflect what problems are present with the code, and how where they addressed.

Answered by Lizzy on November 1, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP