I don't know , i should ask this question here or not. But hope someone will help me.

```
\usepackage{listings}
\begin{lstlisting}
def incmatrix(genl1,genl2):
m = len(genl1)
n = len(genl2)
M = None #to become the incidence matrix
VT = np.zeros((n*m,1), int) #dummy variable
for k in range(len(r)):
VT[(i)*n + r[k]] = 1;
VT[(i)*n + c[k]] = 1;
VT[(j)*n + r[k]] = 1;
VT[(j)*n + c[k]] = 1;
if M is None:
M = np.copy(VT)
else:
M = np.concatenate((M, VT), 1)
VT = np.zeros((n*m,1), int)
return M
\end{lstlisting}
```

I have copied above text from overleaf help. It works properly in given example. But when i copy and run it, then it it does not appear as above. All lines get mix up. Spacing is not maintained. I am in problem because of it. Want to add caption . Someone like to help me.

This topic was moved here from #Coq users > Help from Latex by Karl Palmskog.

please use this stream (#Miscellaneous) for non-Coq questions

I'd consider giving it a try, but what you've given is not a minimal working example, and there's a good chance the problem is in the lines you've omitted. See https://tex.meta.stackexchange.com/questions/3343/what-makes-a-good-mwe on how to provide a good MWE.

https://tex.stackexchange.com is an even better place for TeX questions, but as a point of advice: questions without MWEs tend to be closed much more aggressively than here.

Speaking of latex, what are the packages that could be helpful in typesetting type theory, logic, coq and related stuff?

People have likely asked this already, perhaps there is a list or something that has been made?

I've heard about:

- mathpartir: type rules
- bussproof: proof trees
- minted: source code listing

Last updated: Jun 13 2024 at 04:03 UTC