Open K0max opened 11 months ago
With a clean document:
#import "algo.typ": algo, i, d, comment, code
#code(block-align: none)[
```c
int MaxSubSum(int n, int a[]) {
int sum = 0, b = 0;
for (int i = 0; i < n; i++) {
b += a[i];
if (b < 0)
b = 0;
if (b > sum)
sum = b;
}
return sum;
}
```]
I get this:
So it might be a rogue show rule in your case. With more info about your document, I can probably help fix it. However, it's worth noting that my approach to implementing code
is hacky and outdated in comparison to a package like codly. If you're only using this package for the code
function, you may want to look into another package for now.
In the last line I put right bracket ] together with ``` in case that three dots be recognized as markdown keywords. (Whether putting the ] in a new line or not doesn't change the pdf.)
And it renders as below
As shown above, the line number 2 and 5 dissappeared, and got two blank lines 12 and 13.
If I rewrite it in python, then it's normal. So I guess maybe the problem is related to curly braces.