Losing equations numbering when I render quarto document to word - equation

I am losing equations numbering when I render quarto documents to word. This is what I have in my YAML metadata:
---
title: XXX
#author: "wananchi"
date: "`r Sys.Date()`"
format:
docx:
fontfamily: libertinus
fontsize: 11pt
spacing: double
toc: false
number-sections: true
editor: visual
bibliography: citations.bib
csl: apa.csl
---
And this is an example of one of my equations:
$$
ES_{w,t} = \varepsilon_wEP_{w,t}\tag{1}
$$
What could be the issue? I don't experience the problem when I render to pdf.
I tried using the code I specified above and seems like it's not working.

The equation numbering with \tag works for pdf output format, because \tag is a latex command, and with the help of MathJax, \tag also works for html output format, But it does not works for word document.
Therefore, instead of using \tag, use #eq- label immediately after an equation to not only enable equation numbering for this equation but also make it cross referencable and it will work across different formats. Read this section from Quarto docs for a detailed example.
---
title: XXX
author: "wananchi"
date: "`r Sys.Date()`"
format:
docx:
fontfamily: libertinus
fontsize: 11pt
toc: false
number-sections: true
# editor: visual
# bibliography: citations.bib
# csl: apa.csl
---
$$
ES_{w,t} = \varepsilon_wEP_{w,t}\
$${#eq-test}

Related

How to format multiqc config file to get two different part from the same module in yaml config file?

How to format multiqc config file to get two part in HTML corresponding to two cutadapt different reports with yaml config file?
I tried different ways especially the use of files_list option. Here is my config file:
extra_fn_clean_exts:
- _R1
- _R2
subtitle: 'test'
top_modules:
- 'custom_content'
- 'fastqc'
- 'cutadapt'
files_list:
- path: '*-summary-A-primer-report.txt'
label: 'A Primer Selection Report'
color: '#f00'
- path: '*-summary-B-primer-report.txt'
label: 'B Primer Selection Report'
color: '#00f'
table_columns_visible:
FastQC:
total_sequences: True
percent_duplicates: True
percent_gc: False
avg_sequence_length: True
percent_fails: False
I got no error however it gives me only one cutadapt report within HTML final file

Need the output of a chunk but need to put eval = FALSE to render in Quarto with R

I'm trying to render a quarto document to a HTML page with GitHub R Studio. The code include several plots and a single DT table as show in the following code, however in order to render without errors I need to use #| eval: false which by default doesn't allow the table to show in the final HTML page and I need the table to show.
I think it might be a problem with {dplyr}, but I've remove and reinstall the packages several times and it's not working.
#| label: tabla-felino
#| eval: false
x |>
select(a,b,c) |>
datatable(options = list(
pageLength = 5,
language = list(url = '//cdn.datatables.net/plug-ins/1.10.11/i18n/Spanish.json')))
The error I get is:
Quitting from lines 169-181 (index.qmd)
Error in crosstalk::is.SharedData(data) :
objeto 'x' no encontrado
Calls: .main ... eval_with_user_handlers -> eval -> eval -> datatable ->
However, the object x is properly in the environment.
I've tried using
#| output: true
#| include: true
#| echo: true
#| eval: false
But, as eval do not show the output it doesn't work.
I truly appreciate the help, thanks!

How does one specify the input when using a CSV with Kur

I'm trying to feed a CSV file to Kur, but I don't know how to specify more than one column in the input without the program crashing. Here's a small example:
model:
- input:
- SepalWidthCm
- SepalLengthCm
- dense: 10
- activation: tanh
- dense: 3
- activation: tanh
name: Species
train:
data:
- csv:
path: Iris.csv
header: yes
epochs: 1000
weights: best.w
log: tutorial-log
loss:
- target: Species
name: mean_squared_error
The error:
File "/Users/bytter/.pyenv/versions/3.5.2/bin/kur", line 11, in <module>
sys.exit(main())
File "/Users/bytter/.pyenv/versions/3.5.2/lib/python3.5/site-packages/kur/__main__.py", line 269, in main
sys.exit(args.func(args) or 0)
File "/Users/bytter/.pyenv/versions/3.5.2/lib/python3.5/site-packages/kur/__main__.py", line 48, in train
func = spec.get_training_function()
File "/Users/bytter/.pyenv/versions/3.5.2/lib/python3.5/site-packages/kur/kurfile.py", line 282, in get_training_function
model = self.get_model(provider)
File "/Users/bytter/.pyenv/versions/3.5.2/lib/python3.5/site-packages/kur/kurfile.py", line 148, in get_model
self.model.build()
File "/Users/bytter/.pyenv/versions/3.5.2/lib/python3.5/site-packages/kur/model/model.py", line 282, in build
self.build_graph(input_nodes, output_nodes, network)
File "/Users/bytter/.pyenv/versions/3.5.2/lib/python3.5/site-packages/kur/model/model.py", line 356, in build_graph
for layer in node.container.build(self):
File "/Users/bytter/.pyenv/versions/3.5.2/lib/python3.5/site-packages/kur/containers/container.py", line 281, in build
self._built = list(self._build(model))
File "/Users/bytter/.pyenv/versions/3.5.2/lib/python3.5/site-packages/kur/containers/layers/placeholder.py", line 122, in _build
'Placeholder "{}" requires a shape.'.format(self.name))
kur.containers.parsing_error.ParsingError: Placeholder "..input.0" requires a shape.
Using - input: SepalWidthCm works as expected.
The problem with your approach is that Kur doesn't know how you want the inputs concatenated. Should your input become 2D tensor of dimensions (2, N) (where N is the number of data points in your CSV file), like this?
[
[SepalWidthCm_0, SepalWidthCm_1, ...],
[SepalLengthCm_0, SepalLengthCm_1, ...]
]
(N.B., that example isn't a very deep-learning friendly structure.) Or should it be combined into a tensor of dimensions (N, 2), like this?
[
[SepalWidthCm_0, SepalLengthCm_0],
[SepalWidthCm_1, SepalLengthCm_1],
...
]
Or maybe you want to apply the same operations to each column in parallel? Regardless, this problem gets a lot harder / more ambiguous to answer when your input data is multi-dimensional (e.g., instead of scalars like length or width, you have vectors or even matrices).
Instead of trying to guess what you want (and possibly getting it wrong), Kur expects each input to be a single data source, which you can then combine however you see fit.
Here are a couple ways you might want your data combined, and how to do it in Kur.
Row-wise Combination. This is the second example above, where we want to combine "rows" of CSV data into tuples, so that the input tensor has dimensionality (batchSize, 2). Then your Kur model would look like:
model:
# Define the model inputs.
- input: SepalWidthCm
- input: SepalLengthCm
# Concatenate the inputs.
- merge: concat
inputs: [SepalWidthCm, SepalLengthCm]
# Do processing on these "vectorized" inputs.
- dense: 10
- activation: tanh
- dense: 1
- activation: tanh
# Output
- output: Species
Independent Processing, and then Combining. This is the setup where you do some operations on each input column independently, and then you merge them together (potentially with some more operations afterwards). In ASCII-art, this might look like:
INPUT_1 --> dense, activation --\
+---> dense, activation --> OUTPUT
INPUT_2 --> dense, activation --/
In this case, you would have a Kur model that looks like this:
model:
# First "branch" of processing.
- input: SepalWidthCm
- dense: 10
- activation: tanh
name: WidthBranch
# Second "branch" of processing.
- input: SepalLengthCm
- dense: 10
- activation: tanh
name: LengthBranch
# Fuse things together.
- merge:
inputs: [WidthBranch, LengthBranch]
# Continue some processing
- dense: 1
- activation: tanh
# Output
- output: Species
Keep in mind that the merge layer has been around since Kur 0.3, so make sure you using a recent version.
(Disclaimer: I am the core maintainer of Kur.)

How to enable Markdown code block line numbers

I installed Markdown Preview in Sublime Text 2, and already set
"enable_highlight": true,
"enable_pygments": true,
I also set the following code in the file codehilite.py:
def __init__(self, *args, **kwargs):
# define default configs
self.config = {
'linenums': [True, "Use lines numbers. True=yes, False=no, None=auto"],
'force_linenos' : [Force, "Depreciated! Use 'linenums' instead. Force line numbers - Default: False"],
'guess_lang' : [True, "Automatic language detection - Default: True"],
'css_class' : ["codehilite",
"Set class name for wrapper <div> - Default: codehilite"],
'pygments_style' : ['default', 'Pygments HTML Formatter Style (Colorscheme) - Default: default'],
'noclasses': [True, 'Use inline styles instead of CSS classes - Default false']
}
super(CodeHiliteExtension, self).__init__(*args, **kwargs)
However, I still cannot see the line numbers in the rendered view. What extra settings are needed?
I am using Sublime Text 3 and have just installed sublime-markdown-preview and was also looking for a way to get nice coloring and linenumbers in the code-block.
The instructions https://github.com/revolunet/sublimetext-markdown-preview
describe to put the line codehilite(linenums=True) into your settings. So I use:
{
"github_mode": "gfm",
"parser": "github",
"build_action": "browser",
"enabled_extensions": [
"extra", "github",
"codehilite(guess_lang=False, pygments_style=github, linenums=True)" ]
}
in my user settings and it works.

Slidify - Slidy Framework - should it work?

This is my first day trying to use slidify.
Just wondering if the slidy option for framework should work?
I am able to generate slides using each of the other options in brackets {io2012, html5slides, shower, dzslides} however with slidy as the option, the index.html generated file has a size of 0.
---
title : Testing
framework : slidy # {io2012, html5slides, shower, dzslides, ...}
highlighter : highlight.js # {highlight.js, prettify, highlight}
hitheme : tomorrow #
widgets : [] # {mathjax, quiz, bootstrap}
mode : selfcontained # {standalone, draft}
---
(I am using an extract of the R markdown code linked to from: http://lamages.blogspot.com.au/2013/05/interactive-presentation-with-slidify.html)