glebm / katex-ruby Goto Github PK
View Code? Open in Web Editor NEWRenders KaTeX from Ruby.
License: MIT License
Renders KaTeX from Ruby.
License: MIT License
I use a jekyll setup to configure my blog hostet on github pages. I used bundel to install jekyll and a header extension to add the katex support for ruby. Is it possible to load any kind of packages for example 'graphicx'? I want to use the figure environment to add some images-files to my blog post.
My _config.yaml looks like this:
# Welcome to Jekyll!
#
# This config file is meant for settings that affect your whole blog, values
# which you are expected to set up once and rarely edit after that. If you find
# yourself editing this file very often, consider using Jekyll's data files
# feature for the data you need to update frequently.
#
# For technical reasons, this file is *NOT* reloaded automatically when you use
# 'bundle exec jekyll serve'. If you change this file, please restart the server process.
#
# If you need help with YAML syntax, here are some quick references for you:
# https://learn-the-web.algonquindesign.ca/topics/markdown-yaml-cheat-sheet/#yaml
# https://learnxinyminutes.com/docs/yaml/
#
# Site settings
# These are used to personalize your new site. If you look in the HTML files,
# you will see them accessed via {{ site.title }}, {{ site.email }}, and so on.
# You can create any custom variable you would like, and they will be accessible
# in the templates via {{ site.myvariable }}.
title: 'DS - A data scientist blog by Nils Paffen'
email: '[email protected]'
disqus: 'Data meets science'
google_analytics: '
author: 'Nils Paffen'
email: '[email protected]'
avatar: 'Foto_CV.jpg'
description:
url: "" # the base hostname & protocol for your site, e.g. http://example.com
github_username: Npaffen
remote_theme: ngzhio/jekyll-theme-hamilton
kramdown:
math_engine: katex
header-includes:
- \usepackage{graphicx}
# Build settings
plugins:
- jekyll-remote-theme
# Exclude from processing.
# The following items will not be processed, by default.
# Any item listed under the `exclude:` key here will be automatically added to
# the internal "default list".
#
# Excluded items can be processed by explicitly listing the directories or
# their entries' file path in the `include:` list.
#
# exclude:
# - .sass-cache/
# - .jekyll-cache/
# - gemfiles/
# - Gemfile
# - Gemfile.lock
# - node_modules/
# - vendor/bundle/
# - vendor/cache/
# - vendor/gems/
# - vendor/ruby/
My head.html looks like this :
<head>
<link rel="stylesheet" media="none" onload="media='all'" href="https://cdn[...]/katex.min.css">
<script defer src="https://cdn[...]/katex.min.js"></script>
<script defer src="https://cdn[...]/contrib/mathtex-script-type.min.js"></script>
</head>
My actual code I use in my blog-posts looks like this :
$$ \begin{figure} \includegraphics[]{./_site/assets/unnamed-chunk-1-1,pdf} \caption{The Effect of School Reforms on Educational Attainment} \floatfoot{The OLS gender-specififc regressions included a constant, country dummies, q, q2 and their interactions with country dummies and the GDP per head at the age when the pupil would have finished compulsory schooling.} \end{figure} $$
As you can see, here at the bottom of the page, this produces the following error "'Unknown environment 'figure'". Is there any way to fix this?
KaTeX had released version 0.12.0, and add some features like display mode support for MathML.
https://github.com/KaTeX/KaTeX/releases/tag/v0.12.0
Please help if possible.
First of all, thank you for creating this initiative! It looks the most promising for our the ruby/rails environment. I am looking forward to see if there is any option to use the auto-render extension or if there any plan to built one in ruby. My main problem using Katex with a possible auto-render alternative is finding the appropriate regex to identify all the possible LATEX code in a given string.
Any guidance how I could accomplish this would be appreciated. In case there is not such a possibility, I am more than happy to start a possible collaboration to include this option in katex-ruby
.
I have installed the gem katex-0.3.0
which supposedly bundles the stable KaTeX v0.8.3, but it has a disappearing fraction line issue that does not occur in the official KaTeX v0.8.3 release. The vendor/katex.js
seems to be minified, but it differs from the official katex.min.js
. How do those discrepancies arise?
Hi,
when using in SLIM-File(x = any sting):
td= Katex.render(x)
Ruby: 3.0.0p0
Rails: 6.1.3
Nodejs: 14.16.0
i get:
no implicit conversion of Hash into Integer
execjs (2.7.0) lib/execjs/external_runtime.rb:176:in initialize' execjs (2.7.0) lib/execjs/external_runtime.rb:176:in
open'
execjs (2.7.0) lib/execjs/external_runtime.rb:176:in exec_runtime' execjs (2.7.0) lib/execjs/external_runtime.rb:39:in
exec'
execjs (2.7.0) lib/execjs/external_runtime.rb:14:in initialize' execjs (2.7.0) lib/execjs/runtime.rb:57:in
new'
execjs (2.7.0) lib/execjs/runtime.rb:57:in compile' katex (0.6.1) lib/katex.rb:56:in
block in katex_context'
katex (0.6.1) lib/katex.rb:55:in synchronize' katex (0.6.1) lib/katex.rb:55:in
katex_context'
katex (0.6.1) lib/katex.rb:32:in render' app/views/welcome/formulas.html.slim:14 app/views/welcome/formulas.html.slim:11:in
each'
app/views/welcome/formulas.html.slim:11
app/views/welcome/formulas.html.slim:9:in each' app/views/welcome/formulas.html.slim:9 actionview (6.1.3) lib/action_view/base.rb:247:in
public_send'
actionview (6.1.3) lib/action_view/base.rb:247:in _run' actionview (6.1.3) lib/action_view/template.rb:154:in
block in render'
activesupport (6.1.3) lib/active_support/notifications.rb:205:in instrument' actionview (6.1.3) lib/action_view/template.rb:345:in
instrument_render_template'
actionview (6.1.3) lib/action_view/template.rb:152:in render' actionview (6.1.3) lib/action_view/renderer/template_renderer.rb:61:in
block (2 levels) in render_template'
activesupport (6.1.3) lib/active_support/notifications.rb:203:in block in instrument' activesupport (6.1.3) lib/active_support/notifications/instrumenter.rb:24:in
instrument'
activesupport (6.1.3) lib/active_support/notifications.rb:203:in instrument' actionview (6.1.3) lib/action_view/renderer/template_renderer.rb:56:in
block in render_template'
actionview (6.1.3) lib/action_view/renderer/template_renderer.rb:71:in block in render_with_layout' activesupport (6.1.3) lib/active_support/notifications.rb:203:in
block in instrument'
activesupport (6.1.3) lib/active_support/notifications/instrumenter.rb:24:in instrument' activesupport (6.1.3) lib/active_support/notifications.rb:203:in
instrument'
actionview (6.1.3) lib/action_view/renderer/template_renderer.rb:70:in render_with_layout' actionview (6.1.3) lib/action_view/renderer/template_renderer.rb:55:in
render_template'
actionview (6.1.3) lib/action_view/renderer/template_renderer.rb:11:in render' actionview (6.1.3) lib/action_view/renderer/renderer.rb:61:in
render_template_to_object'
actionview (6.1.3) lib/action_view/renderer/renderer.rb:29:in render_to_object' actionview (6.1.3) lib/action_view/rendering.rb:117:in
block in _render_template'
actionview (6.1.3) lib/action_view/base.rb:273:in in_rendering_context' actionview (6.1.3) lib/action_view/rendering.rb:116:in
_render_template'
actionpack (6.1.3) lib/action_controller/metal/streaming.rb:218:in _render_template' actionview (6.1.3) lib/action_view/rendering.rb:103:in
render_to_body'
actionpack (6.1.3) lib/action_controller/metal/rendering.rb:52:in render_to_body' actionpack (6.1.3) lib/action_controller/metal/renderers.rb:142:in
render_to_body'
actionpack (6.1.3) lib/abstract_controller/rendering.rb:25:in render' actionpack (6.1.3) lib/action_controller/metal/rendering.rb:36:in
render'
actionpack (6.1.3) lib/action_controller/metal/instrumentation.rb:46:in block (2 levels) in render' C:/Ruby30-x64/lib/ruby/3.0.0/benchmark.rb:308:in
realtime'
activesupport (6.1.3) lib/active_support/core_ext/benchmark.rb:14:in ms' actionpack (6.1.3) lib/action_controller/metal/instrumentation.rb:46:in
block in render'
actionpack (6.1.3) lib/action_controller/metal/instrumentation.rb:86:in cleanup_view_runtime' activerecord (6.1.3) lib/active_record/railties/controller_runtime.rb:34:in
cleanup_view_runtime'
actionpack (6.1.3) lib/action_controller/metal/instrumentation.rb:45:in render' actionpack (6.1.3) lib/action_controller/metal/implicit_render.rb:35:in
default_render'
actionpack (6.1.3) lib/action_controller/metal/basic_implicit_render.rb:6:in block in send_action' <internal:kernel>:90:in
tap'
actionpack (6.1.3) lib/action_controller/metal/basic_implicit_render.rb:6:in send_action' actionpack (6.1.3) lib/abstract_controller/base.rb:228:in
process_action'
actionpack (6.1.3) lib/action_controller/metal/rendering.rb:30:in process_action' actionpack (6.1.3) lib/abstract_controller/callbacks.rb:42:in
block in process_action'
activesupport (6.1.3) lib/active_support/callbacks.rb:117:in block in run_callbacks' actiontext (6.1.3) lib/action_text/rendering.rb:20:in
with_renderer'
actiontext (6.1.3) lib/action_text/engine.rb:55:in block (4 levels) in <class:Engine>' activesupport (6.1.3) lib/active_support/callbacks.rb:126:in
instance_exec'
activesupport (6.1.3) lib/active_support/callbacks.rb:126:in block in run_callbacks' activesupport (6.1.3) lib/active_support/callbacks.rb:137:in
run_callbacks'
actionpack (6.1.3) lib/abstract_controller/callbacks.rb:41:in process_action' actionpack (6.1.3) lib/action_controller/metal/rescue.rb:22:in
process_action'
actionpack (6.1.3) lib/action_controller/metal/instrumentation.rb:34:in block in process_action' activesupport (6.1.3) lib/active_support/notifications.rb:203:in
block in instrument'
activesupport (6.1.3) lib/active_support/notifications/instrumenter.rb:24:in instrument' activesupport (6.1.3) lib/active_support/notifications.rb:203:in
instrument'
actionpack (6.1.3) lib/action_controller/metal/instrumentation.rb:33:in process_action' actionpack (6.1.3) lib/action_controller/metal/params_wrapper.rb:249:in
process_action'
activerecord (6.1.3) lib/active_record/railties/controller_runtime.rb:27:in process_action' actionpack (6.1.3) lib/abstract_controller/base.rb:165:in
process'
actionview (6.1.3) lib/action_view/rendering.rb:39:in process' actionpack (6.1.3) lib/action_controller/metal.rb:190:in
dispatch'
actionpack (6.1.3) lib/action_controller/metal.rb:254:in dispatch' actionpack (6.1.3) lib/action_dispatch/routing/route_set.rb:50:in
dispatch'
actionpack (6.1.3) lib/action_dispatch/routing/route_set.rb:33:in serve' actionpack (6.1.3) lib/action_dispatch/journey/router.rb:50:in
block in serve'
actionpack (6.1.3) lib/action_dispatch/journey/router.rb:32:in each' actionpack (6.1.3) lib/action_dispatch/journey/router.rb:32:in
serve'
actionpack (6.1.3) lib/action_dispatch/routing/route_set.rb:842:in call' rack (2.2.3) lib/rack/tempfile_reaper.rb:15:in
call'
rack (2.2.3) lib/rack/etag.rb:27:in call' rack (2.2.3) lib/rack/conditional_get.rb:27:in
call'
rack (2.2.3) lib/rack/head.rb:12:in call' actionpack (6.1.3) lib/action_dispatch/http/permissions_policy.rb:22:in
call'
actionpack (6.1.3) lib/action_dispatch/http/content_security_policy.rb:18:in call' rack (2.2.3) lib/rack/session/abstract/id.rb:266:in
context'
rack (2.2.3) lib/rack/session/abstract/id.rb:260:in call' actionpack (6.1.3) lib/action_dispatch/middleware/cookies.rb:689:in
call'
activerecord (6.1.3) lib/active_record/migration.rb:601:in call' actionpack (6.1.3) lib/action_dispatch/middleware/callbacks.rb:27:in
block in call'
activesupport (6.1.3) lib/active_support/callbacks.rb:98:in run_callbacks' actionpack (6.1.3) lib/action_dispatch/middleware/callbacks.rb:26:in
call'
actionpack (6.1.3) lib/action_dispatch/middleware/executor.rb:14:in call' actionpack (6.1.3) lib/action_dispatch/middleware/actionable_exceptions.rb:18:in
call'
actionpack (6.1.3) lib/action_dispatch/middleware/debug_exceptions.rb:29:in call' web-console (4.1.0) lib/web_console/middleware.rb:132:in
call_app'
web-console (4.1.0) lib/web_console/middleware.rb:28:in block in call' web-console (4.1.0) lib/web_console/middleware.rb:17:in
catch'
web-console (4.1.0) lib/web_console/middleware.rb:17:in call' actionpack (6.1.3) lib/action_dispatch/middleware/show_exceptions.rb:33:in
call'
railties (6.1.3) lib/rails/rack/logger.rb:37:in call_app' railties (6.1.3) lib/rails/rack/logger.rb:26:in
block in call'
activesupport (6.1.3) lib/active_support/tagged_logging.rb:99:in block in tagged' activesupport (6.1.3) lib/active_support/tagged_logging.rb:37:in
tagged'
activesupport (6.1.3) lib/active_support/tagged_logging.rb:99:in tagged' railties (6.1.3) lib/rails/rack/logger.rb:26:in
call'
sprockets-rails (3.2.2) lib/sprockets/rails/quiet_assets.rb:13:in call' actionpack (6.1.3) lib/action_dispatch/middleware/remote_ip.rb:81:in
call'
actionpack (6.1.3) lib/action_dispatch/middleware/request_id.rb:26:in call' rack (2.2.3) lib/rack/method_override.rb:24:in
call'
rack (2.2.3) lib/rack/runtime.rb:22:in call' activesupport (6.1.3) lib/active_support/cache/strategy/local_cache_middleware.rb:29:in
call'
actionpack (6.1.3) lib/action_dispatch/middleware/executor.rb:14:in call' actionpack (6.1.3) lib/action_dispatch/middleware/static.rb:24:in
call'
rack (2.2.3) lib/rack/sendfile.rb:110:in call' actionpack (6.1.3) lib/action_dispatch/middleware/host_authorization.rb:98:in
call'
rack-mini-profiler (2.3.1) lib/mini_profiler/profiler.rb:373:in call' webpacker (5.2.1) lib/webpacker/dev_server_proxy.rb:25:in
perform_request'
rack-proxy (0.6.5) lib/rack/proxy.rb:57:in call' railties (6.1.3) lib/rails/engine.rb:539:in
call'
puma (5.2.2) lib/puma/configuration.rb:248:in call' puma (5.2.2) lib/puma/request.rb:76:in
block in handle_request'
puma (5.2.2) lib/puma/thread_pool.rb:337:in with_force_shutdown' puma (5.2.2) lib/puma/request.rb:75:in
handle_request'
puma (5.2.2) lib/puma/server.rb:431:in process_client' puma (5.2.2) lib/puma/thread_pool.rb:145:in
block in spawn_thread'
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.