Feedback on my LaTeX code please

In summary: Some other tips include using packages and macros to keep your code organized and reusable, using comments and descriptive variable names to make your code more understandable, and breaking up long equations and proofs into multiple lines for readability. It's also important to properly format your code with indentation and line breaks to make it easier to read and debug.
  • #1
Eclair_de_XII
1,083
91
TL;DR Summary
Tried copying math proof from this forum into LaTeX. Need feedback on how to better structure it.
style:
\newcommand\func{\(f\)}
\newcommand\myset[1][math]{\ifthenelse{\equal{math}{#1}}{\(K\)}{K}}

\newcommand\diff[4]{\(|#1-#2|#4#3\)}

\newcommand\ball[3]{\diff{#1}{#2}{#3}{<}}
\newcommand\Fllab[2]{\diff{f(#1)}{f(#2)}{\epsilon}{\geq}}

\newcommand\term[2][n_k]{\({#2}_{#1}\)}

\newcommand\setdelta[1]{\(\delta=#1\)}
\newcommand\ptsinset[1]{\(x_{#1},y_{#1}\in\myset[]\)}

\newcommand\xyball[1]{\ball{x_{#1}}{y_{#1}}{\ifthenelse{#1>1}{\frac{1}{#1}}{1}}}

\newcommand\seq[2][n]{\(\{{#2}_{#1}\}\)}

\newcommand\ucontinv{there is \(\epsilon>0\) such that for any \(\delta>0\), there are points \(x,y\in \myset[]\) such that \ball{x}{y}{\delta} but \Fllab{x}{y}}

\newcommand\seqconverge[2]{There is an integer \(#1\) such that if \(n_k\geq#1: |{#2}_{n_k}-z|<\delta'\)\par}

proof:
Let \func{} be a continuous function defined on a sequentially compact set \myset. Suppose \func is not uniformly continuous. By definition, \ucontinv.

In particular, choose \setdelta{1} and find points \ptsinset{1} with the property that \xyball{1} and \Fllab{x_1}{y_1}. Now choose \setdelta{2} and then find points \ptsinset{2} with the property that \xyball{2} and \Fllab{x_2}{y_2}.

Continuing in this fashion, we obtain two sequences \seq{x}, \seq{y} with the property that for any \(\delta>0\), we can choose an integer \(N>\frac{1}{\delta}\) in order to ensure that \(|x_N-y_N|<\frac{1}{N}<\delta\).

Since \myset{} is sequentially compact, it follows that there exists a subsequence of \seq{x}, which we shall denote as \seq[n_k]{x} that converges to some point \(z \in \myset[]\). Now for each \seq[n_k]{x}, choose \seq[n_k]{y} such that \ball{x_{n_k}}{y_{n_k}}{\frac{1}{m}} where \(m\) is the index of \term{x}, \term{y} in their respective parent sequences.

This gives us a sequence \seq[n_k]{y} with the property that \(|y_{n_k}-x_{n_k}|\rightarrow0\). Moreover, since a given \term{x} gets arbitrarily close to \(z\), it follows that \term{y} must get close to \(z\) as well.

There is \(\delta'>0\) such that for all \(x\in \myset[]\), in particular the terms in the sequence constructed, with the property that whenever \ball{x}{z}{\delta'}, it follows that \ball{f(x)}{f(z)}{\frac{\epsilon}{2}}.

\seqconverge{N_1}{x}
\seqconverge{N_2}{y}

Choose \(N\equiv \sup\{N_1,N_2\}\) such that if \(n_k\geq N\):

\begin{align*}
|f(x_{n_k})-f(z)|<\frac{\epsilon}{2}\\
|f(z)-f(y_{n_k})|<\frac{\epsilon}{2}
\end{align*}

It follows that:

\begin{align*}
\epsilon&>&|f(z)-f(y_{n_k})|+|f(x_{n_k})-f(z)|\\
&\geq&|[f(z)-f(y_{n_k})]+[f(x_{n_k})-f(z)]|\\
&=&|-f(y_{n_k})+f(x_{n_k})|
\end{align*}

contrary to the assumption that \(|f(x_n)-f(y_n)|%
\nrightarrow0\) for all \(x_n,y_n\).

main:
\documentclass{minimal}

\usepackage{ifthen}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{style}

\begin{document}
\input{proof}
\end{document}
 
Physics news on Phys.org
  • #2
I see lots of latex code but not where your formatted proof is having issues.

it’s hard to proceed from what you gave us.
 
  • #3
It's not actually having any issues or errors. I actually wanted feedback on how to better structure it, which is something I admit I should have mentioned in the opening post.
 
  • #4
Your best bet is to search on Latex Best Practices and see what other experienced users say.

I found this ACM article on best practices for organizing your code.

https://www.acm.org/publications/taps/latex-best-practices

On another site, it was mentioned to use source code management like git to keep track of changes and recover from bad choices.
 

What is LaTeX and why is it used for scientific writing?

LaTeX is a typesetting language used for creating high-quality documents, particularly in the fields of mathematics and science. It allows for precise and professional formatting of equations, diagrams, and other technical elements that are common in scientific writing.

What are the benefits of receiving feedback on my LaTeX code?

Receiving feedback on your LaTeX code can help improve the overall quality and readability of your document. It can also help catch any errors or inconsistencies that may have been missed during the writing process.

How can I request feedback on my LaTeX code?

You can request feedback on your LaTeX code by sharing your document with colleagues or peers in the same field, or by posting it on online forums or communities specifically for LaTeX users.

What should I keep in mind when receiving feedback on my LaTeX code?

Remember that feedback is meant to help improve your document, so be open to suggestions and constructive criticism. It's also important to clearly communicate what areas of your document you would like feedback on, such as formatting, equations, or grammar.

Are there any resources available for learning how to write LaTeX code?

Yes, there are many resources available for learning LaTeX, including online tutorials, forums, and user guides. You can also consult with colleagues or mentors who are experienced in using LaTeX for scientific writing.

Similar threads

Replies
18
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
Replies
14
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
9
Views
3K
  • Topology and Analysis
Replies
3
Views
2K
Replies
9
Views
890
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
3K
Replies
0
Views
2K
Replies
7
Views
1K
Back
Top