mmcloughlin/mathfmt

nasty edge cases

mmcloughlin opened this issue · 1 comments

Collection of edge cases that are not handled well. See also #3.

Chained super/subscripts:
For example in x/crypto/pkcs12:

	//       Z_2^u x Z_2^v -> Z_2^u

https://github.com/golang/crypto/blob/c9f3fb736b729628ec1e9c1a6b4313e883f452f9/pkcs12/pbkdf.go#L38

Punctuation prior:
For example:

		//        A.  Set A2=H^r(D||I). (i.e., the r-th hash of D||1,

https://github.com/golang/crypto/blob/c9f3fb736b729628ec1e9c1a6b4313e883f452f9/pkcs12/pbkdf.go#L108

Tables:
In the below, the -+ gets replaced with a "MINUS-PLUS" symbol.

//	                  |  USTAR |       PAX |       GNU
//	------------------+--------+-----------+----------
//	Name              |   256B | unlimited | unlimited
//	Linkname          |   100B | unlimited | unlimited

https://github.com/golang/go/blob/f770366f6d910e4bf92a6f885908afe134d65b23/src/archive/tar/format.go#L19-L22

Channel syntax:
Source code in a comment replaced with a unicode arrow.

//	x, ok := <-c

https://github.com/golang/go/blob/f770366f6d910e4bf92a6f885908afe134d65b23/src/builtin/buil
tin.go#L218

Quoted strings:

	// R1 op R2 or r1 op constant.
	// op is:
	//	"<<" == 0
	//	">>" == 1
	//	"->" == 2
	//	"@>" == 3

https://github.com/golang/go/blob/f770366f6d910e4bf92a6f885908afe134d65b23/src/cmd/asm/internal/asm/parse.go#L610-L615

Comment dividers:

// The original C code, the long comment, and the constants
// below are from FreeBSD's /usr/src/lib/msun/src/s_log1p.c
// and came with this notice. The go code is a simplified
// version of the original C.
//
// ====================================================
// Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
//
// Developed at SunPro, a Sun Microsystems, Inc. business.
// Permission to use, copy, modify, and distribute this
// software is freely granted, provided that this notice
// is preserved.
// ====================================================

https://github.com/golang/go/blob/f770366f6d910e4bf92a6f885908afe134d65b23/src/math/log1p.go#L7-L19

Windows filepaths:
Can be interpreted as LaTeX symbols:

//   * UNC paths                              (e.g \\server\share\foo\bar)
//   * absolute paths                         (e.g C:\foo\bar)
//   * relative paths begin with drive letter (e.g C:foo\bar, C:..\foo\bar, C:.., C:.)
//   * relative paths begin with '\'          (e.g \foo\bar)
//   * relative paths begin without '\'       (e.g foo\bar, ..\foo\bar, .., .)

https://github.com/golang/go/blob/f770366f6d910e4bf92a6f885908afe134d65b23/src/path/filepath/symlink_windows.go#L52-L56

Seems many of the standard library changes come from the symbol aliases. Perhaps these could be replaced with less common strings.