sentencecounter.tex (1287B)
1 \documentclass[10pt,a5paper]{article} 2 \usepackage[utf8]{inputenc} 3 \usepackage{amsmath} 4 \usepackage{amsfonts} 5 \usepackage{amssymb} 6 \usepackage[left=2cm,right=2cm,top=2cm,bottom=2cm]{geometry} 7 8 \usepackage{xcolor} 9 10 \newcounter{sentence}[section] 11 \renewcommand{\thesentence}{[\thesection,\arabic{sentence}]} 12 13 \newcommand{\R}{\mathbb{R}} 14 \newcommand{\words}{blah bla blha} 15 16 \newcommand{\todo}[1]{{\color{red}\large TODO: #1}} 17 18 \newcommand{\sent}[1]{\refstepcounter{sentence}#1\textsuperscript{\arabic{sentence}}} 19 20 \newcommand{\mymatrix}[4]{\begin{pmatrix} 21 #1 & #2 \\ 22 #3 & #4 23 \end{pmatrix}} 24 25 \newcommand{\twocases}[4]{\begin{cases} 26 #1 & #2 \\ 27 #3 & #4 28 \end{cases}} 29 30 31 \begin{document} 32 33 \section{First section} 34 35 \sent{A sentence before the first one} 36 37 \sent{This is a sentence.} 38 \label{s1} 39 \sent{This is another sentence.} 40 41 \todo{finish the first section} 42 43 This is a longer sentence that takes more than one line line maybe~no still it random words to show that how tilde works i dont know Theorem~10 44 45 \section{Second section} 46 47 \sent{A sentence in the second section.} 48 \label{sanother} 49 50 \vspace{2cm} 51 52 In sentence~\ref{s1}... \todo{what did I want to say?} 53 54 \[ \R \] 55 56 \words 57 58 \[ 59 \mymatrix{x}{a_{2,2}}{0}{f(10)} 60 \] 61 62 \[ 63 f(x)=\twocases{x^2}{\text{if }x>0}{-x^3}{\text{otherwise.}} 64 \] 65 66 \end{document}