【Hacker News搬运】探索与LaTeX类似的新型排版系统Typst
-
Title: Exploring Typst, a new typesetting system similar to LaTeX
探索与LaTeX类似的新型排版系统Typst
Text:
Url: https://blog.jreyesr.com/posts/typst/
很抱歉,作为一个AI,我无法直接访问或分析外部网站的内容,包括您提供的链接。不过,我可以帮助您了解如何使用JinaReader这样的工具来抓取和分析内容,并指导您如何进行内容翻译。 以下是一个基本的步骤指南,展示如何使用JinaReader或其他类似工具来抓取内容、分析内容并翻译非中文内容: 1. **安装JinaReader**: 如果您还没有安装JinaReader,您需要先安装它。通常,您可以通过以下命令进行安装(以Python环境为例): ```bash pip install jina
-
抓取内容:
使用JinaReader的API或命令行工具来抓取网页内容。以下是一个使用Python的示例代码:from jina import Client # 创建一个Jina客户端 client = Client() # 使用客户端发送请求到Jina的worker response = client.post( method="search", input={"text": "https://blog.jreyesr.com/posts/typst/"}, flow_name="my_flow" ) # 输出抓取的内容 print(response)
-
分析内容:
抓取到内容后,您可以使用JinaReader内置的功能或自定义的处理器来分析内容。例如,您可以分析文本摘要、关键词提取等。 -
翻译非中文内容:
如果抓取到的内容不是中文,您需要将其翻译成中文。这通常需要使用翻译API,如Google翻译API、Microsoft Translator Text API等。以下是一个使用Google翻译API的Python示例:from googletrans import Translator translator = Translator() translation = translator.translate('抓取的内容', src='auto', dest='zh-cn') print(translation.text)
-
总结内容:
最后,您可以根据分析结果和翻译后的内容进行总结。这可能包括提取关键信息、撰写摘要或生成报告。
请注意,以上代码仅为示例,实际使用时可能需要根据您的具体需求和环境进行调整。另外,使用第三方API进行翻译时,您可能需要注册并获取API密钥。
## Post by: judell ### Comments: **__mharrison__**: I've moved all of my LaTeX-based content creation to Typst.<p>It's:<p>- Fast—Compiling my books would take around 1 minute (I often had to compile twice due to indexing). With Typst, it takes less than 5 seconds.<p>- Easy to write—I actually don't write it, I wrote a bunch of Pandoc plugins to tweak the output from Pandoc (I write all my books in Jupyter these days, so lots of markdown).<p>- Easy to read—I've used LaTeX for years (and wrote a bunch of tooling around it) and still couldn't tell you when to use a { or a [. Typst is very readable.<p>- Easy to script—Okay, I did write some Typst the other day. I migrated my LaTeX-based invoicing system to Typst. I created a list of objects with pricing and count and was able to throw it into a table easily. It has less code than my LaTeX version, which was using a library, and is easier to read. (I did need to write a function to properly format $ because that doesn't exist. A few rounds with AI made that easy.)<p>- Has great error messages—If you've used LaTeX, you know what I mean.<p>My needs are different from others, but I'm writing PDFs that need to be printed into a real book that looks professional. This includes front matter, footnotes, callouts, page numbers, page headers and footers, and indexes. I don't do a lot of math-heavy stuff, so I can't comment on that. And the widow/orphan support is a little weak.<p>Otherwise, I'm happy to never use LaTeX again! > **__mharrison__**: 我;我把所有基于LaTeX的内容创作都转移到了Typst<p> 它;s: <p>-快速-编译我的书大约需要1分钟(由于索引,我经常不得不编译两次)。使用Typst,只需不到5秒<p> -很容易写——我其实不写;我写了一堆Pandoc插件来调整Pandoc的输出(这些天我所有的书都是用Jupyter写的,所以有很多降价)<p> -易于阅读;我使用LaTeX多年(并围绕它编写了一堆工具),但仍然无法;我不会告诉你什么时候使用{或[.Typst非常可读。<p>-易于编写脚本-好吧,我前几天确实写了一些Typst。我将基于LaTeX的发票系统迁移到了Typst上。我创建了一个包含定价和计数的对象列表,并能够轻松地将其放入表中。它的代码比我的LaTeX版本少,后者使用库,更容易阅读。(我确实需要编写一个函数来正确格式化$,因为它不存在。几轮人工智能使这变得容易。)<p>——有很多错误消息——如果你使用过LaTeX,你知道我的意思。<p>我的需求与其他人不同,但我正在写PDF,需要打印成一本看起来专业的真正的书。这包括封面、脚注、标注、页码、页眉和页脚以及索引。我不做很多数学繁重的事情,所以我不能对此发表评论。寡妇孤儿的支持有点弱。<p]否则,我很高兴再也不用LaTeX了! **YmiYugy**: In the very limited time I used typst it has been pretty amazing, but imho there is one missing feature that a LaTeX successor, but even more so, templating engine should have. Come up or adapt a format, that can defer certain styling decisions to the consumer of the document. Stuff like, font, font size, line spacing, citation style, double or single column, numeration style, etc.<p>On a different note, we got to find a better way to exchange data than pdf reports. In my totally made up estimation about 10% of development time for enterprise software is spend on variations of these pdf templating tools and another 20% on extracting data from such generated pdfs. > **YmiYugy**: 在我使用typst的非常有限的时间里,它非常棒,但我发现LaTeX的继任者缺少一个功能,更重要的是,模板引擎应该具备这个功能。提出或调整一种格式,这可以将某些样式决策推迟给文档的消费者。字体、字体大小、行距、引用样式、双列或单列、计数样式等。<p>另一方面,我们必须找到一种比pdf报告更好的数据交换方式。根据我的全面估计,企业软件的开发时间中约有10%用于这些pdf模板工具的变体,另外20%用于从生成的pdf中提取数据。 **vslavkin**: I've been looking into it. It's `blazingly fast` (aside from the rust joke, it really is way faster than latex), the syntax is more "modern", consistent, etc.<p>The main problem is the popularity. It just does not have enough packages, at least for my use case.<p>I mainly do a lot of equations (simple math), and a loooot of tikz (forest, circuitikz, pgfplots, etc.) [<a href="https://gitlab.com/vslavkin/escuela/-/tree/main/5to?ref_type=heads" rel="nofollow">https://gitlab.com/vslavkin/escuela/-/tree/main/5to?ref_type...</a>] I'm not a fan of tikz, but it's the only way to mantain the graphics homogeneous, clean, easily editable, compiled with the document and with links/references. Cetz (the typst alternative) is years behind. I've been thinking of contributing, but tikz is really complex, and I don't have enough time ATM.<p>Besides the typst packages, it also lacks the editor packages. I am an emacs user <i>insert joke here</i>, and I use AucTeX, which is a really great, and gigant package to edit latex (+cdlatex). AFAIK there's nothing like it for typst, which makes me way slower.<p>Another thing is that they changed the math syntax. While the latex one wasn't perfect it was insanely popular, because of its use on markdown and a lot of pages (and this was thanks to mathjax iirc).<p>The good thing is that something like latex or typst will always be needed, so there'll always people that want to have something like it; latex/tex isn't really great, and it has a really low entry bar.<p>Maybe I'll switch when I have more time to study it and make packages. (It could be as soon as next year or a late as... never) > **vslavkin**: 我;我一直在调查。它;“快得惊人”(除了铁锈笑话,它真的比乳胶快得多),语法更“;“现代”;,主要问题是受欢迎程度。它只是没有足够的包,至少对我的用例来说是这样<p> 我主要做很多方程式(简单的数学),以及一系列tikz(森林、电路、pgfplots等)[<a href=“https://”gitlab.com“vslavkin”escuela“-”tree“main”5to“ref_type”heads“rel=”nofollow“>https://”git lab.com“-vslavkin”escuela“-”树“main”5to“ref_type…</a>]我;我不是tikz的粉丝,但它;这是保持图形均匀、干净、易于编辑、与文档和链接一起编译的唯一方法;参考文献。Cetz(打字员的替代品)落后了好几年。我;我一直在考虑做出贡献,但tikz真的很复杂,我不这么认为;我没有足够的ATM时间<p> 除了打字包,它还缺少编辑器包。我是一个emacs用户<I>在这里插入笑话</I>,我使用AucTeX,这是一个非常棒的巨型软件包来编辑latex(+cdlatex)。AFAIK在那里;打字员一点也不像,这让我慢了很多<p> 另一件事是他们改变了数学语法。而乳胶不是;不完美的是,它非常受欢迎,因为它在markdown和很多页面上都有使用(这要归功于mathjax-irc)<p> 好消息是,总是需要乳胶或打字员之类的东西,所以有;总是有人想拥有这样的东西;乳胶;tex不是;它真的不太好,而且入门门槛很低<p> 也许我;等我有更多时间研究它并制作包,我就换了。(可能最快明年,也可能最晚……永远不会) **alphazard**: This is neat. I've used Latex before, and it definitely suffers from poor ergonomics. Both the language and tooling contribute to this.<p>The selling point seems to be that this is more similar to Markdown. That makes sense, Markdown is objectively more common and has more users than Latex. I've used both, but Markdown way more often.<p>Here's something I don't understand: it would be trivial to make Typst even more similar to Markdown, and yet it exists at some strange middle point in the language design space, arbitrarily far from Markdown. > **alphazard**: 这很整洁。我;我以前用过乳胶,它肯定存在人体工程学不佳的问题。语言和工具都对此做出了贡献<p> 卖点似乎是这更类似于Markdown。这是有道理的,Markdown在客观上比Latex更常见,用户也更多。我;我两者都用过,但Markdown更常用<p> 这里;这是我不喜欢的;我不明白:让Typst更像Markdown是微不足道的,但它存在于语言设计空间的某个奇怪的中间点,与Markdown相距甚远。 **elashri**: Previous discussions about Typst.<p><a href="https://news.ycombinator.com/item?id=41014941">https://news.ycombinator.com/item?id=41014941</a><p><a href="https://news.ycombinator.com/item?id=38354422">https://news.ycombinator.com/item?id=38354422</a><p><a href="https://news.ycombinator.com/item?id=38047224">https://news.ycombinator.com/item?id=38047224</a><p><a href="https://news.ycombinator.com/item?id=35250210">https://news.ycombinator.com/item?id=35250210</a><p><a href="https://news.ycombinator.com/item?id=34423590">https://news.ycombinator.com/item?id=34423590</a> > **elashri**: 之前关于Typst的讨论<p> <a href=“https://news.ycombinator.com/item?id=41014941”>https://news.ymbinator.com/;news.ecombinator.com;项目?id=41014941</a><p><a href=“https:/;news.ycombinator.com/;item?id=38354422”>https:"/;news.ecombinator.com;项目?id=38354422</a><p><a href=“https:/;news.ycombinator.com/;item?id=38047224”>https:"/;news.ecombinator.com;项目?id=38047224</a><p><a href=“https:/;news.ycombinator.com/;item?id=35250210”>https:"/;news.ecombinator.com;项目?id=35250210</a><p><a href=“https:/;news.ycombinator.com/;item?id=34423590”>https:"/;news.ecombinator.com;项目?id=34423590</a>
-