Feedback on my LaTeX code please

  • Context: LaTeX 
  • Thread starter Thread starter Eclair_de_XII
  • Start date Start date
  • Tags Tags
    Code Feedback Latex
Click For Summary
SUMMARY

The discussion focuses on improving the structure of LaTeX code used for mathematical proofs. Key commands such as \newcommand, \diff, and \ball are utilized to define functions and sets. Users emphasize the importance of adhering to LaTeX best practices for better organization and readability. Recommendations include consulting resources like the ACM article on LaTeX best practices and using version control systems like Git for managing code changes.

PREREQUISITES
  • Familiarity with LaTeX syntax and commands
  • Understanding of mathematical notation in LaTeX
  • Knowledge of version control systems, specifically Git
  • Awareness of best practices in coding and documentation
NEXT STEPS
  • Read the ACM article on LaTeX best practices for organizing code
  • Explore advanced LaTeX packages for mathematical typesetting
  • Learn how to use Git for version control in LaTeX projects
  • Investigate LaTeX documentation tools to enhance code readability
USEFUL FOR

Mathematicians, researchers, and students who are writing proofs in LaTeX, as well as anyone looking to improve their LaTeX coding practices and project management skills.

Eclair_de_XII
Messages
1,082
Reaction score
91
TL;DR
Tried copying math proof from this forum into LaTeX. Need feedback on how to better structure it.
[CODE title="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}[/CODE]

[CODE title="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\).[/CODE]

[CODE title="main"]\documentclass{minimal}

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

\begin{document}
\input{proof}
\end{document}[/CODE]
 
Physics news on Phys.org
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.
 
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.
 
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.
 

Similar threads

  • · Replies 18 ·
Replies
18
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 9 ·
Replies
9
Views
6K
  • · Replies 14 ·
Replies
14
Views
2K
  • · Replies 6 ·
Replies
6
Views
2K
Replies
2
Views
3K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 9 ·
Replies
9
Views
1K
  • · Replies 1 ·
Replies
1
Views
3K
Replies
6
Views
2K