Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

List of issues addressed #56

Closed
clbarnes opened this issue Mar 17, 2022 · 1 comment
Closed

List of issues addressed #56

clbarnes opened this issue Mar 17, 2022 · 1 comment

Comments

@clbarnes
Copy link

As the code seems to be unavailable (which is your prerogative, of course), would it be possible to have a comprehensive list of which latex issues are addressed? Something like a checklist of issues noted by the l2tabu source, with those blacktex fixes marked off, would be very helpful; examples would be even better.

@nschloe
Copy link
Collaborator

nschloe commented Mar 19, 2022

Thanks Chris for the input.

The example in the README is supposed to highlight some of the changes blacktex does, but in general I think it's best to just try it out. Here's a list of test tuples (before/after), perhaps that'll already help you out:

        # dollar replacement:
        ("a $a + b = c$ b", r"a \(a + b = c\) b"),
        (r"a \$a + b = c\$ b", r"a \$a + b = c\$ b"),
        (r"a \\$a + b = c\\$ b", "a \\\\\n\\(a + b = c\\\\\n\\) b"),
        # text mods:
        (r"{\em it's me!}", r"\emph{it's me!}"),
        # comments:
        ("lorem  %some comment  \n %sit amet", "lorem "),
        ("% lorem some comment  \n sit amet", "sit amet"),
        ("A % lorem some comment  \n sit amet", "A sit amet"),
        ("{equation}%comment", "{equation}"),
        # multiple comment lines:
        ("A\n%\n%\nB", "A\nB"),
        # comment last:
        ("somemacro{%\nfoobar% \n}", "somemacro{foobar}"),
        # trailing whitespace:
        ("lorem    \n sit amet", "lorem\n sit amet"),
        # obsolete text mod:
        (r"lorem {\it ipsum dolor} sit amet", r"lorem \textit{ipsum dolor} sit amet"),
        # multiple spaces:
        ("lorem   ipsum dolor sit  amet", "lorem ipsum dolor sit amet"),
        # It's allowed as indentation at the beginning of lines:
        ("a\n    b\nc", "a\n    b\nc"),
        ("\\[\n  S(T)\\leq S(P_n).\n\\]\n", "\\[\n  S(T)\\leq S(P_n).\n\\]\n"),
        # spaces with brackets:
        (r"( 1+2 ) { 3+4 } \left( 5+6 \right)", r"(1+2) {3+4} \left(5+6\right)"),
        # multiple newlines:
        ("lorem  \n\n\n\n\n\n ipsum dolor   sit", "lorem\n\n\n ipsum dolor sit"),
        # $$:
        ("a $$a + b = c$$ b", "a\n\\[\na + b = c\n\\]\nb"),
        # whitespace after curly:
        ("\\textit{ \nlorem  \n\n\n ipsum   dol}", "\\textit{\nlorem\n\n\n ipsum dol}"),
        # sub/superscript space:
        ("2^ng", "2^n g"),
        ("1/n^3", "1/n^3"),
        ("n^3", "n^3"),
        ("(n^3)", "(n^3)"),
        ("n^\\alpha", "n^\\alpha"),
        ("a^2_PP^2", "a^2_PP^2"),
        # Underscore separation just produces too many false positives. Leave as is.
        ("2_ng", "2_ng"),
        # dots:
        ("a,...,b", "a,\\dots,b"),
        ("a,\\cdots,b", "a,\\dots,b"),
        # punctuation outside math:
        ("$a+b.$", "\\(a+b\\)."),
        (".$a+b$", ".\\(a+b\\)"),
        # <https://github.com/nschloe/blacktex/issues/43>
        (r"$a$\,$b$", r"\(a\)\,\(b\)"),
        # whitespace before punctuation:
        ("Some text .", "Some text."),
        # nbsp before ref:
        ("text \\ref{something}", "text~\\ref{something}"),
        # nbsp space:
        ("Some ~thing.", "Some thing."),
        # double nbsp:
        ("Some~~text.", "Some\\quad text."),
        # \over to \frac:
        ("a{b^{1+y} 2\\over 3^{4+x}}c", "a\\frac{b^{1+y} 2}{3^{4+x}}c"),
        ("{\\pi \\over4}", "\\frac{\\pi}{4}"),
        # overline warn:
        ("\\overline", "\\overline"),
        # linebreak after double backslash:
        ("T $2\\\\3 4\\\\\n6\\\\[2mm]7$.", "T \\(2\\\\\n3 4\\\\\n6\\\\\n[2mm]7\\)."),
        # keywords without backslash:
        (
            "maximum and logarithm $max_x log(x)$",
            r"maximum and logarithm \(\max_x \log(x)\)",
        ),
        # def vs. newcommand
        (r"\def\e{\text{r}}", r"\newcommand\e{\text{r}}"),
        # linebreak around begin/end:
        (
            "A\\begin{equation}a+b\\end{equation} B \n\\begin{a}\nd+e\n\\end{a}\nB",
            "A\n\\begin{equation}\na+b\n\\end{equation}\nB\n\\begin{a}\nd+e\n\\end{a}\nB",
        ),
        # indentation is okay
        (
            "A\n  \\begin{equation}\n  a+b\n  \\end{equation}",
            "A\n  \\begin{equation}\n  a+b\n  \\end{equation}",
        ),
        # centerline:
        ("\\centerline{foobar}", "{\\centering foobar}"),
        # eqnarray align:
        (
            "A\\begin{eqnarray*}a+b\\end{eqnarray*}F",
            "A\n\\begin{align*}\na+b\n\\end{align*}\nF",
        ),
        # env label:
        (
            "A\n\\begin{lemma}\n\\label{lvalpp}\\end{lemma}",
            "A\n\\begin{lemma}\\label{lvalpp}\n\\end{lemma}",
        ),
        ("A\n\\section{Intro}\n\\label{lvalpp}", "A\n\\section{Intro}\\label{lvalpp}"),
        (
            "A\n\\subsection{Intro}\n\\label{lvalpp}",
            "A\n\\subsection{Intro}\\label{lvalpp}",
        ),
        # coloneqq
        ("A:=b+c", "A\\coloneqq b+c"),
        ("A := b+c", "A \\coloneqq b+c"),
        ("A : = b+c", "A \\coloneqq b+c"),
        ("b+c =  : A", "b+c \\eqqcolon A"),
        # tabular column spec:
        (
            "\\begin{tabular} \n {ccc}\ncontent\\end{tabular}",
            "\\begin{tabular}{ccc}\ncontent\n\\end{tabular}",
        ),
        # env option spec:
        ("\\begin{table} \n [h!]G\\end{table}", "\\begin{table}[h!]\nG\n\\end{table}"),
        ("\\begin{table}   [h!]G\\end{table}", "\\begin{table}[h!]\nG\n\\end{table}"),
        ("\\begin{table}   [h!]\nG\\end{table}", "\\begin{table}[h!]\nG\n\\end{table}"),
        ("\\begin{table} \n [h!]G\\end{table}", "\\begin{table}[h!]\nG\n\\end{table}"),
        (
            "\\begin{table} \n [h!]\\label{foo}\\end{table}",
            "\\begin{table}[h!]\\label{foo}\n\\end{table}",
        ),
        (
            "\\begin{table} \n [h!]\\label{foo}\nG\\end{table}",
            "\\begin{table}[h!]\\label{foo}\nG\n\\end{table}",
        ),
        # space around operators:
        ("a+b=c", "a+b = c"),
        ("a+b&=&c", "a+b &=& c"),
        # SI percentage:
        (r"20\% \SI{30}{\%}", r"\SI{20}{\%} \SI{30}{\%}"),
        # escaped percentage sign:
        (r"25\% gain", r"\SI{25}{\%} gain"),
        # https://github.com/nschloe/blacktex/issues/46
        (r"\rightline{\bf a}", r"\rightline{\textbf{a}}"),

@nschloe nschloe closed this as completed May 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants