【LaTeX】 案例分析 (9) - MCM 2021 - 目录 / 伪代码 / 分栏 / 文字框 / 组合图 / 表格排版 / 公式编号

小组选择题目为 MCM 2021 - A题 Fungi (真菌)


Final Result: Honorable Mention


注:

  • 其中很多环境运用到的环境所需宏包(package)可能不太清楚了(方式是每次列上一堆宏包再说),可以查看宏包手册或者搜索一下。
  • 这次没有使用 VS Code 而是用了 Tex Studio, 诱因是 VS Code 里的参考文献引用的编译老是出各种故障错误,于是下载了 TeX Studio。这里就没有这么多问题,不再像 VS Code 那里那么脆弱。此外,由于 TeX Studio 只用于 Tex 家族的文件,相比 VS Code 有更多的快捷的操作方式。

附:整理好的 MCM 文件夹。(只是我个人的,不完全包括小组内其他同学的)
MCM 文件夹


目录

\tableofcontents

1

伪代码

\begin{algorithm}[H]
	\label{Alg}
	\SetAlgoLined
	\SetKwFunction{f}{f}
	\SetKwFunction{g}{g}
	\SetKwFunction{h}{h}
	\SetKwFunction{Add}{Add}
	\SetKwFunction{stdAdd}{stdAdd}
	\SetKwFunction{feedbackAdd}{feedbackAdd}
	\SetKwFunction{Plot}{Plot}
	\SetKwFunction{Sum}{Sum}
	\SetKwFunction{Print}{Print}
	\SetKwFunction{isStable}{isStable}
	\SetKwFunction{isDivergent}{isDivergent}
	\SetKwFunction{Exit}{Exit}
	\SetKwFunction{Continue}{Continue}
	\SetKwFunction{Define}{Define}
	\SetKwFunction{isFluctuating}{isFluctuating}
	\KwData{temperature $T$, water potential $w_p$, Moisture trade-off $M_o$, Initial hyphal length $N_0$}
	\KwResult{The length of hyphae and the proportion of remaining wood}
	\textbf{define} $N(t)$ \textbf{as} \Sum($N_i(t)$)\;
	$t \leftarrow 0$\;
	\While{$N(t) > 0$}
	{
		$\mathfrak{K} \leftarrow \f(T, p_w)$\;
		\ForEach{$N_i(t)$}
		{
			$N_i(t) \leftarrow N_i(t) + \mathfrak{K} \cdot \g(N_i(t), R(t))$\;
			$R(t) \leftarrow R(t) - N_i(t) \cdot \h(\mathfrak{K})$\;
		}
		\If{there is supplement for wood}
		{
			$\Add(t) \leftarrow \stdAdd(t) + N(t-\Delta t) \cdot \feedbackAdd(N(t-\Delta t))$ \;
			$R(t) \leftarrow R(t) + \Add(t)$\;
		}
		\ForEach{$N_i(t)$} { \Plot($N_i(t), R(t)$)\;}
		\Plot($N(t), R(t)$)\;
		$t \leftarrow t + \D t$\;
		\eIf(\tcp*[h]{conclude it as stable or fluctuating}){\isStable$(N(t), R(t))$ \textbf{or} \isFluctuating$(N(t), R(t))$}
		{
			\Print("Fungi and Wood live together till old and grey.")\;
			\Exit($t$)\;
		}
		{
			\eIf(\tcp*[h]{conclude it as divergent}){\isDivergent$(N(n), R(t))$}
			{
				\Print("The amount of fungi or wood remains go out of control!")\;
				\Exit($t$)\;
			}
			{
				\Continue\;
			}
		}
	}
	\eIf(\tcp*[h]{No wood left}){$R(t)=0$}
	{
		\Print("The fongi finished their mission within ", $t$)\;
	}
	{
		\Print("The fongi died young at the age of ", $t$)\;
	}
	\Exit($t$)\;
	\caption{The process of fungal growth and the resulting wood decomposition rate}
\end{algorithm}

2

分栏

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\twocolumn
\section{Article}
\begin{strip}
	{\large \textit{MCM Introduction to Systems Ecology} - Chapter X\qquad }{\Large \color{purple} \texttt{PROJECT}}
	\begin{center}
	\begin{Huge}
		\textsc{These Little Guys Really Matter}
	\end{Huge}

	\end{center}
		\begin{center}
	\begin{tcolorbox}
		[colback=yellow!10,% background
		colframe=red,% frame colour
		width=0.9\linewidth,% Use 8cm total width,
		arc=5mm,
		auto outer arc,
		boxrule=1.5pt,]{
			
			\textcolor[rgb]{0.1,0.3,0.7}{\texttt{
				%\fontfamily{pbk}
				% Contents
			}}}
		
	\end{tcolorbox}
\end{center}
\end{strip}                

\begin{figure}[b] % at the botton of the page
	\includegraphics[width=\linewidth]{Photo.jpg}
\end{figure} 

\subsection*{Significance of fungi as decomposers to ecosystem}
% Contents
\begin{figure}[htbp]
	\includegraphics[width = \linewidth]{What2.pdf}
\end{figure}
% Contents

\subsection*{The importance of fungi to plant growth}
% Contents

\subsubsection*{Reference}
\noindent{
[1] Research Team.Mathematical modeling of fungi decomposition and its application, \emph{MCM}, 1-23}
\subsubsection*{Image Source}
\noindent{
https://www.pharmamicroresources.com/2017/09/
fungi-are-key-players-of-deep-biosphere.html}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\onecolumn
\section{Appendix}

3

\twocolumn\onecolumn 都是会强制换页的,也有局部双栏的方法,用 multicols 环境可以做到,不过其中无法使用 figure 环境。
此处在 strip 环境中实现横跨两栏,但是这当中同样不能加入图片,但可以加入公式。图片如果用 figure* 环境跨栏,只能做到在顶部(t)和底部(b)。figure环境是在一栏内部的。

文字框

代码图片见上方分栏中内容。
注意 RGB 此处范围是 0 到 1。

组合图

\begin{figure}
	\centering
	\subfloat[Hot desert climate - Bwh (arid)]{
		\includegraphics[width=0.48\linewidth]{A-all.pdf}}
	\label{2a}\hfill
	\subfloat[Hot semi-arid climate - Bsh (semi-arid)]{
		\includegraphics[width=0.48\linewidth]{B-all.pdf}}
	\label{2b}\\
	\subfloat[Monsoon-influenced humid subtropical climate - Cwa (temperate)]{
		\includegraphics[width=0.48\linewidth]{C-all.pdf}}
	\label{2c}\hfill
	\subfloat[Humid subtropical climate - Cfa (arboreal)]{
		\includegraphics[width=0.48\linewidth]{D-all.pdf}}
	\label{2d}\\
	\subfloat[Tropical rainforest climate - Af (tropical rain forests)]{
		\includegraphics[width=0.48\linewidth]{E-all.pdf}}
	\label{2e}\hfill
	\subfloat{
		\includegraphics[width=0.28\linewidth]{A-E-all_word.pdf}}
	\label{2f} \\
	\caption{The proportion of remaining wood(\%) in relation to time in different climates}
	\label{fig_all} 
\end{figure}

4
规律应该可以自己找到,有的下面有小标题,有的没有。

TIP: 图片由 Mathematica 软件求解微分方程绘图而得。

表格排版

(个人感觉像是开挂了)
有的时候,制作时在 Excel,手输排版至 LaTeX \LaTeX LATEX 就会比较麻烦,这时可以使用一个 Excel2LaTeX 的宏,GitHub 下载地址:https://github.com/krlmlr/Excel2LaTeX/releases/tag/v3.5.0
下载之后直接运行 xla 文件即可。
5-1
点击转换为 LaTeX 代码。(会保留原格式)
5-2

选择启用宏:
5-3
选择(应该看的明白吧),注意可以转换 LaTeX \LaTeX LATEX 的保留符号(我这里没有)
5-4
然而可能会有宽度、间距问题,再调整参数:(上面的表格没有调整行间距)

\section{Appendix}
\begin{table}[htbp]
	\centering
	\caption{Traits of fungi}
	\setlength{\tabcolsep}{8.5mm}{
		\begin{tabular}{cccc}
			\toprule
			\textbf{Fungi Species} & $T_opt$ & ${p_w}_{opt}$ & $M_o$ \\
			\midrule
			\textbf{Armillaria gallica} & 20.44759881 & -2.080083688 & -0.424 \\
			\textbf{Armillaria tabescens} & 24.6679775 & -1.903906284 & -0.247 \\
			\textbf{Phellinus robiniae} & 24.9412051 & -1.452091017 & 0.078 \\
			\textbf{Schizophyllum commune} & 26.52106999 & -1.806152264 & 0.108 \\
			\textbf{Hyphoderma setigerum} & 23.47056583 & -1.291180258 & 0.42 \\
			\textbf{Phlebiopsis flavidoalba} & 25.31099825 & -1.785706136 & 0.432 \\
			\textbf{Merulius tremullosus} & 24.82389853 & -1.100669569 & 0.655 \\
			\textbf{Phlebia rufa} & 23.38336874 & -0.950476781 & 0.961 \\
			\bottomrule
	\end{tabular}}
	\label{tab---}%
\end{table}%
\begin{table}[htbp]
	\centering
	\caption{Result of the fitting}
	\small	
	\setlength{\tabcolsep}{1.5mm}{
		\begin{tabular}{ccccccc}
			\toprule
			\textbf{Fungi Species} & \boldmath{$a_1$}  & \boldmath{$a_2$}  & \boldmath{$b_1$}  & \boldmath{$b_2$}  & \boldmath{$M_o$}  & \boldmath{$\varepsilon$} \\
			\midrule
			\textbf{Armillaria gallica} & 0.002262385 & -0.0026158 & 0.439089569 & -0.23112045 & -0.424 & 0.001101358 \\
			\specialrule{0em}{2pt}{2pt}	
			\textbf{Armillaria tabescens} & 0.015265657 & -0.004254 & 0.672496257 & -0.27587279 & -0.247 & 0.004642609 \\
			\specialrule{0em}{2pt}{2pt}	
			\textbf{Hyphoderma setigerum} & 0.033155962 & -0.00366 & 7.094594909 & -0.59982732 & 0.420  & 0.021018341 \\
			\specialrule{0em}{2pt}{2pt}	
			\textbf{Merulius tremullosus} & 0.151046048 & -0.0043419 & 23.52081525 & -0.82544109 & 0.655 & 0.093833124 \\
			\specialrule{0em}{2pt}{2pt}	
			\textbf{Phellinus robiniae} & 0.028968744 & -0.0044098 & 2.978261209 & -0.47425544 & 0.078 & 0.014149288 \\
			\specialrule{0em}{2pt}{2pt}	
			\textbf{Phlebia rufa} & 0.102303958 & -0.0036217 & 28.67251607 & -1.10692189 & 0.961 & 0.078589774 \\
			\specialrule{0em}{2pt}{2pt}	
			\textbf{Phlebiopsis flavidoalba} & 0.169942209 & -0.0046346 & 10.04290219 & -0.31360286 & 0.432 & 0.063968354 \\
			\specialrule{0em}{2pt}{2pt}	
			\textbf{Schizophyllum commune} & 0.147573797 & -0.0055041 & 6.034640709 & -0.30654291 & 0.108 & 0.053150388 \\
			\bottomrule
	\end{tabular}}
	\label{fitting_result}%
\end{table}%

5-5

公式编号

设置公式前有章节号:

\numberwithin{equation}{section}

6


ALL RIGHTS RESERVED © 2021 Teddy van Jerry & XJTLYY Team
欢迎转载,转载请注明出处。


See also

Teddy van Jerry 的导航页

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值