
我正在為我的課程建立一個組合的筆記表/公式表。我找到了這個:自動列出文件中的所有方程
這是幾乎這正是我想要做的,但是我想稍微修改一下並向前邁出一步。我想要訂購“方程式列表”。我發現這個連結與我想做的類似(重新排序目錄)。然而,我正在努力思考如何將這兩個概念結合起來。我目前正在使用第一個連結中的程式碼。
我的問題是:我希望所有的 PV 公式一起出現,並且所有的 r 公式一起出現。還有一個標頭,上面寫著“PV 公式”和“r_r 公式”如果這是不可能的,那麼我希望PV 公式和r_r 公式之間至少有一些空間,以便它們在視覺上看起來像是分塊在一起的。
更新:自從我上次發布以來一直在研究這個問題,並希望這個問題能反映這一進展。
對於如何解決這個問題,我有兩種不同的想法,但我不知道哪種更自動化。為每個 PV 和 r_r 建立一個附錄,並自動將每個公式傳送到各自的附錄中。我的另一個可能的解決方案是創建多個具有不同名稱的 \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}
筆記
- 每次您想要將某些內容附加到索引中時,您都必須在 \index[NAME]{重寫文字以出現在附錄中} 中再次輸入所有內容 >這已由帶有符號 ~ 和 @ 的 \catcode 完全解決
- 這是按字母順序排序的,所以我在每個附錄中重新排序公式的廉價解決方案是在公式前添加1) 或a),並且根據需要我只需更改每個重寫文本中的第一個字母。這會使索引有點混亂並且難以閱讀 > 透過將索引公式中的第一個字母設為白色,也部分解決了這個問題。這並不理想,最終希望找到一種更好的方法來重新排序索引中的對象
- 在索引本身中,頁碼出現在公式之後,這可能會使閱讀有點困難。 >此問題已部分解決,使頁碼引用超鏈接,並將其變為黃色/白色。黃色使超連結幾乎不可見,但允許在文件上快速引用頁面,並且顏色可以立即變更為白色。同樣,這不是抑制索引中頁碼最理想的方法
- 這個更新的程式碼似乎不允許將更複雜的公式傳送到索引(請參閱PV公式,它是分數的求和)。求和程式碼導致整個公式沒有出現在索引中。所以現在,我剛剛寫出了單字求和,理想情況下該公式會很好地出現在索引和正文中,而不會出現編譯問題。
總的來說,對於我最初想做的事情來說,這是一個合理的解決方案。我將繼續致力於此,使其更加自動化和讀者友好。