diff --git a/components/katexSpan.jsx b/components/katexSpan.jsx new file mode 100644 index 0000000..bc72c0a --- /dev/null +++ b/components/katexSpan.jsx @@ -0,0 +1,24 @@ +'use client'; +import renderMathInElement from 'katex/dist/contrib/auto-render'; +import 'katex/dist/katex.min.css'; +import { useEffect, useRef } from 'react'; + +export default function KatexSpan({ text, ...delegated }) { + const katexTextRef = useRef(); + useEffect(() => { + if (katexTextRef.current) { + renderMathInElement(katexTextRef.current, { + delimiters: [ + { left: '$$', right: '$$', display: true }, + { left: '$', right: '$', display: false }, + ], + }); + } + }, [text]); + + return ( +
+ {text} +
+ ); +} diff --git a/components/option.tsx b/components/option.tsx index ca15f87..abbb9f8 100644 --- a/components/option.tsx +++ b/components/option.tsx @@ -1,11 +1,12 @@ import classNames from 'classnames'; import React from 'react'; +import KatexSpan from './katexSpan'; export interface OptionProps { ref?: React.Ref; index?: number; showIndex?: boolean; - label: string; + label: string | JSX.Element; // Allow label to be string or JSX isSelected: boolean; isCorrect: boolean; showSolution: boolean; @@ -18,15 +19,15 @@ const Option = React.forwardRef( ref ) => { const optionClasses = classNames( - 'w-full ps-4 text-gray-900 flex items-center border rounded-lg focus:outline-primaryColor transition-colors duration-300', + 'w-full ps-4 text-gray-900 flex items-center border rounded-lg focus:outline-primary transition-colors duration-300', { 'border-gray-200': !isSelected && !showSolution, 'cursor-not-allowed': showSolution, 'bg-[#1ad85f]': showSolution && isCorrect, 'border-rose-200 text-red-500': showSolution && !isCorrect, - 'border-primaryColor outline-double outline-primaryColor outline-offset-0 ring-2 ring-offset-0 ring-primary': + 'border-primary outline-double outline-primary outline-offset-0 ring-2 ring-offset-0 ring-primary': !showSolution && isSelected, - 'hover:border-primaryColor focus:border-primaryColor': !showSolution, + 'hover:border-primary focus:border-primary': !showSolution, } ); @@ -51,7 +52,9 @@ const Option = React.forwardRef( )} -
{label}
+
+ +
); diff --git a/contentOld.tsx b/contentOld.tsx index ea8d24d..e6b5cad 100644 --- a/contentOld.tsx +++ b/contentOld.tsx @@ -12,10 +12,10 @@ const chapters = [ id: '6.1', prompt: 'Both P and either L or D', options: [ - { id: 0, label: '(P · (L V D))' }, - { id: 1, label: '(P · L) V D' }, - { id: 2, label: 'P · L V D' }, - { id: 3, label: '((P · L) V D)' }, + { id: 0, label: '$ (P \\cdot (L \\vee D)) $' }, + { id: 1, label: '$ (P \\cdot L) \\vee D $' }, + { id: 2, label: '$ P \\cdot L \\vee D $' }, + { id: 3, label: '$ ((P \\cdot L) \\vee D) $' }, ], correctId: [0], answer: '', @@ -24,730 +24,730 @@ const chapters = [ id: '6.2', prompt: 'Not either not B or N', options: [ - { id: 0, label: '(B V N)' }, - { id: 1, label: 'B V N' }, - { id: 2, label: '~~B V N' }, - { id: 3, label: '~(~B V N)' }, + { id: 0, label: '$ (B \\vee N) $' }, + { id: 1, label: '$ B \\vee N $' }, + { id: 2, label: '$ \\sim\\sim B \\vee N $' }, + { id: 3, label: '$ \\sim(\\sim B \\vee N) $' }, ], correctId: [3], answer: '', }, { id: '6.3', - prompt: `You aren't either smart or filthy`, + prompt: "You aren't either smart or filthy", options: [ - { id: 0, label: '~(S V F)' }, - { id: 1, label: '~S V F' }, - { id: 2, label: '(~S V ~F)' }, - { id: 3, label: '(~S V F)' }, + { id: 0, label: '$ \\sim(S \\vee F) $' }, + { id: 1, label: '$ \\sim S \\vee F $' }, + { id: 2, label: '$ (\\sim S \\vee \\sim F) $' }, + { id: 3, label: '$ (\\sim S \\vee F) $' }, ], correctId: [0], answer: '', }, { id: '6.4', - prompt: `You aren't both not forgetful and confident`, + prompt: "You aren't both not forgetful and confident", options: [ - { id: 0, label: '(F · C)' }, - { id: 1, label: 'F · C' }, - { id: 2, label: '~(~F · C)' }, - { id: 3, label: '~~F · C' }, + { id: 0, label: '$ (F \\cdot C) $' }, + { id: 1, label: '$ F \\cdot C $' }, + { id: 2, label: '$ \\sim(\\sim F \\cdot C) $' }, + { id: 3, label: '$ \\sim\\sim F \\cdot C $' }, ], correctId: [2], answer: '', }, { id: '6.5', - prompt: `Not if not S then L`, + prompt: 'Not if not S then L', options: [ - { id: 0, label: '~(~S → L)' }, - { id: 1, label: '~~S → L' }, - { id: 2, label: 'S → L' }, - { id: 3, label: '(S → L)' }, + { id: 0, label: '$ \\sim(\\sim S \\rightarrow L) $' }, + { id: 1, label: '$ \\sim\\sim S \\rightarrow L $' }, + { id: 2, label: '$ S \\rightarrow L $' }, + { id: 3, label: '$ (S \\rightarrow L) $' }, ], correctId: [0], answer: '', }, { id: '6.6', - prompt: `Not either not C or L`, + prompt: 'Not either not C or L', options: [ - { id: 0, label: '~~C V L' }, - { id: 1, label: '(C V L)' }, - { id: 2, label: 'C V L' }, - { id: 3, label: '~(~C V L)' }, + { id: 0, label: '$ \\sim\\sim C \\vee L $' }, + { id: 1, label: '$ (C \\vee L) $' }, + { id: 2, label: '$ C \\vee L $' }, + { id: 3, label: '$ \\sim(\\sim C \\vee L) $' }, ], correctId: [3], answer: '', }, { id: '6.7', - prompt: `If you're dull then you're logical, and you're persistent`, + prompt: "If you're dull then you're logical, and you're persistent", options: [ - { id: 0, label: '(D → L) · P' }, - { id: 1, label: '(D → (L · P)' }, - { id: 2, label: '((D → L) · P)' }, - { id: 3, label: 'D → L · P' }, + { id: 0, label: '$ (D \\rightarrow L) \\cdot P $' }, + { id: 1, label: '$ (D \\rightarrow (L \\cdot P)) $' }, + { id: 2, label: '$ ((D \\rightarrow L) \\cdot P) $' }, + { id: 3, label: '$ D \\rightarrow L \\cdot P $' }, ], correctId: [2], answer: '', }, { id: '6.8', - prompt: `You're either not mean or not curious`, + prompt: "You're either not mean or not curious", options: [ - { id: 0, label: '(~M V C)' }, - { id: 1, label: '~M V ~C' }, - { id: 2, label: '(~M V ~C)' }, - { id: 3, label: '~(M V ~C)' }, + { id: 0, label: '$ (\\sim M \\vee C) $' }, + { id: 1, label: '$ \\sim M \\vee \\sim C $' }, + { id: 2, label: '$ (\\sim M \\vee \\sim C) $' }, + { id: 3, label: '$ \\sim(M \\vee \\sim C) $' }, ], correctId: [2], answer: '', }, { id: '6.9', - prompt: `You're both not bashful and not careful`, + prompt: "You're both not bashful and not careful", options: [ - { id: 0, label: '(~B · C)' }, - { id: 1, label: '~(B · ~C)' }, - { id: 2, label: '~B · ~C' }, - { id: 3, label: '(~B · ~C)' }, + { id: 0, label: '$ (\\sim B \\cdot C) $' }, + { id: 1, label: '$ \\sim(B \\cdot \\sim C) $' }, + { id: 2, label: '$ \\sim B \\cdot \\sim C $' }, + { id: 3, label: '$ (\\sim B \\cdot \\sim C) $' }, ], correctId: [3], answer: '', }, { id: '6.10', - prompt: `You aren't both charitable and frightened`, + prompt: "You aren't both charitable and frightened", options: [ - { id: 0, label: '(~C · F)' }, - { id: 1, label: '~C · F' }, - { id: 2, label: '(~C · ~F)' }, - { id: 3, label: '~(C · F)' }, + { id: 0, label: '$ (\\sim C \\cdot F) $' }, + { id: 1, label: '$ \\sim C \\cdot F $' }, + { id: 2, label: '$ (\\sim C \\cdot \\sim F) $' }, + { id: 3, label: '$ \\sim(C \\cdot F) $' }, ], correctId: [3], answer: '', }, { id: '6.11', - prompt: `If you're bright then you're cheerful, or you're powerful`, + prompt: "If you're bright then you're cheerful, or you're powerful", options: [ - { id: 0, label: '(B → (C V P))' }, - { id: 1, label: '((B → C) V P)' }, - { id: 2, label: 'B → C V P' }, - { id: 3, label: '(B → C) V P' }, + { id: 0, label: '$ (B \\rightarrow (C \\vee P)) $' }, + { id: 1, label: '$ ((B \\rightarrow C) \\vee P) $' }, + { id: 2, label: '$ B \\rightarrow C \\vee P $' }, + { id: 3, label: '$ (B \\rightarrow C) \\vee P $' }, ], correctId: [1], answer: '', }, { id: '6.12', - prompt: `Either both W and C or D`, + prompt: 'Either both W and C or D', options: [ - { id: 0, label: '((W · C) V D)' }, - { id: 1, label: '(W · (C V D))' }, - { id: 2, label: '(W · C) V D' }, - { id: 3, label: 'W · C · D' }, + { id: 0, label: '$ ((W \\cdot C) \\vee D) $' }, + { id: 1, label: '$ (W \\cdot (C \\vee D)) $' }, + { id: 2, label: '$ (W \\cdot C) \\vee D $' }, + { id: 3, label: '$ W \\cdot C \\cdot D $' }, ], correctId: [0], answer: '', }, { id: '6.13', - prompt: `If you're strong, then you're famous or courageous`, + prompt: "If you're strong, then you're famous or courageous", options: [ - { id: 0, label: 'S → F V C' }, - { id: 1, label: '((S → F) V C)' }, - { id: 2, label: '(S → (F V C))' }, - { id: 3, label: '(S → F) V C' }, + { id: 0, label: '$ S \\rightarrow F \\vee C $' }, + { id: 1, label: '$ ((S \\rightarrow F) \\vee C) $' }, + { id: 2, label: '$ (S \\rightarrow (F \\vee C)) $' }, + { id: 3, label: '$ (S \\rightarrow F) \\vee C $' }, ], correctId: [2], answer: '', }, { id: '6.14', - prompt: `Not if C then F`, + prompt: 'Not if C then F', options: [ - { id: 0, label: '(~C → F)' }, - { id: 1, label: '(~C → ~F)' }, - { id: 2, label: '~(C → F)' }, - { id: 3, label: '~C → F' }, + { id: 0, label: '$ (\\sim C \\rightarrow F) $' }, + { id: 1, label: '$ (\\sim C \\rightarrow \\sim F) $' }, + { id: 2, label: '$ \\sim(C \\rightarrow F) $' }, + { id: 3, label: '$ \\sim C \\rightarrow F $' }, ], correctId: [2], answer: '', }, { id: '6.15', - prompt: `If you're short then you're gready, or you're hideous`, + prompt: "If you're short then you're greedy, or you're hideous", options: [ - { id: 0, label: 'S → G V H' }, - { id: 1, label: '(S → G) V H' }, - { id: 2, label: '(S → (G V H))' }, - { id: 3, label: '((S → G) V H)' }, + { id: 0, label: '$ S \\rightarrow G \\vee H $' }, + { id: 1, label: '$ (S \\rightarrow G) \\vee H $' }, + { id: 2, label: '$ (S \\rightarrow (G \\vee H)) $' }, + { id: 3, label: '$ ((S \\rightarrow G) \\vee H) $' }, ], correctId: [3], answer: '', }, { id: '6.16', - prompt: `If you aren't poor then you aren't beautiful`, + prompt: "If you aren't poor then you aren't beautiful", options: [ - { id: 0, label: '~(P → ~B)' }, - { id: 1, label: '~P → ~B' }, - { id: 2, label: '(~P → ~B)' }, - { id: 3, label: '(~P V B)' }, + { id: 0, label: '$ \\sim(P \\rightarrow \\sim B) $' }, + { id: 1, label: '$ \\sim P \\rightarrow \\sim B $' }, + { id: 2, label: '$ (\\sim P \\rightarrow \\sim B) $' }, + { id: 3, label: '$ (\\sim P \\vee B) $' }, ], correctId: [2], answer: '', }, { id: '6.17', - prompt: `Either not B or L`, + prompt: 'Either not B or L', options: [ - { id: 0, label: '(~B V ~L)' }, - { id: 1, label: '~B V L' }, - { id: 2, label: '~(B V L)' }, - { id: 3, label: '(~B V L)' }, + { id: 0, label: '$ (\\sim B \\vee \\sim L) $' }, + { id: 1, label: '$ \\sim B \\vee L $' }, + { id: 2, label: '$ \\sim(B \\vee L) $' }, + { id: 3, label: '$ (\\sim B \\vee L) $' }, ], correctId: [3], answer: '', }, { id: '6.18', - prompt: `If S, then H and L`, + prompt: 'If S, then H and L', options: [ - { id: 0, label: '(S → (H · L))' }, - { id: 1, label: 'S → H · L' }, - { id: 2, label: '((S → H) · L)' }, - { id: 3, label: '(S → H) · L' }, + { id: 0, label: '$ (S \\rightarrow (H \\cdot L)) $' }, + { id: 1, label: '$ S \\rightarrow H \\cdot L $' }, + { id: 2, label: '$ ((S \\rightarrow H) \\cdot L) $' }, + { id: 3, label: '$ (S \\rightarrow H) \\cdot L $' }, ], correctId: [0], answer: '', }, { id: '6.19', - prompt: `You're tall and naive, or else dangerous`, + prompt: "You're tall and naive, or else dangerous", options: [ - { id: 0, label: '((T V N) V D)' }, - { id: 1, label: 'T · N V D' }, - { id: 2, label: '(T · N) V D' }, - { id: 3, label: '(T · (N V D))' }, + { id: 0, label: '$ ((T \\vee N) \\vee D) $' }, + { id: 1, label: '$ T \\cdot N \\vee D $' }, + { id: 2, label: '$ (T \\cdot N) \\vee D $' }, + { id: 3, label: '$ (T \\cdot (N \\vee D)) $' }, ], correctId: [0], answer: '', }, { id: '6.20', - prompt: `W, and D or S`, + prompt: 'W, and D or S', options: [ - { id: 0, label: '((W · D) V S)' }, - { id: 1, label: '(W · (D V S))' }, - { id: 2, label: '(W · D) V S' }, - { id: 3, label: 'W · D V S' }, + { id: 0, label: '$ ((W \\cdot D) \\vee S) $' }, + { id: 1, label: '$ (W \\cdot (D \\vee S)) $' }, + { id: 2, label: '$ (W \\cdot D) \\vee S $' }, + { id: 3, label: '$ W \\cdot D \\vee S $' }, ], correctId: [1], answer: '', }, { id: '6.21', - prompt: `Either not M or B`, + prompt: 'Either not M or B', options: [ - { id: 0, label: '(~M V ~B)' }, - { id: 1, label: '(~M V B)' }, - { id: 2, label: '~(M V B)' }, - { id: 3, label: '~M V B' }, + { id: 0, label: '$ (\\sim M \\vee \\sim B) $' }, + { id: 1, label: '$ (\\sim M \\vee B) $' }, + { id: 2, label: '$ \\sim(M \\vee B) $' }, + { id: 3, label: '$ \\sim M \\vee B $' }, ], correctId: [1], answer: '', }, { id: '6.22', - prompt: `Either not B or not C`, + prompt: 'Either not B or not C', options: [ - { id: 0, label: '(~B V C)' }, - { id: 1, label: '~(B V ~C)' }, - { id: 2, label: '(~B V ~C)' }, - { id: 3, label: '~B V ~C' }, + { id: 0, label: '$ (\\sim B \\vee C) $' }, + { id: 1, label: '$ \\sim(B \\vee \\sim C) $' }, + { id: 2, label: '$ (\\sim B \\vee \\sim C) $' }, + { id: 3, label: '$ \\sim B \\vee \\sim C $' }, ], correctId: [2], answer: '', }, { id: '6.23', - prompt: `If R then P, and C`, + prompt: 'If R then P, and C', options: [ - { id: 0, label: '((R → P) · C)' }, - { id: 1, label: 'R → P · C' }, - { id: 2, label: '(R → (P · C)' }, - { id: 3, label: '(R → P) · C' }, + { id: 0, label: '$ ((R \\rightarrow P) \\cdot C) $' }, + { id: 1, label: '$ R \\rightarrow P \\cdot C $' }, + { id: 2, label: '$ (R \\rightarrow (P \\cdot C)) $' }, + { id: 3, label: '$ (R \\rightarrow P) \\cdot C $' }, ], correctId: [0], answer: '', }, { id: '6.24', - prompt: `Not both R and C`, + prompt: 'Not both R and C', options: [ - { id: 0, label: '~R · C' }, - { id: 1, label: '(~R · ~C)' }, - { id: 2, label: '~(R · C)' }, - { id: 3, label: '(~R · C)' }, + { id: 0, label: '$ \\sim R \\cdot C $' }, + { id: 1, label: '$ (\\sim R \\cdot \\sim C) $' }, + { id: 2, label: '$ \\sim(R \\cdot C) $' }, + { id: 3, label: '$ (\\sim R \\cdot C) $' }, ], correctId: [2], answer: '', }, { id: '6.25', - prompt: `Either not C or N`, + prompt: 'Either not C or N', options: [ - { id: 0, label: '~C V N' }, - { id: 1, label: '~(C V N)' }, - { id: 2, label: '(~C V ~N)' }, - { id: 3, label: '(~C V N)' }, + { id: 0, label: '$ \\sim C \\vee N $' }, + { id: 1, label: '$ \\sim(C \\vee N) $' }, + { id: 2, label: '$ (\\sim C \\vee \\sim N) $' }, + { id: 3, label: '$ (\\sim C \\vee N) $' }, ], correctId: [3], answer: '', }, { id: '6.26', - prompt: `If not C then H`, + prompt: 'If not C then H', options: [ - { id: 0, label: '~C → H' }, - { id: 1, label: '(~C → H)' }, - { id: 2, label: '(~C → ~H)' }, - { id: 3, label: '~(C → H)' }, + { id: 0, label: '$ \\sim C \\rightarrow H $' }, + { id: 1, label: '$ (\\sim C \\rightarrow H) $' }, + { id: 2, label: '$ (\\sim C \\rightarrow \\sim H) $' }, + { id: 3, label: '$ \\sim(C \\rightarrow H) $' }, ], correctId: [1], answer: '', }, { id: '6.27', - prompt: `Not either not W or C`, + prompt: 'Not either not W or C', options: [ - { id: 0, label: '~~W V C' }, - { id: 1, label: 'W V C' }, - { id: 2, label: '(W V C)' }, - { id: 3, label: '~(~W V C)' }, + { id: 0, label: '$ \\sim\\sim W \\vee C $' }, + { id: 1, label: '$ W \\vee C $' }, + { id: 2, label: '$ (W \\vee C) $' }, + { id: 3, label: '$ \\sim(\\sim W \\vee C) $' }, ], correctId: [3], answer: '', }, { id: '6.28', - prompt: `Both not M and L`, + prompt: 'Both not M and L', options: [ - { id: 0, label: '(~M · L)' }, - { id: 1, label: '(~M · ~L)' }, - { id: 2, label: '~(M · L)' }, - { id: 3, label: '~M · L' }, + { id: 0, label: '$ (\\sim M \\cdot L) $' }, + { id: 1, label: '$ (\\sim M \\cdot \\sim L) $' }, + { id: 2, label: '$ \\sim(M \\cdot L) $' }, + { id: 3, label: '$ \\sim M \\cdot L $' }, ], correctId: [0], answer: '', }, { id: '6.29', - prompt: `You're both not miserable and not comical`, + prompt: "You're both not miserable and not comical", options: [ - { id: 0, label: '(~M · C)' }, - { id: 1, label: '~M · ~C' }, - { id: 2, label: '(~M · ~C)' }, - { id: 3, label: '~(M · ~C)' }, + { id: 0, label: '$ (\\sim M \\cdot C) $' }, + { id: 1, label: '$ \\sim M \\cdot \\sim C $' }, + { id: 2, label: '$ (\\sim M \\cdot \\sim C) $' }, + { id: 3, label: '$ \\sim(M \\cdot \\sim C) $' }, ], correctId: [2], answer: '', }, { id: '6.30', - prompt: `Either both R and L or N`, + prompt: 'Either both R and L or N', options: [ - { id: 0, label: '(R · (L V N)' }, - { id: 1, label: '(R · L) V N' }, - { id: 2, label: 'R · L V N' }, - { id: 3, label: '((R · L) V N)' }, + { id: 0, label: '$ (R \\cdot (L \\vee N)) $' }, + { id: 1, label: '$ (R \\cdot L) \\vee N $' }, + { id: 2, label: '$ R \\cdot L \\vee N $' }, + { id: 3, label: '$ ((R \\cdot L) \\vee N) $' }, ], correctId: [3], answer: '', }, { id: '6.31', - prompt: `If you're bright, then you're polite or demented`, + prompt: "If you're bright, then you're polite or demented", options: [ - { id: 0, label: '(B → P) V D' }, - { id: 1, label: 'B → P V D' }, - { id: 2, label: '((B → P) V D)' }, - { id: 3, label: '(B → (P V D))' }, + { id: 0, label: '$ (B \\rightarrow P) \\vee D $' }, + { id: 1, label: '$ B \\rightarrow P \\vee D $' }, + { id: 2, label: '$ ((B \\rightarrow P) \\vee D) $' }, + { id: 3, label: '$ (B \\rightarrow (P \\vee D)) $' }, ], correctId: [3], answer: '', }, { id: '6.32', - prompt: `If you're smart, then you're bashful and careful`, + prompt: "If you're smart, then you're bashful and careful", options: [ - { id: 0, label: '(S → (B · C)' }, - { id: 1, label: '((S → B) · C)' }, - { id: 2, label: '(S → B) · C' }, - { id: 3, label: 'S → B · C' }, + { id: 0, label: '$ (S \\rightarrow (B \\cdot C)) $' }, + { id: 1, label: '$ ((S \\rightarrow B) \\cdot C) $' }, + { id: 2, label: '$ (S \\rightarrow B) \\cdot C $' }, + { id: 3, label: '$ S \\rightarrow B \\cdot C $' }, ], correctId: [0], answer: '', }, { id: '6.33', - prompt: `You're cheap and frivolous, or else generous`, + prompt: "You're cheap and frivolous, or else generous", options: [ - { id: 0, label: '((C · F) V G)' }, - { id: 1, label: 'C · F V G' }, - { id: 2, label: '(C · (F V G))' }, - { id: 3, label: '(C · F) V G' }, + { id: 0, label: '$ ((C \\cdot F) \\vee G) $' }, + { id: 1, label: '$ C \\cdot F \\vee G $' }, + { id: 2, label: '$ (C \\cdot (F \\vee G)) $' }, + { id: 3, label: '$ (C \\cdot F) \\vee G $' }, ], correctId: [0], answer: '', }, { id: '6.34', - prompt: `You're either both wild and gentle or else cheerful`, + prompt: "You're either both wild and gentle or else cheerful", options: [ - { id: 0, label: 'W · G V C' }, - { id: 1, label: '(W · (G V C))' }, - { id: 2, label: '(W · G) V C' }, - { id: 3, label: '((W · G) V C)' }, + { id: 0, label: '$ W \\cdot G \\vee C $' }, + { id: 1, label: '$ (W \\cdot (G \\vee C)) $' }, + { id: 2, label: '$ (W \\cdot G) \\vee C $' }, + { id: 3, label: '$ ((W \\cdot G) \\vee C) $' }, ], correctId: [3], answer: '', }, { id: '6.35', - prompt: `You aren't either dull or boastful`, + prompt: "You aren't either dull or boastful", options: [ - { id: 0, label: '(~D V ~B)' }, - { id: 1, label: '(~D V B)' }, - { id: 2, label: '~D V B' }, - { id: 3, label: '~(D V B)' }, + { id: 0, label: '$ (\\sim D \\vee \\sim B) $' }, + { id: 1, label: '$ (\\sim D \\vee B) $' }, + { id: 2, label: '$ \\sim D \\vee B $' }, + { id: 3, label: '$ \\sim(D \\vee B) $' }, ], correctId: [3], answer: '', }, { id: '6.36', - prompt: `You aren't both not creative and notorious`, + prompt: "You aren't both not creative and notorious", options: [ - { id: 0, label: '~(~C · N)' }, - { id: 1, label: '(C · N)' }, - { id: 2, label: '~~C · N' }, - { id: 3, label: 'C · N' }, + { id: 0, label: '$ \\sim(\\sim C \\cdot N) $' }, + { id: 1, label: '$ (C \\cdot N) $' }, + { id: 2, label: '$ \\sim\\sim C \\cdot N $' }, + { id: 3, label: '$ C \\cdot N $' }, ], correctId: [0], answer: '', }, { id: '6.37', - prompt: `Not if not B then C`, + prompt: 'Not if not B then C', options: [ - { id: 0, label: '~~B → C' }, - { id: 1, label: 'B → C' }, - { id: 2, label: '~(~B → C)' }, - { id: 3, label: '(B → C)' }, + { id: 0, label: '$ \\sim\\sim B \\rightarrow C $' }, + { id: 1, label: '$ B \\rightarrow C $' }, + { id: 2, label: '$ \\sim(\\sim B \\rightarrow C) $' }, + { id: 3, label: '$ (B \\rightarrow C) $' }, ], correctId: [2], answer: '', }, { id: '6.38', - prompt: `You're both bright and either forgetful or confident`, + prompt: "You're both bright and either forgetful or confident", options: [ - { id: 0, label: '((B · F) V C)' }, - { id: 1, label: '(B · F) V C' }, - { id: 2, label: 'B · F V C' }, - { id: 3, label: '(B · (F V C))' }, + { id: 0, label: '$ ((B \\cdot F) \\vee C) $' }, + { id: 1, label: '$ (B \\cdot F) \\vee C $' }, + { id: 2, label: '$ B \\cdot F \\vee C $' }, + { id: 3, label: '$ (B \\cdot (F \\vee C)) $' }, ], correctId: [3], answer: '', }, { id: '6.39', - prompt: `Not either W or C`, + prompt: 'Not either W or C', options: [ - { id: 0, label: '(~W V ~C)' }, - { id: 1, label: '~W V C' }, - { id: 2, label: '(~W V C)' }, - { id: 3, label: '~(W V C)' }, + { id: 0, label: '$ (\\sim W \\vee \\sim C) $' }, + { id: 1, label: '$ \\sim W \\vee C $' }, + { id: 2, label: '$ (\\sim W \\vee C) $' }, + { id: 3, label: '$ \\sim(W \\vee C) $' }, ], correctId: [3], answer: '', }, { id: '6.40', - prompt: `You're tall, and mediocre or colorful`, + prompt: "You're tall, and mediocre or colorful", options: [ - { id: 0, label: '(T · M) V C' }, - { id: 1, label: '(T · (M V C))' }, - { id: 2, label: '((T · M) V C)' }, - { id: 3, label: 'T · M V C' }, + { id: 0, label: '$ (T \\cdot M) \\vee C $' }, + { id: 1, label: '$ (T \\cdot (M \\vee C)) $' }, + { id: 2, label: '$ ((T \\cdot M) \\vee C) $' }, + { id: 3, label: '$ T \\cdot M \\vee C $' }, ], correctId: [1], answer: '', }, { id: '6.41', - prompt: `If D then M, and L`, + prompt: 'If D then M, and L', options: [ - { id: 0, label: 'D → M · L' }, - { id: 1, label: '(D → M) · L' }, - { id: 2, label: '(D → (M · L))' }, - { id: 3, label: '((D → M) · L)' }, + { id: 0, label: '$ D \\rightarrow M \\cdot L $' }, + { id: 1, label: '$ (D \\rightarrow M) \\cdot L $' }, + { id: 2, label: '$ (D \\rightarrow (M \\cdot L)) $' }, + { id: 3, label: '$ ((D \\rightarrow M) \\cdot L) $' }, ], correctId: [3], answer: '', }, { id: '6.42', - prompt: `Not both L and N`, + prompt: 'Not both L and N', options: [ - { id: 0, label: '(~L · ~N)' }, - { id: 1, label: '~L · N' }, - { id: 2, label: '~(L · N)' }, - { id: 3, label: '(~L · N)' }, + { id: 0, label: '$ (\\sim L \\cdot \\sim N) $' }, + { id: 1, label: '$ \\sim L \\cdot N $' }, + { id: 2, label: '$ \\sim(L \\cdot N) $' }, + { id: 3, label: '$ (\\sim L \\cdot N) $' }, ], correctId: [2], answer: '', }, { id: '6.43', - prompt: `Either not B or P`, + prompt: 'Either not B or P', options: [ - { id: 0, label: '~(B V P)' }, - { id: 1, label: '~B V P' }, - { id: 2, label: '(~B V P)' }, - { id: 3, label: '(~B V ~P)' }, + { id: 0, label: '$ \\sim(B \\vee P) $' }, + { id: 1, label: '$ \\sim B \\vee P $' }, + { id: 2, label: '$ (\\sim B \\vee P) $' }, + { id: 3, label: '$ (\\sim B \\vee \\sim P) $' }, ], correctId: [2], answer: '', }, { id: '6.44', - prompt: `You're both not sarcastic and not bashful`, + prompt: "You're both not sarcastic and not bashful", options: [ - { id: 0, label: '(~S · B)' }, - { id: 1, label: '(~S · ~B)' }, - { id: 2, label: '~(S · ~B)' }, - { id: 3, label: '~S · ~B' }, + { id: 0, label: '$ (\\sim S \\cdot B) $' }, + { id: 1, label: '$ (\\sim S \\cdot \\sim B) $' }, + { id: 2, label: '$ \\sim(S \\cdot \\sim B) $' }, + { id: 3, label: '$ \\sim S \\cdot \\sim B $' }, ], correctId: [1], answer: '', }, { id: '6.45', - prompt: `If C then S, and B`, + prompt: 'If C then S, and B', options: [ - { id: 0, label: '(C → S) · B' }, - { id: 1, label: '(C → (S · B))' }, - { id: 2, label: 'C → S · B' }, - { id: 3, label: '((C → S) · B)' }, + { id: 0, label: '$ (C \\rightarrow S) \\cdot B $' }, + { id: 1, label: '$ (C \\rightarrow (S \\cdot B)) $' }, + { id: 2, label: '$ C \\rightarrow S \\cdot B $' }, + { id: 3, label: '$ ((C \\rightarrow S) \\cdot B) $' }, ], correctId: [3], answer: '', }, { id: '6.46', - prompt: `If you're strong then you're talented, or you're cautious`, + prompt: "If you're strong then you're talented, or you're cautious", options: [ - { id: 0, label: '(S → T) V C' }, - { id: 1, label: '(S → (T V C))' }, - { id: 2, label: 'S → T V C' }, - { id: 3, label: '((S → T) V C)' }, + { id: 0, label: '$ (S \\rightarrow T) \\vee C $' }, + { id: 1, label: '$ (S \\rightarrow (T \\vee C)) $' }, + { id: 2, label: '$ S \\rightarrow T \\vee C $' }, + { id: 3, label: '$ ((S \\rightarrow T) \\vee C) $' }, ], correctId: [3], answer: '', }, { id: '6.47', - prompt: `If you aren't tall then you aren't frightened`, + prompt: "If you aren't tall then you aren't frightened", options: [ - { id: 0, label: '(~T → ~F)' }, - { id: 1, label: '~(T → ~F)' }, - { id: 2, label: '~T → ~F' }, - { id: 3, label: '(~T → F)' }, + { id: 0, label: '$ (\\sim T \\rightarrow \\sim F) $' }, + { id: 1, label: '$ \\sim(T \\rightarrow \\sim F) $' }, + { id: 2, label: '$ \\sim T \\rightarrow \\sim F $' }, + { id: 3, label: '$ (\\sim T \\rightarrow F) $' }, ], correctId: [0], answer: '', }, { id: '6.48', - prompt: `Both not P and not B`, + prompt: 'Both not P and not B', options: [ - { id: 0, label: '~P · ~B' }, - { id: 1, label: '~(P · ~B)' }, - { id: 2, label: '(~P · ~B)' }, - { id: 3, label: '(~P · B)' }, + { id: 0, label: '$ \\sim P \\cdot \\sim B $' }, + { id: 1, label: '$ \\sim(P \\cdot \\sim B) $' }, + { id: 2, label: '$ (\\sim P \\cdot \\sim B) $' }, + { id: 3, label: '$ (\\sim P \\cdot B) $' }, ], correctId: [2], answer: '', }, { id: '6.49', - prompt: `If P, then C or D`, + prompt: 'If P, then C or D', options: [ - { id: 0, label: '(P → (C V D))' }, - { id: 1, label: '((P → C) V D)' }, - { id: 2, label: 'P → C V D' }, - { id: 3, label: '(P → C) V D' }, + { id: 0, label: '$ (P \\rightarrow (C \\vee D)) $' }, + { id: 1, label: '$ ((P \\rightarrow C) \\vee D) $' }, + { id: 2, label: '$ P \\rightarrow C \\vee D $' }, + { id: 3, label: '$ (P \\rightarrow C) \\vee D $' }, ], correctId: [0], answer: '', }, { id: '6.50', - prompt: `Both not C and F`, + prompt: 'Both not C and F', options: [ - { id: 0, label: '~C · F' }, - { id: 1, label: '(~C · ~F)' }, - { id: 2, label: '~(C · F)' }, - { id: 3, label: '(~C · F)' }, + { id: 0, label: '$ \\sim C \\cdot F $' }, + { id: 1, label: '$ (\\sim C \\cdot \\sim F) $' }, + { id: 2, label: '$ \\sim(C \\cdot F) $' }, + { id: 3, label: '$ (\\sim C \\cdot F) $' }, ], correctId: [3], answer: '', }, { id: '6.51', - prompt: `If you aren't tough then you're greedy`, + prompt: "If you aren't tough then you're greedy", options: [ - { id: 0, label: '(~T → G)' }, - { id: 1, label: '~T → G' }, - { id: 2, label: '(~T → ~G)' }, - { id: 3, label: '~(T → G)' }, + { id: 0, label: '$ (\\sim T \\rightarrow G) $' }, + { id: 1, label: '$ \\sim T \\rightarrow G $' }, + { id: 2, label: '$ (\\sim T \\rightarrow \\sim G) $' }, + { id: 3, label: '$ \\sim(T \\rightarrow G) $' }, ], correctId: [0], answer: '', }, { id: '6.52', - prompt: `If you're weak and hideous, then you're candid`, + prompt: "If you're weak and hideous, then you're candid", options: [ - { id: 0, label: 'W · H → C' }, - { id: 1, label: '(W · (H → C))' }, - { id: 2, label: '((W · H) → C)' }, - { id: 3, label: '(W · H) → C' }, + { id: 0, label: '$ W \\cdot H \\rightarrow C $' }, + { id: 1, label: '$ (W \\cdot (H \\rightarrow C)) $' }, + { id: 2, label: '$ ((W \\cdot H) \\rightarrow C) $' }, + { id: 3, label: '$ (W \\cdot H) \\rightarrow C $' }, ], correctId: [2], answer: '', }, { id: '6.53', - prompt: `You aren't both not fortunate and loveable`, + prompt: "You aren't both not fortunate and loveable", options: [ - { id: 0, label: 'F · L' }, - { id: 1, label: '(F · L)' }, - { id: 2, label: '~(~F · L)' }, - { id: 3, label: '~~F · L' }, + { id: 0, label: '$ F \\cdot L $' }, + { id: 1, label: '$ (F \\cdot L) $' }, + { id: 2, label: '$ \\sim(\\sim F \\cdot L) $' }, + { id: 3, label: '$ \\sim\\sim F \\cdot L $' }, ], correctId: [2], answer: '', }, { id: '6.54', - prompt: `You're cruel and lonely, or else humorous`, + prompt: "You're cruel and lonely, or else humorous", options: [ - { id: 0, label: '((C · L) V H)' }, - { id: 1, label: '(C · L) V H' }, - { id: 2, label: 'C · L V H' }, - { id: 3, label: '(C · (L V H))' }, + { id: 0, label: '$ ((C \\cdot L) \\vee H) $' }, + { id: 1, label: '$ (C \\cdot L) \\vee H $' }, + { id: 2, label: '$ C \\cdot L \\vee H $' }, + { id: 3, label: '$ (C \\cdot (L \\vee H)) $' }, ], correctId: [0], answer: '', }, { id: '6.55', - prompt: `If P, then D and N`, + prompt: 'If P, then D and N', options: [ - { id: 0, label: 'P → D · N' }, - { id: 1, label: '((P → D) · N)' }, - { id: 2, label: '(P → D) · N' }, - { id: 3, label: '(P → (D · N))' }, + { id: 0, label: '$ P \\rightarrow D \\cdot N $' }, + { id: 1, label: '$ ((P \\rightarrow D) \\cdot N) $' }, + { id: 2, label: '$ (P \\rightarrow D) \\cdot N $' }, + { id: 3, label: '$ (P \\rightarrow (D \\cdot N)) $' }, ], correctId: [3], answer: '', }, { id: '6.56', - prompt: `Not if R then C`, + prompt: 'Not if R then C', options: [ - { id: 0, label: '(~R → ~C)' }, - { id: 1, label: '~R → C' }, - { id: 2, label: '~(R → C)' }, - { id: 3, label: '(~R → C)' }, + { id: 0, label: '$ (\\sim R \\rightarrow \\sim C) $' }, + { id: 1, label: '$ \\sim R \\rightarrow C $' }, + { id: 2, label: '$ \\sim(R \\rightarrow C) $' }, + { id: 3, label: '$ (\\sim R \\rightarrow C) $' }, ], correctId: [2], answer: '', }, { id: '6.57', - prompt: `It is false that if you aren't bright then you're careful`, + prompt: "It is false that if you aren't bright then you're careful", options: [ - { id: 0, label: 'B → C' }, - { id: 1, label: '~(~B → C)' }, - { id: 2, label: '(B → C)' }, - { id: 3, label: '~~B → C' }, + { id: 0, label: '$ B \\rightarrow C $' }, + { id: 1, label: '$ \\sim(\\sim B \\rightarrow C) $' }, + { id: 2, label: '$ (B \\rightarrow C) $' }, + { id: 3, label: '$ \\sim\\sim B \\rightarrow C $' }, ], correctId: [1], answer: '', }, { id: '6.58', - prompt: `You're either tough and cautious or else frivolous`, + prompt: "You're either tough and cautious or else frivolous", options: [ - { id: 0, label: '(T · C) V F' }, - { id: 1, label: '(T · (C V F))' }, - { id: 2, label: 'T · C V F' }, - { id: 3, label: '((T · C) V F)' }, + { id: 0, label: '$ (T \\cdot C) \\vee F $' }, + { id: 1, label: '$ (T \\cdot (C \\vee F)) $' }, + { id: 2, label: '$ T \\cdot C \\vee F $' }, + { id: 3, label: '$ ((T \\cdot C) \\vee F) $' }, ], correctId: [3], answer: '', }, { id: '6.59', - prompt: `You're both weak and either charming or prosperous`, + prompt: "You're both weak and either charming or prosperous", options: [ - { id: 0, label: '(W · (C V P))' }, - { id: 1, label: '(W · C) V P' }, - { id: 2, label: 'W · C V P' }, - { id: 3, label: '((W · C) V P)' }, + { id: 0, label: '$ (W \\cdot (C \\vee P)) $' }, + { id: 1, label: '$ (W \\cdot C) \\vee P $' }, + { id: 2, label: '$ W \\cdot C \\vee P $' }, + { id: 3, label: '$ ((W \\cdot C) \\vee P) $' }, ], correctId: [0], answer: '', }, { id: '6.60', - prompt: `If you're tall then you're realistic, and you're boastful`, + prompt: "If you're tall then you're realistic, and you're boastful", options: [ - { id: 0, label: 'T → R · B' }, - { id: 1, label: '(T → (R · B))' }, - { id: 2, label: '(T → R) · B' }, - { id: 3, label: '((T → R) · B)' }, + { id: 0, label: '$ T \\rightarrow R \\cdot B $' }, + { id: 1, label: '$ (T \\rightarrow (R \\cdot B)) $' }, + { id: 2, label: '$ (T \\rightarrow R) \\cdot B $' }, + { id: 3, label: '$ ((T \\rightarrow R) \\cdot B) $' }, ], correctId: [3], answer: '', }, { id: '6.61', - prompt: `If you're clean then you're powerful, or you're lively`, + prompt: "If you're clean then you're powerful, or you're lively", options: [ - { id: 0, label: '((C → P) V L)' }, - { id: 1, label: 'C → P V L' }, - { id: 2, label: '(C → P) V L' }, - { id: 3, label: '(C → (P V L))' }, + { id: 0, label: '$ ((C \\rightarrow P) \\vee L) $' }, + { id: 1, label: '$ C \\rightarrow P \\vee L $' }, + { id: 2, label: '$ (C \\rightarrow P) \\vee L $' }, + { id: 3, label: '$ (C \\rightarrow (P \\vee L)) $' }, ], correctId: [0], answer: '', }, { id: '6.62', - prompt: `You're short, and creative or dishonest`, + prompt: "You're short, and creative or dishonest", options: [ - { id: 0, label: '(S · C) V D' }, - { id: 1, label: '(S · (C V D))' }, - { id: 2, label: 'S · C V D' }, - { id: 3, label: '((S · C) V D)' }, + { id: 0, label: '$ (S \\cdot C) \\vee D $' }, + { id: 1, label: '$ (S \\cdot (C \\vee D)) $' }, + { id: 2, label: '$ S \\cdot C \\vee D $' }, + { id: 3, label: '$ ((S \\cdot C) \\vee D) $' }, ], correctId: [1], answer: '', diff --git a/package.json b/package.json index dd37295..dc8c6e7 100644 --- a/package.json +++ b/package.json @@ -15,9 +15,11 @@ "@radix-ui/react-slot": "^1.0.2", "@supabase/ssr": "^0.3.0", "@supabase/supabase-js": "^2.43.1", + "@types/katex": "^0.16.7", "class-variance-authority": "^0.7.0", "classnames": "^2.5.1", "clsx": "^2.1.1", + "katex": "^0.16.10", "lucide-react": "^0.378.0", "next": "14.2.3", "posthog-js": "^1.130.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index e7a9cb2..4d41c1c 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -17,6 +17,9 @@ dependencies: '@supabase/supabase-js': specifier: ^2.43.1 version: 2.43.1 + '@types/katex': + specifier: ^0.16.7 + version: 0.16.7 class-variance-authority: specifier: ^0.7.0 version: 0.7.0 @@ -26,6 +29,9 @@ dependencies: clsx: specifier: ^2.1.1 version: 2.1.1 + katex: + specifier: ^0.16.10 + version: 0.16.10 lucide-react: specifier: ^0.378.0 version: 0.378.0(react@18.3.1) @@ -646,6 +652,10 @@ packages: resolution: {integrity: sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==} dev: true + /@types/katex@0.16.7: + resolution: {integrity: sha512-HMwFiRujE5PjrgwHQ25+bsLJgowjGjm5Z8FVSf0N6PwgJrwxH0QxzHYDcKsTfV3wva0vzrpqMTJS2jXPr5BMEQ==} + dev: false + /@types/node@20.12.7: resolution: {integrity: sha512-wq0cICSkRLVaf3UGLMGItu/PtdY7oaXaI/RVU+xliKVOtRna3PRY57ZDfztpDL0n11vfymMUnXv8QwYCO7L1wg==} dependencies: @@ -1144,6 +1154,11 @@ packages: resolution: {integrity: sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==} engines: {node: '>= 6'} + /commander@8.3.0: + resolution: {integrity: sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww==} + engines: {node: '>= 12'} + dev: false + /concat-map@0.0.1: resolution: {integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==} dev: true @@ -2246,6 +2261,13 @@ packages: object.values: 1.2.0 dev: true + /katex@0.16.10: + resolution: {integrity: sha512-ZiqaC04tp2O5utMsl2TEZTXxa6WSC4yo0fv5ML++D3QZv/vx2Mct0mTlRx3O+uUkjfuAgOkzsCmq5MiUEsDDdA==} + hasBin: true + dependencies: + commander: 8.3.0 + dev: false + /keyv@4.5.4: resolution: {integrity: sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==} dependencies: diff --git a/tsconfig.json b/tsconfig.json index e7ff90f..9859bf6 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -21,6 +21,12 @@ "@/*": ["./*"] } }, - "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"], + "include": [ + "next-env.d.ts", + "**/*.ts", + "**/*.tsx", + ".next/types/**/*.ts", + "components/katexSpan.jsx" + ], "exclude": ["node_modules"] }