mirror of
https://github.com/Smaug123/KaTeX
synced 2025-10-18 09:18:39 +00:00
Enable minRuleThickness in rendering options (#1964)
* Enable minRuleThickness in rendering options * fix typo * Fix lint errors * Fix default * Remove border from \colorbox * Fix lint error * Update array screenshot * Add border to \fcolorbox * Edit comment * Add comment * Pick up review comments * Fix lint errors * Edit \sqrt screenshot test * Update screenshots * Screenshot update take 2 * Improve \sqrt SVG paths * Fix lint error
This commit is contained in:
@@ -174,6 +174,12 @@ const htmlBuilder: HtmlBuilder<"array"> = function(group, options) {
|
||||
let body = new Array(nr);
|
||||
const hlines = [];
|
||||
|
||||
const ruleThickness = Math.max(
|
||||
// From LaTeX \showthe\arrayrulewidth. Equals 0.04 em.
|
||||
(options.fontMetrics().arrayRuleWidth),
|
||||
options.minRuleThickness, // User override.
|
||||
);
|
||||
|
||||
// Horizontal spacing
|
||||
const pt = 1 / options.fontMetrics().ptPerEm;
|
||||
let arraycolsep = 5 * pt; // default value, i.e. \arraycolsep in article.cls
|
||||
@@ -284,20 +290,15 @@ const htmlBuilder: HtmlBuilder<"array"> = function(group, options) {
|
||||
cols.push(colSep);
|
||||
}
|
||||
|
||||
if (colDescr.separator === "|") {
|
||||
if (colDescr.separator === "|" || colDescr.separator === ":") {
|
||||
const lineType = (colDescr.separator === "|") ? "solid" : "dashed";
|
||||
const separator = buildCommon.makeSpan(
|
||||
["vertical-separator"], [], options
|
||||
);
|
||||
separator.style.height = totalHeight + "em";
|
||||
separator.style.verticalAlign =
|
||||
-(totalHeight - offset) + "em";
|
||||
|
||||
cols.push(separator);
|
||||
} else if (colDescr.separator === ":") {
|
||||
const separator = buildCommon.makeSpan(
|
||||
["vertical-separator", "vs-dashed"], [], options
|
||||
);
|
||||
separator.style.height = totalHeight + "em";
|
||||
separator.style.borderRightWidth = `${ruleThickness}em`;
|
||||
separator.style.borderRightStyle = lineType;
|
||||
separator.style.margin = `0 -${ruleThickness / 2}em`;
|
||||
separator.style.verticalAlign =
|
||||
-(totalHeight - offset) + "em";
|
||||
|
||||
@@ -361,8 +362,9 @@ const htmlBuilder: HtmlBuilder<"array"> = function(group, options) {
|
||||
|
||||
// Add \hline(s), if any.
|
||||
if (hlines.length > 0) {
|
||||
const line = buildCommon.makeLineSpan("hline", options, 0.05);
|
||||
const dashes = buildCommon.makeLineSpan("hdashline", options, 0.05);
|
||||
const line = buildCommon.makeLineSpan("hline", options, ruleThickness);
|
||||
const dashes = buildCommon.makeLineSpan("hdashline", options,
|
||||
ruleThickness);
|
||||
const vListElems = [{type: "elem", elem: body, shift: 0}];
|
||||
while (hlines.length > 0) {
|
||||
const hline = hlines.pop();
|
||||
|
Reference in New Issue
Block a user