基于Typora由Markdown仿LaTeX风格的主题

admin 2023年3月6日19:47:48评论143 views字数 11953阅读39分50秒阅读模式

原作者已经写的很好了

地址:

https://github.com/Keldos-Li/typora-latex-theme

我在其基础上更改一些内容

基本使用文档如下

css主题打包放在后面

基于Typora由Markdown仿LaTeX风格的主题

@charset "UTF-8";
/* ============================================
* ============ TYPORA lATEX THEME ============
* ============================================
* This project is based on the work of yfzhao20 and du33169,
whose repositories are addressed on
<https://github.com/yfzhao20/Typora-markdown> and
<https://github.com/du33169/typora-theme-essay_cn>,
many thanks to them.
* Typora LaTeX Theme (Markdown LaTeX Theme)
is a CSS theme mainly used as a component of Typora,
which is designed for Chinese university students
used in LaTeX-styled essays and reports.
* Copyright (C) 2021 Keldos;
* Repository Address: <https://github.com/Keldos-Li/typora-latex-theme>;
* Licensed Under GPL v3.0, SEE <https://github.com/Keldos-Li/typora-latex-theme/blob/main/LICENSE>
*/
/* As a special exception, you may create a larger work
that contains part or all of the Typora LaTeX Theme
and distribute that work under terms of your choice,
so long as that work isn't itself a CSS theme
or can be processed into CSS theme by using some
CSS pre-processors like SASS. Alternatively, if you
modify or redistribute this CSS theme itself,
you may (at your option) remove this special exception,
which will cause the CSS theme and the resulting output files
to be licensed under the GNU General Public License
without this special exception.
*/

:root {
/* == 字体设置 == */
/* 基准字体 */
/* 备选:Times, "Times New Roman" */
--base-Latin-font: "Latin Modern Roman", "Latin Modern Roman 10";
--base-Chinese-font: "宋体-简", "华文宋体", "Noto Serif CJK SC";
--base-font-size: 9.5pt;
/* 引言字体 */
--quote-font: "Latin Modern Roman", "Latin Modern Roman 10", Times,
"Times New Roman", "华文仿宋";
/* 这里字体用了10pt,比正文字体稍大 */
--quote-font-size: 10pt;
/* 代码字体(代码中的中文会调用 ui-font) */
--code-font: "Latin Modern Mono", "Latin Modern Mono 10", "Courier New";
/* 侧边栏字体 */
--ui-font: "阿里巴巴普惠体 2.0", "微软雅黑";
/* source mode 字体 */
/* 默认调用 code-font 和 ui-font */
--sourceMode-font: "SF Mono", "阿里巴巴普惠体 2.0", "微软雅黑";
/* 目录字体 */
/* 默认调用 base-font */
--toc-font: "";
/* 默认调用 base-font-size */
--toc-font-size: "";
/* 表格字体 */
/* 默认调用 heading-font */
--table-title-font: "";
/* 默认调用 base-font */
--table-font: "";
/* 标题字体(总设置) */
--heading-Latin-font: var(--base-Latin-font);
--heading-Chinese-font: "华文黑体";
/* 标题字体分别设置 */
/* 大标题(h1)字体 */
--title-Chinese-font: "华文黑体";
--title-font-size: 18pt;
/* h2字体 */
--h2-Chinese-font: "华文黑体";
--h2-font-size: 14pt;
/* h3字体 */
--h3-Chinese-font: "华文黑体";
--h3-font-size: 12pt;
/* h4字体 */
--h4-Chinese-font: "华文楷体";
--h4-font-size: 10pt;
/* h5字体 */
--h5-Chinese-font: "华文仿宋";
--h5-font-size: 10pt;
/* h6字体 */
--h6-Chinese-font: "华文仿宋";
--h6-font-size: 9.5pt;
/* 粗体样式设置 */
/* 加粗风格时使用的字重;400等同于 normal,700等同于 bold,900等同于 heavy */
--strong-weight: 900;
/* 基础行距 */
--base-line-height: 16pt;
/* == 页面设置 == */
/* 打印页边距 */
--set-margin: 1.8cm 2cm 1.2cm 2cm !important;
/* == 控制设置 == */
/* 目录中是否显示一级标题 */
--toc-show-title: none;
/* == 颜色设置 == */
/* 超链接颜色 */
--link-color-light: #2E67D3;
--link-color-dark: #8bb1f9;
}

/* ========== VERY IMPORTANT 请注意看下面的几行: ================
如果您需要在输出PDF时隐藏超链接的颜色和下划线,请取消注释下面的代码块,即删去下面的 Ln.1 和 Ln.2
如果您需要在输出PDF时保持超链接的显示效果,则不用更改 ============= */
/* 如要取消注释代码,请把本行删去 Ln.1

@media print {
#write a {
color: inherit !important;
text-decoration: none;
}
}

如要取消注释代码,请把本行删去 Ln.2 */
body {
padding: 0 !important;
margin: 0 !important;
line-height: var(--base-line-height);
/* counter-reset: tableHead 0 imgHead 0; */
}

strong {
font-weight: var(--strong-weight);
}

@media screen {
#write {
padding: var(--set-margin);
/* 添加一个淡蓝色的边框 */
/* border: 0.8px solid #AAC ; */
/* 页边阴影 */
box-shadow: 0 0 24px 12px #cccccc;
}
}
@media print {
#write {
padding: 0 !important;
}

@page {
margin: 1.8cm 2cm 1.2cm 2cm !important;
/* 页边距 */
}
}
/* 正文区基本属性 */
#write {
font-family: var(--base-Latin-font), var(--base-Chinese-font), serif;
font-size: var(--base-font-size);
/* A4标准宽度 */
max-width: 21cm;
background-color: white;
/* column-count: 2;
column-gap: 25px;
column-width: 8cm;
display: inline-block; */
/* 这里可以试分栏的,但确实不适合实现 */
counter-reset: h2 0 h3 0 h4 0 h5 0 h6 0;
}
#write p {
text-align: left;
}
#write a {
color: var(--link-color-light);
}
#write h1,
#write h2,
#write h3,
#write h4,
#write h5,
#write h6 {
font-weight: bold;
/* 标题字体 */
font-family: var(--heading-Latin-font), var(--heading-Chinese-font), sans-serif;
page-break-after: avoid !important;
}
#write h1 {
font-family: var(--heading-Latin-font), var(--title-Chinese-font), sans-serif;
text-align: center;
column-span: all;
font-size: var(--title-font-size);
}
#write h2 {
font-family: var(--heading-Latin-font), var(--h2-Chinese-font), sans-serif;
font-size: var(--h2-font-size);
}
#write h3 {
font-family: var(--heading-Latin-font), var(--h3-Chinese-font), sans-serif;
font-size: var(--h3-font-size);
line-height: var(--h3-font-size);
}
#write h4 {
font-family: var(--heading-Latin-font), var(--h4-Chinese-font), sans-serif;
font-size: var(--h4-font-size);
line-height: var(--h4-font-size);
}
#write h5 {
font-family: var(--heading-Latin-font), var(--h5-Chinese-font), sans-serif;
font-size: var(--h5-font-size);
line-height: var(--h5-font-size);
}
#write h6 {
font-family: var(--heading-Latin-font), var(--h6-Chinese-font), sans-serif;
font-size: var(--h6-font-size);
/* 没有写错,为了避免行距太小才这么写 */
line-height: var(--h5-font-size);
}
#write table {
/* 三线表第一条线宽度 */
border-top: 1.2pt solid;
/* 三线表第二条线宽度 */
border-bottom: 1.2pt solid;
font-family: var(--table-font), var(--base-Latin-font), var(--base-Chinese-font), serif;
/* font-size: var(--base-font-size); */
text-align: center;
page-break-inside: avoid;
border-spacing: 6px;
/* 自动布局表格宽度,如果有时内容太紧建议直接加空格吧,我自己看不惯和页面等宽的大表格 */
width: auto;
/* 使表格默认居中;虽然这个代码不好,但好像没别的实现办法 */
margin: 0 auto;
}
#write table td {
padding: 2px;
}
#write table tr {
padding: 2px;
}
#write th {
padding: 0px 6px;
}
#write thead {
/* 表格标题(首行)样式 */
/* 三线表表头的线 */
border-bottom: 0.5pt solid;
font-family: var(--table-title-font), var(--heading-Latin-font), var(--heading-Chinese-font), serif !important;
/* font-size: var(--base-font-size); */
font-weight: var(--strong-weight);
}
#write .CodeMirror-wrap {
padding: 10px;
}
#write .CodeMirror-code pre {
font-family: var(--code-font), var(--ui-font), monospace;
}
#write h1 {
counter-reset: h2;
}
#write h2 {
counter-reset: h3;
}
#write h3 {
counter-reset: h4;
}
#write h4 {
counter-reset: h5;
}
#write h5 {
counter-reset: h6;
}

/*
#write figure:after{
counter-increment: tableHead;
content: "表" counter(tableHead) " ";
text-align:center;
width:100%;
display:inline-block;
}*/
/* 图片,导出PDF时暂时无法显示 */
/*
#write .md-image:after{
counter-increment: imgHead;
content: "图" counter(imgHead) " ";
text-align:center;
width:100%;
display:inline-block;
}
*/
/* basic 样式采用一般的引言,具有左边框、左缩进 */
blockquote {
font-style: normal;
font-family: var(--quote-font), var(--base-Latin-font), var(--base-Chinese-font), -apple-system, serif;
font-size: var(--quote-font-size);
/* 文字离左边框的距离 */
padding-left: 16px;
padding-right: 20pt;
/* 左边框离页面边的距离 */
margin-left: 20px;
}

hr {
border-top: solid 0.7px #eee;
}

img {
/* 避免图片在导出时被断开 */
page-break-inside: avoid;
}

/* ============ 多级列表样式 ============ */
ul {
/* 无序列表第一级:实心圆点 */
list-style: disc;
}
ul ul {
/*list-style: circle;*/
/* 请勿删除“–”后的空格, 他们对缩进有一定影响, 下同 */
list-style: "–  ";
/*left: -0.8rem;*/
}
ul ul ul {
/* 无序列表第三极:小圈 */
list-style: "◦ ";
left: 0.1rem;
}

ol {
/* 有序列表第一级:数字 */
list-style: decimal;
}
ol ol {
counter-reset: liist;
list-style: none;
}
ol ol li {
counter-increment: liist;
position: relative;
}
ol ol li::before {
/* 有序列表第二级:括号加小写字母 */
content: "(" counter(liist,lower-alpha) ")  ";
position: absolute;
margin-right: 2rem;
left: -2.4rem;
}
ol ol ol {
counter-reset: liiist;
list-style: none;
margin: 0;
}
ol ol ol li {
counter-increment: liiist;
position: relative;
}
ol ol ol li::before {
/* 有序列表第三级:小写罗马数字 */
content: counter(liiist,lower-roman) ".  ";
align-self: flex-end;
position: absolute;
left: -3rem;
/* -moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;*/
/* 为了让项目编号是重新用句点对齐而不是左对齐 */
width: 4.2rem;
text-align: right;
}

li {
position: relative;
}

/* ============ 多级列表样式END ============ */
/* 行内代码 */
code {
font-family: var(--code-font), var(--ui-font), monospace;
}

h1 code, h2 code, h3 code, h4 code, h5 code, h6 code,
p code,
li code {
color: #3c70c6;
background-color: #fefefe;
/* 阴影 */
box-shadow: 0 0 1px 1px #c8d3df;
font-family: var(--code-font), var(--ui-font), monospace;
box-sizing: border-box;
border-right: 0px;
margin: 0 2px 0 2px;
padding: 0 2px 0 2px;
/* 圆角 */
border-radius: 2px 2px 2px 2px;
}

/* typora 编写模式 */
#typora-source {
font-family: var(--sourceMode-font), var(--code-font), var(--ui-font), monospace;
line-height: 2rem;
}

#write h2:before {
counter-increment: h2;
content: counter(h2);
margin-right: 2rem;
}

#write h3:before, h3.md-focus.md-heading:before {
counter-increment: h3;
content: counter(h2) "." counter(h3);
margin-right: 2rem;
}

#write h4:before, h4.md-focus.md-heading:before {
counter-increment: h4;
content: counter(h2) "." counter(h3) "." counter(h4);
margin-right: 2rem;
}

#write h5:before, h5.md-focus.md-heading:before {
counter-increment: h5;
content: counter(h2) "." counter(h3) "." counter(h4) "." counter(h5);
margin-right: 2rem;
}

#write h6:before, h6.md-focus.md-heading:before {
counter-increment: h6;
content: counter(h2) "." counter(h3) "." counter(h4) "." counter(h5) "." counter(h6);
margin-right: 2rem;
}

.footnotes-area .footnote-line {
color: var(--text-color);
font-size: var(--base-font-size);
}
.footnotes-area hr {
border: 0;
color: #00000000;
}

/* 目录 */
.md-toc-content {
margin-left: 2em;
/* 修复缺失上级标题时无法递增 */
counter-reset: toc-h2 toc-h3 toc-h4;
page-break-after: always;
}

.md-toc-inner {
margin-left: 0 !important;
color: var(--text-color) !important;
}

.md-toc-item {
color: var(--text-color) !important;
}

/* 目录标题内容属性 */
.md-toc-h2,
.md-toc-h3,
.md-toc-h4,
.md-toc-h5,
.md-toc-h6 {
font-size: var(--toc-font-size);
font-family: var(--toc-font), var(--base-Latin-font), var(--base-Chinese-font), serif;
}

.md-toc-h2 {
font-weight: var(--strong-weight);
}

/* 目录标题前 */
.md-toc-content .md-toc-h1 {
display: var(--toc-show-title);
counter-reset: toc-h2;
}
.md-toc-content .md-toc-h2 {
counter-reset: toc-h3;
}
.md-toc-content .md-toc-h3 {
counter-reset: toc-h4;
}
.md-toc-content .md-toc-h4 {
counter-reset: toc-h5;
}
.md-toc-content .md-toc-h5 {
counter-reset: toc-h6;
}
.md-toc-content .md-toc-h2:before {
counter-increment: toc-h2;
content: counter(toc-h2);
margin-right: 1rem;
font-weight: var(--strong-weight);
}
.md-toc-content .md-toc-h3:before {
counter-increment: toc-h3;
content: counter(toc-h2) "." counter(toc-h3);
margin-left: 1.5rem;
margin-right: 0.5rem;
}
.md-toc-content .md-toc-h4:before {
counter-increment: toc-h4;
content: counter(toc-h2) "." counter(toc-h3) "." counter(toc-h4);
margin-left: 3.5rem;
margin-right: 0.5rem;
}
.md-toc-content .md-toc-h5:before {
counter-increment: toc-h5;
content: counter(toc-h2) "." counter(toc-h3) "." counter(toc-h4) "." counter(toc-h5);
margin-left: 5.5rem;
margin-right: 0.5rem;
}
.md-toc-content .md-toc-h6:before {
counter-increment: toc-h6;
content: counter(toc-h2) "." counter(toc-h3) "." counter(toc-h4) "." counter(toc-h5) "." counter(toc-h6);
margin-left: 7.5rem;
margin-right: 0.5rem;
}

/* 侧边大纲标题 */
.sidebar-content .outline-h1 {
counter-reset: outline-h2;
}
.sidebar-content .outline-h2 {
counter-reset: outline-h3;
}
.sidebar-content .outline-h2 .outline-label:before {
counter-increment: outline-h2;
content: counter(outline-h2) " ";
}
.sidebar-content .outline-h3 {
counter-reset: outline-h4;
}
.sidebar-content .outline-h3 .outline-label:before {
counter-increment: outline-h3;
content: counter(outline-h2) "." counter(outline-h3) " ";
}
.sidebar-content .outline-h4 {
counter-reset: outline-h5;
}
.sidebar-content .outline-h4 .outline-label:before {
counter-increment: outline-h4;
content: counter(outline-h2) "." counter(outline-h3) "." counter(outline-h4) " ";
}
.sidebar-content .outline-h5 {
counter-reset: outline-h6;
}
.sidebar-content .outline-h5 .outline-label:before {
counter-increment: outline-h5;
content: counter(outline-h2) "." counter(outline-h3) "." counter(outline-h4) "." counter(outline-h5) " ";
}

#write .md-fences {
border: 1px solid #F4F4F4;
-webkit-font-smoothing: initial;
margin: 0.8rem 0 !important;
padding: 0.3rem 0 !important;
line-height: 1.43rem;
background-color: #F8F8F8 !important;
border-radius: 2px;
font-family: var(--font-monospace);
font-size: 0.85rem;
word-wrap: normal;
}
#write blockquote {
display: block;
font-size: .9em;
overflow: auto;
border-left: 3px solid rgb(239, 112, 96);
color: #6a737d;
padding: 10px 10px 10px 20px;
margin-bottom: 20px;
margin-top: 20px;
background: #fff9f9;
}


.sidebar-content {
/* 侧边栏的字体修改 */
font-family: var(--ui-font);
list-style: none;
}

/* 元数据(如 YAML front matter)的背景框 */
pre.md-meta-block {
background: #cccccc;
padding: 1.4em;
font-family: var(--code-font), var(--ui-font), monospace;
}

#write > h3.md-focus:before,
#write > h4.md-focus:before,
#write > h5.md-focus:before,
#write > h6.md-focus:before,
h3.md-focus:before,
h4.md-focus:before,
h5.md-focus:before,
h6.md-focus:before {
color: inherit;
border: inherit;
border-radius: inherit;
position: inherit;
left: initial;
float: none;
top: initial;
font-size: inherit;
padding-left: inherit;
padding-right: inherit;
vertical-align: inherit;
font-weight: inherit;
line-height: inherit;
}

大家复制粘贴到到.css文件下,放在Typora主题文件夹下即可使用。

原文始发于微信公众号(猫因的安全):基于Typora由Markdown仿LaTeX风格的主题

  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2023年3月6日19:47:48
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   基于Typora由Markdown仿LaTeX风格的主题http://cn-sec.com/archives/1255314.html

发表评论

匿名网友 填写信息