第一次尝试用 latex 制作学校报告。无法让方程式发挥作用

第一次尝试用 latex 制作学校报告。无法让方程式发挥作用
\begin{equation}
my_list = [1, 2, 3, 4, 5], then new_list = [(2\cdot3\cdot4\cdot5), (1\cdot3\cdot4\cdot5), (1\cdot2\cdot4\cdot5), (1\cdot2\cdot3\cdot5), (1\cdot2\cdot3\cdot4)] = [120, 60, 40, 30, 24]
\end{eqution}

If \(my_list = [25,5,4,15,3], then new_list = [(5*4*15*3), (25*4*15*3),(25*5*15*3), (25*5*4*3), (25*5*4*15)] = [900, 4500, 5625, 1500, 7500]\)

我第一次尝试用 Latex 写一份学校报告,我发现自己在 Latex 编程上花费的时间比在作业中的 Python 和 R 代码上花费的时间更多。我尝试使用 \begin 和 \end 方程和(和)都没有成功。我也尝试将其写成普通文本,但由于 *,我得到了一些错误。

希望得到任何建议,真的很想在乳胶方面取得好成绩,但是在本报告的截止日期之前我没有时间这样做,所以我强烈考虑只使用 word。

编辑:尝试修复拼写错误,但现在我收到有关等式下的小节的错误。

 \section*{Problem 1.1}
    \lstinputlisting{problem_1.1.py}

    \subsection*{Explanation}
   blablalblalbalblalbalblalbal a list my\_list, produce a \_list where all the integers, new\list[i], are the product of all the integers in my\_list, except my\_list[i]. Let’s try two examples to illustrate the problem. 
    \begin{equation}
    my_list = [1, 2, 3, 4, 5], then new_list = [(2\cdot3\cdot4\cdot5), (1\cdot3\cdot4\cdot5), (1\cdot2\cdot4\cdot5), (1\cdot2\cdot3\cdot5), (1\cdot2\cdot3\cdot4)] = [120, 60, 40, 30, 24]
    \end{equation}


    %If \{my_list = [25,5,4,15,3], then new_list = [(5*4*15*3), (25*4*15*3),(25*5*15*3), (25*5*4*3), (25*5*4*15)] = [900, 4500, 5625, 1500, 7500]\)


    \subsection*{Result}
    \begin{figure}[H]
            \centering 
            \includegraphics[scale=0.4]{out1.png} 
            \caption{Output of PyCharm console.}
            %Label gjør det enkelt å referere til ulike bilder.

    \end{figure}

    \section*{Problem 1.2}

    \lstinputlisting[language=R]{assig1R.r}

    \subsection*{Explanation}
    "Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?"

    \subsection*{Result}

    \begin{figure}[H]
            \centering 
            %Scale angir størrelsen på bildet. Bildefilen må ligge i samme mappe som tex-filen. 
            \includegraphics[scale=0.7]{out2.png} 
            \caption{Output of R consolel.}
            %Label gjør det enkelt å referere til ulike bilder.
            \label{fig:test}
    \end{figure}

答案1

我建议这样做:

\documentclass{article}

\usepackage{mathtools}

\begin{document}

\begin{equation}
\begin{aligned}[b]
\texttt{my\_list} & = [1, 2, 3, 4, 5] , \text{ then}\\
 \texttt{new\_list}& = [(2\cdot3\cdot4\cdot5), (1\cdot3\cdot4\cdot5), (1\cdot2\cdot4\cdot5), (1\cdot2\cdot3\cdot5), (1\cdot2\cdot3\cdot4)\mathrlap{]} \\[0.5ex]
 & = [120, 60, 40, 30, 24]
\end{aligned}
\end{equation}

If $\texttt{my\_list} = [25,5,4,15,3]$, then $\texttt{new\_list} = [(5*4*15*3), (25*4*15*3),(25*5*15*3), (25*5*4*3), (25*5*4*15)] = [900, 4500, 5625, 1500, 7500]\)

\end{document} 

在此处输入图片描述

相关内容