自動生成された方程式リストの内容を並べ替える方法

自動生成された方程式リストの内容を並べ替える方法

私は自分のコースの 1 つにノートシートと数式シートを組み合わせたものを作成しています。次のようなものを見つけました:ドキュメントからすべての方程式を自動的にリストします

これはほとんどまさに私がやりたいことですが、これを少し修正して、一歩前進させたいと思います。「方程式のリスト」を順序付けたいのです。私がやりたいことと似たようなリンクを見つけました(目次の並べ替え)。しかし、2 つの概念をどのように組み合わせるかに苦労しています。現在は最初のリンクのコードを使用しています。

私の質問は、すべての PV 式を一緒に表示し、すべての r 式を一緒に表示したいということです。また、「PV 式」と「r_r 式」というヘッダーも表示します。それが不可能な場合は、少なくとも PV 式と r_r 式の間にいくらかのスペースを設けて、視覚的に 1 つのチャンクにまとめられているように見せたいと思います。

更新: 前回の投稿以来、これに取り組んでおり、この質問にその進捗状況を反映させたいと考えていました。

この問題に対処する方法について 2 つの異なるアイデアがありますが、どちらがより自動化されるかはわかりません。PV と r_r ごとに付録を作成し、これらの各数式をそれぞれの付録に自動的に送信します。もう 1 つの解決策としては、異なる名前の複数の \saveboxes を作成し、それぞれのボックスに数式を入れて最後に印刷します。

答え1

そこで、少し作業して、この問題を解決するコードを見つけるさまざまな方法を検討した後、自分の目的に十分対応できる部分的な解決策を見つけました。手作業は必要ですが、おそらくもっと良い解決策があると思います。当面の間、これがお役に立てば幸いです。

\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}
\let\Contentsline\contentsline
\renewcommand\contentsline[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@ {#1\index[#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}

ノート

  1. インデックスに追加したいものがあるたびに、\index[NAME]{付録に表示される書き換えられたテキスト}にすべてを再度入力する必要があります。 >これは、シンボル ~ と @ を使用した \catcode によって完全に解決されています。
  2. これはアルファベット順にソートされるため、各付録内の数式を並べ替える私の安価な解決策は、数式の前に 1) または a) を追加し、必要に応じて各書き換えられたテキスト内の最初の文字を変更することです。これにより、索引が少し乱雑になり、読みにくくなる可能性があります。 > インデックスの式の最初の文字を白にすることで、この問題も部分的に修正されました。これは理想的ではありません。最終的には、インデックス内のオブジェクトを並べ替えるより良い方法を見つけたいと考えています。
  3. 索引自体では、ページ番号が数式の直後に表示されるため、読みにくくなる場合があります。 >この問題は、ページ番号参照をハイパーリンクにして、黄色/白にすることで部分的に解決されました。黄色にするとハイパーリンクはほとんど見えなくなりますが、文書上でページをすばやく参照でき、色はすぐに白に変更できます。これも、インデックスでページ番号を抑制する最も理想的な方法ではありません。
  4. この更新されたコードでは、より複雑な数式をインデックスに送信できないようです (分数の合計である PV 数式を参照)。合計コードが原因で、数式全体がインデックスに表示されません。そのため、今のところは、合計という単語だけを記述しています。理想的には、コンパイルの問題が発生することなく、数式がインデックスとメイン テキストに適切に表示されるはずです。

全体的に、これは私が当初やりたかったことに対する妥当な解決策です。これをさらに自動化し、読みやすくするために、引き続き作業を進めていきます。作業が進むにつれて、コードが更新され、コードに存在する問題とその対処方法がメモに反映されます。

関連情報