Skip to content

Commit aec08a1

Browse files
first commit
0 parents  commit aec08a1

12 files changed

Lines changed: 666 additions & 0 deletions

File tree

.github/workflows/CI.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: CI
2+
on:
3+
push:
4+
branches:
5+
- master
6+
tags: '*'
7+
pull_request:
8+
jobs:
9+
test:
10+
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }}
11+
runs-on: ${{ matrix.os }}
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
version:
16+
- '1.6'
17+
- 'nightly'
18+
os:
19+
- ubuntu-latest
20+
- macOS-latest
21+
- windows-latest
22+
arch:
23+
- x64
24+
- x86
25+
exclude:
26+
- os: macOS-latest
27+
arch: x86
28+
steps:
29+
- uses: actions/checkout@v2
30+
- uses: julia-actions/setup-julia@v1
31+
with:
32+
version: ${{ matrix.version }}
33+
arch: ${{ matrix.arch }}
34+
- uses: actions/cache@v1
35+
env:
36+
cache-name: cache-artifacts
37+
with:
38+
path: ~/.julia/artifacts
39+
key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }}
40+
restore-keys: |
41+
${{ runner.os }}-test-${{ env.cache-name }}-
42+
${{ runner.os }}-test-
43+
${{ runner.os }}-
44+
- uses: julia-actions/julia-buildpkg@v1
45+
- uses: julia-actions/julia-runtest@v1
46+
- uses: julia-actions/julia-processcoverage@v1
47+
- uses: codecov/codecov-action@v1
48+
with:
49+
file: lcov.info

.github/workflows/CompatHelper.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: CompatHelper
2+
on:
3+
schedule:
4+
- cron: 0 0 * * *
5+
workflow_dispatch:
6+
jobs:
7+
CompatHelper:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Pkg.add("CompatHelper")
11+
run: julia -e 'using Pkg; Pkg.add("CompatHelper")'
12+
- name: CompatHelper.main()
13+
env:
14+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
15+
COMPATHELPER_PRIV: ${{ secrets.DOCUMENTER_KEY }}
16+
run: julia -e 'using CompatHelper; CompatHelper.main()'

.github/workflows/TagBot.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: TagBot
2+
on:
3+
issue_comment:
4+
types:
5+
- created
6+
workflow_dispatch:
7+
jobs:
8+
TagBot:
9+
if: github.event_name == 'workflow_dispatch' || github.actor == 'JuliaTagBot'
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: JuliaRegistries/TagBot@v1
13+
with:
14+
token: ${{ secrets.GITHUB_TOKEN }}
15+
ssh: ${{ secrets.DOCUMENTER_KEY }}

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
*.jl.*.cov
2+
*.jl.cov
3+
*.jl.mem
4+
/Manifest.toml

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2022 José Joaquín Zubieta Rico <jjjzubiet@gmail.com> and contributors
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

Project.toml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
name = "LibTeXPrintf"
2+
uuid = "f5e74093-75df-45cb-9a4a-089f0fae2cb7"
3+
authors = ["José Joaquín Zubieta Rico <jose.zubieta@cimat.mx>"]
4+
version = "0.1.0"
5+
6+
[deps]
7+
CBinding = "d43a6710-96b8-4a2d-833c-c424785e5374"
8+
LaTeXStrings = "b964fa9f-0449-5b57-a5c2-d3ea65f4040f"
9+
LibTeXPrintf_jll = "31c4d84e-4279-5ed4-9345-4512eef47f95"
10+
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
11+
Suppressor = "fd094767-a336-5f1f-9728-57cf17d0bbfb"

README.md

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
# LibTeXPrintf
2+
3+
[![Build Status](https://github.com/Suavesito-Olimpiada/LibTeXPrintf.jl/workflows/CI/badge.svg)](https://github.com/Suavesito-Olimpiada/LibTeXPrintf.jl/actions)
4+
[![Coverage](https://codecov.io/gh/Suavesito-Olimpiada/LibTeXPrintf.jl/branch/master/graph/badge.svg)](https://codecov.io/gh/Suavesito-Olimpiada/LibTeXPrintf.jl)
5+
6+
7+
Wrapper of the library
8+
[bartp5/libtexprintf](https://github.com/bartp5/libtexprintf) for
9+
printing rendered LaTeX code in the terminal.
10+
11+
## Installation
12+
13+
To install LibTeXPrintf.jl, in the Julia REPL
14+
15+
```julia
16+
julia> using Pkg
17+
julia> Pkg.add("LibTeXPrintf")
18+
```
19+
20+
# Documentation
21+
22+
LibTeXPrintf.jl export six three functions
23+
24+
```julia
25+
texfonts()::NTuple(N, String)
26+
texgetfont()::String
27+
texsetfont(font::String)::String
28+
29+
texsymbols()::ImmutableDict{String, String}
30+
31+
stexprintf(format::String, args...)::String
32+
stexprintf(format::LaTeXString, args...; clean=true)::String
33+
34+
texprintf([io::IO], format::String, args...)
35+
texprintf([io::IO], format::LaTeXString, args...; clean=true)
36+
```
37+
38+
The documentation of every one of these can be consulted in help mode in the
39+
REPL (press `?` to change to help mode, `backspace` to exit).
40+
41+
### Format string
42+
43+
The `format` positional argument is interpreted as $\LaTeX$ code, but with the
44+
extra that format specifiers of `@printf` (or the `printf` function in the
45+
C language) are allowed inside.
46+
47+
The argument `format` can also be a `LaTeXString`, from
48+
[LaTeXStrings.jl](https://github.com/stevengj/LaTeXStrings.jl), in which case
49+
the keyword argument `clean` is present (and defaults to `true`). When
50+
`clean=true`, then format is changed into `strip(format, '$')`.
51+
52+
**Note**
53+
: If you try to print a new line character in (`'\n'`) inside a
54+
`LaTeXString`, it will error saying `ERROR: ArgumentError: Unknown command
55+
(1x)`. This is because LaTeXStrings.jl escapes the string from `"\n"` to
56+
`"\\n"` and when libtexprintf sees it, it looks like a LaTeX command, just
57+
not one that it knows about.
58+
59+
There is also the problem that libtexprintf will actually just **ignore**
60+
all the new line characters (`'\n'`).
61+
62+
## Examples
63+
64+
```julia
65+
julia> using LibTeXPrintf
66+
67+
julia> using LaTeXStrings
68+
69+
julia> texprintf("\\\\frac{1}{%d}", 2)
70+
1
71+
72+
2
73+
74+
julia> texprintf("\\\\sum_{i=0}^{10}{%c}^2", 'i')
75+
10
76+
⎯⎯
77+
2
78+
╱ i
79+
⎺⎺
80+
i=0
81+
82+
julia> texsetfont("mathbb")
83+
"mathbb"
84+
85+
julia> texprintf("This is a LaTeX string.")
86+
𝕋𝕙𝕚𝕤 𝕚𝕤 𝕒 𝕃𝕒𝕋𝕖𝕏 𝕤𝕥𝕣𝕚𝕟𝕘.
87+
88+
julia> texsetfont("text")
89+
"text"
90+
91+
julia> texprintf("This is a LaTeX string.")
92+
"This is a LaTeX string."
93+
```
94+

0 commit comments

Comments
 (0)