-
-
Notifications
You must be signed in to change notification settings - Fork 59
Closed
Description
I wrote a package which defines some functions and constant tables. I am using Weave.jl on it from a file in the test folder to generate a PDF output. The Weave half is now working great (besides this Weave issue). However, I am getting a strange error now when I try to load my package with using KM620 on the line latexify(select(coefficients_table_forprinting, 1)).
julia> using KM620
[ Info: Precompiling KM620 [0ccbab1c-04f8-4773-914b-89ad8e9d3a96]
ERROR: LoadError: AssertionError: latexify does not support objects of type DataFrames.DataFrame.
Stacktrace:
[1] _latexraw(args::DataFrames.DataFrame; kwargs::Base.Pairs{Symbol, Symbol, Tuple{Symbol}, NamedTuple{(:env,), Tuple{Symbol}}})
@ Latexify C:\Users\nboyer.AIP\.julia\packages\Latexify\2QVWl\src\latexraw.jl:109
[2] process_latexify(args::DataFrames.DataFrame; kwargs::Base.Pairs{Symbol, Symbol, Tuple{Symbol}, NamedTuple{(:env,), Tuple{Symbol}}})
@ Latexify C:\Users\nboyer.AIP\.julia\packages\Latexify\2QVWl\src\latexify_function.jl:49
[3] _latexinline(x::DataFrames.DataFrame; kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ Latexify C:\Users\nboyer.AIP\.julia\packages\Latexify\2QVWl\src\latexinline.jl:4
[4] _latexinline(x::DataFrames.DataFrame)
@ Latexify C:\Users\nboyer.AIP\.julia\packages\Latexify\2QVWl\src\latexinline.jl:3
[5] process_latexify(args::DataFrames.DataFrame; kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ Latexify C:\Users\nboyer.AIP\.julia\packages\Latexify\2QVWl\src\latexify_function.jl:49
[6] process_latexify
@ C:\Users\nboyer.AIP\.julia\packages\Latexify\2QVWl\src\latexify_function.jl:40 [inlined]
[7] latexify(args::DataFrames.DataFrame; kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ Latexify C:\Users\nboyer.AIP\.julia\packages\Latexify\2QVWl\src\latexify_function.jl:27
[8] latexify(args::DataFrames.DataFrame)
@ Latexify C:\Users\nboyer.AIP\.julia\packages\Latexify\2QVWl\src\latexify_function.jl:25
[9] top-level scope
@ s:\Julia\KM620\src\KM620_.jl:153
[10] include(mod::Module, _path::String)
@ Base .\Base.jl:419
[11] include(x::String)
@ KM620 s:\Julia\KM620\src\KM620.jl:1
[12] top-level scope
@ s:\Julia\KM620\src\KM620.jl:5
[13] include
@ .\Base.jl:419 [inlined]
[14] include_package_for_output(pkg::Base.PkgId, input::String, depot_path::Vector{String}, dl_load_path::Vector{String}, load_path::Vector{String}, concrete_deps::Vector{Pair{Base.PkgId, UInt64}}, source::Nothing)
@ Base .\loading.jl:1554
[15] top-level scope
@ stdin:1
in expression starting at s:\Julia\KM620\src\KM620_.jl:153
in expression starting at s:\Julia\KM620\src\KM620.jl:1
in expression starting at stdin:1
ERROR: Failed to precompile KM620 [0ccbab1c-04f8-4773-914b-89ad8e9d3a96] to C:\Users\nboyer.AIP\.julia\compiled\v1.8\KM620\jl_D268.tmp.
Stacktrace:
[1] error(s::String)
@ Base .\error.jl:35
[2] compilecache(pkg::Base.PkgId, path::String, internal_stderr::IO, internal_stdout::IO, keep_loaded_modules::Bool)
@ Base .\loading.jl:1707
[3] compilecache
@ .\loading.jl:1651 [inlined]
[4] _require(pkg::Base.PkgId)
@ Base .\loading.jl:1337
[5] _require_prelocked(uuidkey::Base.PkgId)
@ Base .\loading.jl:1200
[6] macro expansion
@ .\loading.jl:1180 [inlined]
[7] macro expansion
@ .\lock.jl:223 [inlined]
[8] require(into::Module, mod::Symbol)
@ Base .\loading.jl:1144
[9] eval
@ .\boot.jl:368 [inlined]
[10] eval
@ .\Base.jl:65 [inlined]
[11] repleval(m::Module, code::Expr, #unused#::String)
@ VSCodeServer c:\Users\nboyer.AIP\.vscode\extensions\julialang.language-julia-1.38.2\scripts\packages\VSCodeServer\src\repl.jl:222
[12] (::VSCodeServer.var"#107#109"{Module, Expr, REPL.LineEditREPL, REPL.LineEdit.Prompt})()
@ VSCodeServer c:\Users\nboyer.AIP\.vscode\extensions\julialang.language-julia-1.38.2\scripts\packages\VSCodeServer\src\repl.jl:186
[13] with_logstate(f::Function, logstate::Any)
@ Base.CoreLogging .\logging.jl:511
[14] with_logger
@ .\logging.jl:623 [inlined]
[15] (::VSCodeServer.var"#106#108"{Module, Expr, REPL.LineEditREPL, REPL.LineEdit.Prompt})()
@ VSCodeServer c:\Users\nboyer.AIP\.vscode\extensions\julialang.language-julia-1.38.2\scripts\packages\VSCodeServer\src\repl.jl:187
[16] #invokelatest#2
@ .\essentials.jl:729 [inlined]
[17] invokelatest(::Any)
@ Base .\essentials.jl:726
[18] macro expansion
@ c:\Users\nboyer.AIP\.vscode\extensions\julialang.language-julia-1.38.2\scripts\packages\VSCodeServer\src\eval.jl:34 [inlined]
[19] (::VSCodeServer.var"#61#62")()
@ VSCodeServer .\task.jl:484That line works fine when I run it in the REPL, so I don't understand why Latexify is telling me it does not support objects of type DataFrame.
julia> using DataFrames, Latexify
julia> latexify(DataFrame(rand(3,4),:auto))
x1 x2 x3 x4
–––––––––––––––––– –––––––––––––––––––– ––––––––––––––––––– –––––––––––––––––––
0.8658906011977824 0.6204746003853868 0.39250644150930447 0.37950442125717754
0.5553908465185704 0.8889941959270957 0.5758401699700543 0.8393666305977396
0.4058410795595282 0.039306811749924675 0.39328115552984155 0.2908121260497748julia> using DataFrames, Latexify, LaTeXStrings
julia> const coefficients_table_forprinting = DataFrame(
"Material" => [L"Ferritic\ steel",
L"Austenitic\ stainless\ steel\ and\ nickel\-based\ alloys",
L"Duplex\ stainless\ steel",
L"Precipitation\ hardening,\ nickel\ based",
L"Aluminum",
L"Copper",
L"Titanium\ and\ zirconium"],
"Max. Temp. (°F)" => [900,
900,
900,
1000,
250,
150,
500],
L"m_2" => [:(0.60 * (1.00 - R)),
:(0.75 * (1.00 - R)),
:(0.70 * (0.95 - R)),
:(1.09 * (0.93 - R)),
:(0.52 * (0.98 - R)),
:(0.50 * (1.00 - R)),
:(0.50 * (0.98 - R))],
L"m_3" => [:(2*log(1+(El/100))),
:(3*log(1+(El/100))),
:(2*log(1+(El/100))),
:(1*log(1+(El/100))),
:(1.3*log(1+(El/100))),
:(2*log(1+(El/100))),
:(1.3*log(1+(El/100)))],
L"m_4" => [:(log(100 / (100 - RA))),
:(log(100 / (100 - RA))),
:(log(100 / (100 - RA))),
:(log(100 / (100 - RA))),
:(log(100 / (100 - RA))),
:(log(100 / (100 - RA))),
:(log(100 / (100 - RA)))],
L"m_5" => [2.2,
0.6,
2.2,
2.2,
2.2,
2.2,
2.2],
L"\epsilon_p" => [2.0E-5,
2.0E-5,
2.0E-5,
2.0E-5,
5.0E-6,
5.0E-6,
2.0E-5])
7×7 DataFrame
Row │ Material Max. Temp. (°F) $m_2$ $m_3$ $m_4$ $m_5$ $\\epsilon_p$
│ LaTeXStr… Int64 Expr Expr Expr Float64 Float64
─────┼───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
1 │ $Ferritic\\ steel$ 900 0.6 * (1.0 - R) 2 * log(1 + El / 100) log(100 / (100 - RA)) 2.2 2.0e-5
2 │ $Austenitic\\ stainless\\ steel\… 900 0.75 * (1.0 - R) 3 * log(1 + El / 100) log(100 / (100 - RA)) 0.6 2.0e-5
3 │ $Duplex\\ stainless\\ steel$ 900 0.7 * (0.95 - R) 2 * log(1 + El / 100) log(100 / (100 - RA)) 2.2 2.0e-5
4 │ $Precipitation\\ hardening,\\ ni… 1000 1.09 * (0.93 - R) 1 * log(1 + El / 100) log(100 / (100 - RA)) 2.2 2.0e-5
5 │ $Aluminum$ 250 0.52 * (0.98 - R) 1.3 * log(1 + El / 100) log(100 / (100 - RA)) 2.2 5.0e-6
6 │ $Copper$ 150 0.5 * (1.0 - R) 2 * log(1 + El / 100) log(100 / (100 - RA)) 2.2 5.0e-6
7 │ $Titanium\\ and\\ zirconium$ 500 0.5 * (0.98 - R) 1.3 * log(1 + El / 100) log(100 / (100 - RA)) 2.2 2.0e-5
julia> latexify(select(coefficients_table_forprinting, 1))
Material
––––––––––––––––––––––––––––––––––––––––––––––––––––––––
Ferritic\ steel
Austenitic\ stainless\ steel\ and\ nickel\-based\ alloys
Duplex\ stainless\ steel
Precipitation\ hardening,\ nickel\ based
Aluminum
Copper
Titanium\ and\ zirconiumI initially tried to use @latexdefine in front of the DataFrame definition instead of calling latexify separately later, but that yielded a different error.
julia> using KM620
[ Info: Precompiling KM620 [0ccbab1c-04f8-4773-914b-89ad8e9d3a96]
ERROR: LoadError: Latexify.jl's latexoperation does not know what to do with one of the
expressions provided (:("0.6 \\cdot \\left( 1.0 - R \\right)"))Again, everything runs perfectly fine when I run weave on the file.
using DataFrames, Latexify, LaTeXStrings, Weave
set_chunk_defaults!(:echo => false)
weave("src/KM620_.jl"; doctype = "md2pdf", out_path = "KM620.pdf")Metadata
Metadata
Assignees
Labels
No labels