Loading data/appendix.tex +55 −0 Changes for data/appendix.tex: 55 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -48,3 +48,58 @@ \frac{1}{2 \uppi \symup{i}} \int_\gamma f = \sum_{k=1}^m n(\gamma; a_k) \mathscr{R}(f; a_k) \label{eq:appendix-equation} \end{equation} \section{源代码} 附录中的伪代码示例(代码\ref{lst:appendix-sample-code-minted},代码\ref{lst:appendix-sample-code-listings})。 \begin{listing}[!ht] \caption{C++ 代码示例(使用 \pkg{minted} 高亮)} \label{lst:appendix-sample-code-minted} \begin{minted}[xleftmargin=20pt,linenos]{cpp} #include <cstdio> #include <cstdlib> #include <iostream> using namespace std; unsigned short i; int main() { for (i = 0; i <= 5; i++) { // whatever } return 0; } \end{minted} \end{listing} \noindent% 取消 minipage 的缩进 \begin{minipage}{\linewidth} \begin{lstlisting}[language=java,caption={Java 代码示例(使用 \pkg{listings} 高亮)},xleftmargin=20pt,label={lst:appendix-sample-code-listings}] class HelloWorldApp { public static void main(String[] args) { System.out.println("Hello World!"); // Display the string. for (int i = 0; i < 100; ++i) { System.out.println(i); } } } \end{lstlisting} \end{minipage} \section{伪代码} 附录中的伪代码示例(算法\ref{algo:appendix-sample-pseudocode})。 \begin{algorithm} \caption{Simulation-optimization heuristic} \label{algo:appendix-sample-pseudocode} \KwData{current period $t$, initial inventory $I_{t-1}$, initial capital $B_{t-1}$, demand samples} \KwResult{Optimal order quantity $Q^{\ast}_{t}$} $r\leftarrow t$\; $\Delta B^{\ast}\leftarrow -\infty$\; \While{$\Delta B\leq \Delta B^{\ast}$ and $r\leq T$}{$Q\leftarrow\arg\max_{Q\geq 0}\Delta B^{Q}_{t,r}(I_{t-1},B_{t-1})$\; $\Delta B\leftarrow \Delta B^{Q}_{t,r}(I_{t-1},B_{t-1})/(r-t+1)$\; \If{$\Delta B\geq \Delta B^{\ast}$}{$Q^{\ast}\leftarrow Q$\; $\Delta B^{\ast}\leftarrow \Delta B$\;} $r\leftarrow r+1$\;} \end{algorithm} sustechthesis.dtx +2 −0 Changes for sustechthesis.dtx: 2 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -5744,6 +5744,7 @@ Thesis for the degree of \degree@level@en@noun \ of \thu@degree@domain@en% \SetAlCapSty{relax} \SetAlgoCaptionSeparator{\hspace*{1em}} \SetAlFnt{\fontsize{11bp}{14.3bp}\selectfont} \renewcommand\thealgocf{\csname the\algocf@within\endcsname-\@arabic\c@algocf}% \renewcommand\listofalgorithms{% \thu@listof{algorithmcf}% } Loading @@ -5762,6 +5763,7 @@ Thesis for the degree of \degree@level@en@noun \ of \thu@degree@domain@en% % \begin{macrocode} \AtEndOfPackageFile*{minted}{ \AtBeginDocument{ \counterwithin*{listing}{section} \renewcommand*{\thelisting}{\thechapter-\arabic{listing}} }% 不知道为啥下面这行不起作用,改用此种注入。 %\g@addto@macro\appendix{\renewcommand*{\thelisting}{\thechapter-\arabic{listing}}}% Loading Loading
data/appendix.tex +55 −0 Changes for data/appendix.tex: 55 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -48,3 +48,58 @@ \frac{1}{2 \uppi \symup{i}} \int_\gamma f = \sum_{k=1}^m n(\gamma; a_k) \mathscr{R}(f; a_k) \label{eq:appendix-equation} \end{equation} \section{源代码} 附录中的伪代码示例(代码\ref{lst:appendix-sample-code-minted},代码\ref{lst:appendix-sample-code-listings})。 \begin{listing}[!ht] \caption{C++ 代码示例(使用 \pkg{minted} 高亮)} \label{lst:appendix-sample-code-minted} \begin{minted}[xleftmargin=20pt,linenos]{cpp} #include <cstdio> #include <cstdlib> #include <iostream> using namespace std; unsigned short i; int main() { for (i = 0; i <= 5; i++) { // whatever } return 0; } \end{minted} \end{listing} \noindent% 取消 minipage 的缩进 \begin{minipage}{\linewidth} \begin{lstlisting}[language=java,caption={Java 代码示例(使用 \pkg{listings} 高亮)},xleftmargin=20pt,label={lst:appendix-sample-code-listings}] class HelloWorldApp { public static void main(String[] args) { System.out.println("Hello World!"); // Display the string. for (int i = 0; i < 100; ++i) { System.out.println(i); } } } \end{lstlisting} \end{minipage} \section{伪代码} 附录中的伪代码示例(算法\ref{algo:appendix-sample-pseudocode})。 \begin{algorithm} \caption{Simulation-optimization heuristic} \label{algo:appendix-sample-pseudocode} \KwData{current period $t$, initial inventory $I_{t-1}$, initial capital $B_{t-1}$, demand samples} \KwResult{Optimal order quantity $Q^{\ast}_{t}$} $r\leftarrow t$\; $\Delta B^{\ast}\leftarrow -\infty$\; \While{$\Delta B\leq \Delta B^{\ast}$ and $r\leq T$}{$Q\leftarrow\arg\max_{Q\geq 0}\Delta B^{Q}_{t,r}(I_{t-1},B_{t-1})$\; $\Delta B\leftarrow \Delta B^{Q}_{t,r}(I_{t-1},B_{t-1})/(r-t+1)$\; \If{$\Delta B\geq \Delta B^{\ast}$}{$Q^{\ast}\leftarrow Q$\; $\Delta B^{\ast}\leftarrow \Delta B$\;} $r\leftarrow r+1$\;} \end{algorithm}
sustechthesis.dtx +2 −0 Changes for sustechthesis.dtx: 2 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -5744,6 +5744,7 @@ Thesis for the degree of \degree@level@en@noun \ of \thu@degree@domain@en% \SetAlCapSty{relax} \SetAlgoCaptionSeparator{\hspace*{1em}} \SetAlFnt{\fontsize{11bp}{14.3bp}\selectfont} \renewcommand\thealgocf{\csname the\algocf@within\endcsname-\@arabic\c@algocf}% \renewcommand\listofalgorithms{% \thu@listof{algorithmcf}% } Loading @@ -5762,6 +5763,7 @@ Thesis for the degree of \degree@level@en@noun \ of \thu@degree@domain@en% % \begin{macrocode} \AtEndOfPackageFile*{minted}{ \AtBeginDocument{ \counterwithin*{listing}{section} \renewcommand*{\thelisting}{\thechapter-\arabic{listing}} }% 不知道为啥下面这行不起作用,改用此种注入。 %\g@addto@macro\appendix{\renewcommand*{\thelisting}{\thechapter-\arabic{listing}}}% Loading