자동 생성된 방정식 목록의 내용을 재정렬하는 방법

자동 생성된 방정식 목록의 내용을 재정렬하는 방법

내 강좌 중 하나에 대해 결합된 노트시트/수식 시트를 만들고 있습니다. 나는 이것을 찾았다:문서의 모든 방정식을 자동으로 나열

이것은거의정확히 내가 하고 싶은 일이지만, 이것을 약간 수정하여 한 단계 더 발전시키고 싶습니다. '방정식 목록'을 정렬하고 싶습니다. 내가 하려는 작업과 유사한 이 링크를 찾았습니다(목차 재정렬). 그러나 두 개념을 결합하는 방법에 대해 고심하고 있습니다. 현재 첫 번째 링크의 코드를 사용하고 있습니다.

내 질문은 다음과 같습니다. 모든 PV 수식을 함께 표시하고 모든 r 수식을 함께 표시하고 싶습니다. 또한 'PV 공식' 및 'r_r 공식'이라는 헤더가 있는 경우 가능하지 않은 경우 PV 공식과 r_r 공식 사이에 최소한 약간의 공간을 두어 시각적으로 함께 덩어리진 것처럼 보이도록 하고 싶습니다. .

업데이트: 제가 마지막으로 게시한 이후로 이 작업을 진행해 왔으며 이 질문이 이 진행 상황을 반영하기를 원했습니다.

나는 이것에 접근하는 방법에 대해 두 가지 다른 아이디어를 가지고 있지만 무엇이 더 자동인지는 모르겠습니다. 각 PV 및 r_r에 대한 부록을 생성하고 이러한 공식 각각을 해당 부록에 자동으로 보냅니다. 다른 가능한 해결책은 서로 다른 이름을 가진 여러 개의 \savebox를 만들고 해당 상자에 수식을 넣은 다음 마지막에 인쇄하는 것입니다.

답변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 수식 참조). 합계 코드로 인해 전체 수식이 색인에 표시되지 않습니다. 그래서 지금은 summation이라는 단어를 썼습니다. 이상적으로는 공식이 컴파일 문제 없이 색인과 본문에 잘 표시될 것입니다.

전반적으로 이것은 제가 원래 하고 싶었던 것에 대한 그럴듯한 해결책입니다. 저는 이 작업을 더욱 자동화하고 독자 친화적으로 만들기 위해 계속 노력할 것입니다. 이런 일이 발생하면 코드가 업데이트되고 메모에는 코드에 어떤 문제가 있는지, 해당 문제가 해결된 위치가 반영됩니다.

관련 정보