Quarto and hypothesis

I hope you are well. I am using Quartro & RStudio to develop a document. My question is, how would I be able to create a referenceable Hypothesis similar to the native functionality of theorems (see here).

I tried using a .lua file but it didn't work.


local hypothesis_counter = 1
local hypothesis_label = "Hypothesis" 

function Div(div)
  if div.classes[1] == "hypothesis" then
    local title = div.content[1].text
    local description = div.content[2].text -- Extract description text

    -- Construct the single-line content
    local content = pandoc.Strong(hypothesis_label .. " " .. hypothesis_counter .. ": ")
    content:insert(pandoc.Space())
    content:insert(pandoc.Span(title)) 
    content:insert(pandoc.Space())
    content:insert(pandoc.Span(description))

    -- Replace the div content with the single-line version
    div.content = {content}

    hypothesis_counter = hypothesis_counter + 1
  end
  return div
end

Possibly custom float can help you here

You should try it and share if this does not work as you expect.

(BTW sorry for the delay on this question)

I did try that approach, but it doesn't have the desired effect. I want the hypothesis to generate in the following fashion:

Hypothesis 1 (Density Dependence): As organisations increase the mortality hazard increases.

I want the:

  • Prefix hypothesis to be bolded
  • Have a sequential number
  • Have a descriptor in brackets
  • Then have the actual hypothesis.

The way the theorems work is perfect, but it has the incorrect label.

Apologies for the delayed reply, I have been absent for a few months.