GithubHelp home page GithubHelp logo

bartp5 / libtexprintf Goto Github PK

View Code? Open in Web Editor NEW
28.0 3.0 2.0 266 KB

Library providing printf-style formatted output routines with tex-like syntax support.

License: GNU General Public License v3.0

Makefile 0.71% C 83.87% M4 0.27% Shell 8.84% Roff 5.52% Awk 0.79%
ascii-art ascii-graphics unicode tex

libtexprintf's People

Contributors

bartp5 avatar bkmgit avatar stevengj avatar suavesito-olimpiada avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

libtexprintf's Issues

maintainer-clean fails on mac-os

CI fails on mac-os with the following log:
8_Clean.txt

Not sure why and I have no mac to reproduce. Error first came up after updating the README, so it seems the problem comes from a change in build environment, rather than a change in libtexprintf itself.

New release?

There are several commits that are not yet in a new release. Is it worth to make a new release with them?

Use Unicode subscripts/superscripts where available?

Currently t_0 renders as

t
 0

However, Unicode has a 0 subscript character, so it could render more cleanly as t₀.

In general, if a subscript or superscript consists entirely of characters available as such in Unicode, it would be nice to render them that way (with the current behavior as a fallback for characters lacking Unicode sub/superscripts).

The available Unicode superscripts are ²³¹ʰʲʳʷʸˡˢˣᴬᴮᴰᴱᴳᴴᴵᴶᴷᴸᴹᴺᴼᴾᴿᵀᵁᵂᵃᵇᵈᵉᵍᵏᵐᵒᵖᵗᵘᵛᶜᶠᶻ⁰ⁱ⁴⁵⁶⁷⁸⁹⁺⁻⁼⁽⁾ⁿⱽꜝ and the subscripts are ᵢᵣᵤᵥ₀₁₂₃₄₅₆₇₈₉₊₋₌₍₎ₐₑₒₓₕₖₗₘₙₚₛₜⱼ

(In general, there are a lot of Unicode characters that you could potentially be using. See https://github.com/JuliaLang/julia/blob/master/stdlib/REPL/src/latex_symbols.jl for a list mapping them from LaTeX and LaTeX-like \symbols.)

Misalignment

target = \left\{
\begin{array}{ll}
cwnd                          &
\text{if } \mathrm{W_{cubic}}(t + RTT) < cwnd \\
1.5 * cwnd                    &
\text{if } \mathrm{W_{cubic}}(t + RTT) > 1.5 * cwnd \\
\mathrm{W_{cubic}}(t + RTT)   &
\text{otherwise} \\
\end{array} \right.

renders as

         ⎧
         ⎪cwnd            if  W     (t + RTT) < cwnd
         ⎪                     cubic
         ⎨1.5 * cwnd      if  W     (t + RTT) > 1.5 * cwnd
target = ⎪                     cubic
         ⎪W     (t + RTT) otherwise
         ⎩ cubic

the target = bit isn't vertically centered. Mathjax renders as follows:
Screenshot 2023-01-31 at 13 50 29

Sum not vertically centered

utftex '\\sum_{i=6}^{10}\\left[\\binom{A}{i} \\binom{L}{10-i}\\right]
produces

10
⎯⎯
╲  ⎡⎛A⎞ ⎛ L  ⎞⎤
╱  ⎢⎜ ⎟ ⎜    ⎟⎥
⎺⎺ ⎣⎝i⎠ ⎝10-i⎠⎦
i=6

Also, the bottom of the sum (⎺⎺) is using a different dash than the top (⎯⎯)?

Gui for utftex

I made a GUI using PyQt6. It should be easily translatable to PySide6. It borrows a lot of ideas from AsciiTeX.

It's designed to be made into an executable file with PyInstaller.

utftexgui.zip

Create a target for library

First, nice project! I think it would be cool to have a target on the Makefile for building as a library to be able to link to. I would like to help, but I don't know about automake neither autoconf.

v1.18 build failure on Linux & macOS

Hello 👋 . I'm a maintainer for the Homebrew project. While packaging v1.18 of utftex we are encountering a build failure:

  make[1]: Entering directory '/tmp/utftex-20230524-5877-efo77/libtexprintf-1.18/src'
  /bin/bash ./gen_errorflags.sh ./boxes.c ./drawbox.c ./lexer.c ./parser.c
  /bin/bash ./gen_errorflags.sh ./boxes.c ./drawbox.c ./lexer.c ./parser.c
  Collecting error flags from ./boxes.c
  Collecting error flags from ./boxes.c
  Collecting error flags from ./drawbox.c
  Collecting error flags from ./drawbox.c
  Collecting error flags from ./lexer.c
  Collecting error flags from ./lexer.c
  Collecting error flags from ./parser.c
  Collecting error flags from ./parser.c
  rm: cannot remove 'tmperrflags': No such file or directory
  make[1]: *** [Makefile:1079: errorflags.h] Error 1
  make[1]: Leaving directory '/tmp/utftex-20230524-5877-efo77/libtexprintf-1.18/src'
  make: *** [Makefile:674: install-recursive] Error 1

The relevant GitHub Actions run can be found here.

Relates to Homebrew/homebrew-core#131899

manpage not up to date

$ utftex "a_{utc} < a_{ntp}"
a    < aₙₜₚ
 utc

In github, you may not be able to see the subscript characters that utftex uses for the "ntp" suffix.
(Maybe just copy/paste it to something else, e.g., pbpaste in terminal.)

Even worse than the interoperability problems here is the uneven handling of "utc" and "ntp" -- of course, I know why this happens, but I'd rather have a way to completely switch off the feature that uses subscript characters.

LaTeX token don't work correctly

Stuff like \frac 1\alpha or \frac {1}\alpha, which is valid LaTeX math produce errors:

❯ utftex '\frac 1 \alpha'

ERROR: Too few mandatory arguments to command (1x)
❯ utftex '\frac{1}\alpha'
Error, string is not proper UTF-8 code
Error, string is not proper UTF-8 code
1
─

Unicode primes

t' and t'' get rendered as-is using ASCII quotes, but they could be rendered using Unicode prime characters t′ and t″.

Here are several Unicode primes.

1.17 building fails

aclocal: warning: couldn't open directory 'm4': No such file or directory
glibtoolize: putting auxiliary files in '.'.
glibtoolize: copying file './ltmain.sh'
glibtoolize: putting macros in AC_CONFIG_MACRO_DIRS, 'm4'.
glibtoolize: copying file 'm4/libtool.m4'
glibtoolize: copying file 'm4/ltoptions.m4'
glibtoolize: copying file 'm4/ltsugar.m4'
glibtoolize: copying file 'm4/ltversion.m4'
glibtoolize: copying file 'm4/lt~obsolete.m4'
glibtoolize: Consider adding '-I m4' to ACLOCAL_AMFLAGS in Makefile.am.
configure.ac:3: warning: The macro `AC_PROG_LIBTOOL' is obsolete.
configure.ac:3: You should run autoupdate.
m4/libtool.m4:100: AC_PROG_LIBTOOL is expanded from...
configure.ac:3: the top level
configure.ac:5: warning: The macro `AM_ENABLE_SHARED' is obsolete.
configure.ac:5: You should run autoupdate.
m4/ltoptions.m4:205: AM_ENABLE_SHARED is expanded from...
configure.ac:5: the top level
configure.ac:3: installing './compile'
configure.ac:3: installing './config.guess'
configure.ac:3: installing './config.sub'
configure.ac:7: installing './install-sh'
configure.ac:7: installing './missing'
configure.ac:48: error: required file 'test/mathjax_examples.tex' not found
configure.ac:70: error: required file 'test/mathjax_examples.ref' not found
configure.ac:93: error: required file 'test/mathjax_examples-A.ref' not found
parallel-tests: installing './test-driver'
src/Makefile.am: installing './depcomp'
autoreconf: error: automake failed with exit status: 1
BuildError: Failed executing: ./autogen.sh 

Switch to math from a text block

Currently libtexprintf does not support switching back to a math environment from a text block. For example:

\text{blah $math$ blah}

renders as

blag $math$ blah

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.