diff options
author | Kai Stevenson <kai@kaistevenson.com> | 2023-08-01 15:36:09 -0700 |
---|---|---|
committer | Kai Stevenson <kai@kaistevenson.com> | 2023-08-01 15:36:09 -0700 |
commit | 7175a9c8e1bfb2a19cb77d8ce5b8c9609a7b3e4d (patch) | |
tree | 3488f49c2cc83454e19f6f9f20ee52179da4e055 /src | |
parent | d45367cc9101e4f0e03d1e77d5c7cc10b00567ba (diff) |
changed phplatex to use hex
Diffstat (limited to 'src')
-rw-r--r-- | src/head.php | 2 | ||||
-rw-r--r-- | src/phplatex.php | 11 | ||||
-rw-r--r-- | src/style.php (renamed from src/style.css) | 31 | ||||
-rw-r--r-- | src/vars.php | 6 | ||||
-rw-r--r-- | src/writing/derivative.php | 5 |
5 files changed, 23 insertions, 32 deletions
diff --git a/src/head.php b/src/head.php index 8e33858..bb3358f 100644 --- a/src/head.php +++ b/src/head.php @@ -4,7 +4,7 @@ ini_set('display_errors', 1); ?> <head> - <link rel="stylesheet" href="/style.css"> + <link rel="stylesheet" href="/style.php"> <link rel="icon" type="image/x-icon" href="/images/favicon.ico"> </head> diff --git a/src/phplatex.php b/src/phplatex.php index f8bebeb..ce6a2fe 100644 --- a/src/phplatex.php +++ b/src/phplatex.php @@ -35,24 +35,21 @@ function phplatex_colorhex($r,$g,$b) { } -function texify($string,$dpi='90', $r=0.0,$g=0.0,$b=0.0, $br=1.0,$bg=1.0,$bb=1.0,$extraprelude="", $trans=FALSE) { +function texify($string,$dpi='90',$fore="",$back="",$extraprelude="",$trans=FALSE) { global $imgfmt,$path_to_latex,$path_to_dvips,$path_to_convert; if ($dpi>300) $dpi=300; - $back = phplatex_colorhex($br,$bg,$bb); - $fore = phplatex_colorhex($r,$g,$b); - # Figure out TeX string, either to get the right cache entry, or to compile # Adds semi-common symbol packages (ams) # used to include ,landscape in documentclass to avoid page wrapping, but it seems this sometimes implies 90 degree rotation $totex = "\\documentclass[14pt]{extarticle}\n". - "\\usepackage{color}\n". + "\\usepackage{xcolor}\n". "\\usepackage{amsmath}\n\\usepackage{amsfonts}\n\\usepackage{amssymb}\n". $extraprelude."\n". "\\pagestyle{empty}\n". #removes header/footer; necessary for trim "\\begin{document}\n". - "\\color[rgb]{".$r.",".$g.",".$b."}\n". - "\\pagecolor[rgb]{".$br.",".$bg.",".$bb."}\n". + "\\color[HTML]{".$fore."}\n". + "\\pagecolor[HTML]{".$back."}\n". $string."\n". "\\end{document}\n"; $hashfn = sha1($totex).".".$dpi.".".$fore.".".$back.".".intval($trans); #file cache entry string: 40-char hash string plus size diff --git a/src/style.css b/src/style.php index 26cec6d..b55bb90 100644 --- a/src/style.css +++ b/src/style.php @@ -1,28 +1,15 @@ +<?php + header("Content-type: text/css; charset: UTF-8"); + include($_SERVER["DOCUMENT_ROOT"] . "/vars.php"); +?> @import url('https://fonts.googleapis.com/css2?family=Quicksand:wght@400;600&display=swap'); :root { - /* COLOURSCHEME 1, BLUE */ - /* - --background: #121d28; - --text: #bbd7f2; - --header: #bbd7f2; - --secondary: #76baf9; - --highlight: #7ceea7; - */ - /* COLOURSCHEME 2, ORANGE */ - /* - --background: #141210; - --header: #fdb04d; - --text: #faca8b; - --secondary: #ee8041; - --highlight: #ee4c41; - */ - /* COLOURSCHEME 3, RED? */ - --background: #1E1B1B; - --text: #F5F5F5; - --header: #F5F5F5; - --secondary: #FF5A5F; - --highlight: #FF8A8C; + --background: #<?php echo($c_bg) ?>; + --text: #<?php echo($c_fg) ?>; + --header: #<?php echo($c_fg) ?>; + --secondary: #<?php echo($c_sc) ?>; + --highlight: #<?php echo($c_hl) ?>; } body { diff --git a/src/vars.php b/src/vars.php new file mode 100644 index 0000000..fa9218a --- /dev/null +++ b/src/vars.php @@ -0,0 +1,6 @@ +<?php +$c_bg = "1E1B1B"; +$c_fg = "F5F5F5"; +$c_sc = "FF5A5F"; +$c_hl = "FF8A8C"; +?> diff --git a/src/writing/derivative.php b/src/writing/derivative.php index 28bc00d..a7a369a 100644 --- a/src/writing/derivative.php +++ b/src/writing/derivative.php @@ -3,14 +3,15 @@ $title = "The Calculus of Infinitesimals"; require($_SERVER["DOCUMENT_ROOT"] . "/head.php");
require($_SERVER["DOCUMENT_ROOT"] . "/header.php");
include($_SERVER["DOCUMENT_ROOT"] . "/phplatex.php");
+include($_SERVER["DOCUMENT_ROOT"] . "/vars.php");
?>
<p>
<i>Calculus</i> is often used as the complete name of a branch of mathematics dealing with
rates of change and very small numbers. In fact, a calculus is a specific discipline
or method for the analysis of some set of problems. The fact that the <i>calculus of infinitesimals</i>
- has come to known in this way is a testament to its importance.
+ has come to be known in this way is a testament to its importance.
</p>
<p>
- <?php echo(texify("$\\sqrt[3]{2}\$", 160, 0.96,0.96,0.96, 0.118,0.106,0.106, "", TRUE)); ?>
+ Cube root of two: <?php echo(texify("$\\sqrt[3]{2}\$", 160, $c_fg, $c_bg, "", TRUE)); ?>
</p>
<?php require($_SERVER["DOCUMENT_ROOT"] . "/footer.php"); ?>
|