Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/src/packages/next/pages/features/latex-editor.tsx
Views: 687
/*1* This file is part of CoCalc: Copyright © 2022 Sagemath, Inc.2* License: MS-RSL – see LICENSE.md for details3*/45import { Descriptions, Layout } from "antd";67import { Icon } from "@cocalc/frontend/components/icon";8import Backups from "components/landing/backups";9import Code from "components/landing/code";10import Collaboration from "components/landing/collaboration";11import Comparison from "components/landing/compare";12import Content from "components/landing/content";13import Footer from "components/landing/footer";14import Head from "components/landing/head";15import Header from "components/landing/header";16import Info from "components/landing/info";17import LaTeX from "components/landing/latex";18import Pitch from "components/landing/pitch";19import Publishing from "components/landing/publishing";20import SignIn from "components/landing/sign-in";21import { Paragraph, Text, Title } from "components/misc";22import A from "components/misc/A";23import { Customize } from "lib/customize";24import withCustomize from "lib/with-customize";25import LatexCollab from "public/features/cocalc-latex-concurrent-editing.png";26import LatexEditorImage from "public/features/cocalc-latex-editor-2019.png";27import Sidechat from "public/features/cocalc-latex-side-chat-v2.png";28import Pythontex from "public/features/cocalc-pythontex.png";29import Sagetex from "public/features/cocalc-sagetex.png";30import AIFormula from "public/features/latex-ai-formula.png";31import CustomCommand from "public/features/latex-custom-command-02.png";32import Knitr from "public/features/latex-editor-rnw-01.png";33import LatexTimetravel from "public/features/latex-editor-timetravel-01.png";34import Logo from "public/features/latex-logo.svg";3536export default function LatexEditor({ customize }) {37return (38<Customize value={customize}>39<Head title="Online LaTeX Editor" />40<Layout>41<Header page="features" subPage="latex-editor" />42<Layout.Content>43<Content44landing45startup={<LaTeX />}46body={Logo}47title={"Online LaTeX Editor"}48subtitle={49<>50Focus on writing LaTeX. CoCalc takes care of everything else.51<hr />52<A href="https://about.cocalc.com/2023/01/13/cocalcs-online-latex-editor/">53Learn much more about LaTeX in CoCalc from this new blog54post...55</A>56</>57}58image={LatexEditorImage}59/>6061<Pitch62col1={63<>64<Title level={2}>65No software install required: <small>100% online</small>66</Title>67<Paragraph>68CoCalc{"'"}s{" "}69<A href="https://doc.cocalc.com/latex.html">70<LaTeX /> editor71</A>{" "}72supports73</Paragraph>74<Paragraph>75<ul>76<li>77<strong>side-by-side preview</strong> with{" "}78<strong>forward and inverse search</strong>,79</li>80<li>81compiles upon saving and marks errors in the source file,82</li>83<li>84periodically <a href="#a-backups">backups</a> all your85files,86</li>87<li>88an{" "}89<strong>90<a href="#a-ai-formula">AI-powered formula assistant</a>91</strong>{" "}92typsets formulas for you93</li>94<li>95<strong>96<a href="#a-calculations">runs embedded calculations</a>97</strong>{" "}98right inside your document,99</li>100<li>101<strong>102<A href="https://doc.cocalc.com/latex-features.html#latex-multi-file-support">103multi-file support104</A>105</strong>{" "}106that discovers included files automatically, and107</li>108<li>109every{" "}110<strong>111<a href="#a-timetravel">change is recorded</a>112</strong>{" "}113while you type.114</li>115</ul>116</Paragraph>117</>118}119col2={120<>121<Title level={2}>122Working with <LaTeX /> made easy123</Title>124<Paragraph>125<Descriptions126layout="vertical"127bordered128column={1}129size={"small"}130>131<Descriptions.Item132label="Tired of sending changes back and forth with your133colleagues?"134>135<strong>136<a href="#a-realtimesync">Collaborate online</a>137</strong>{" "}138without any limits!139</Descriptions.Item>140141<Descriptions.Item label="Scared of breaking a document?">142Revert recent changes using{" "}143<a href="#a-timetravel">TimeTravel</a>.144</Descriptions.Item>145146<Descriptions.Item147label={148<>149Worried about maintaining your <LaTeX /> environment?150</>151}152>153CoCalc takes care of everything.154</Descriptions.Item>155156<Descriptions.Item label="Want to work from anywhere?">157You only need a web browser and Internet access, or you158can <A href="/pricing/onprem">run your own server.</A>159</Descriptions.Item>160</Descriptions>161</Paragraph>162</>163}164ext="tex"165/>166167<SignIn startup={<LaTeX />} />168169<Collaboration image={LatexCollab} />170171<Info172anchor="a-ai-formula"173icon="robot"174title="AI-powered formula assistant"175image={AIFormula}176alt="Generate LaTeX formulas based on a human readable descriptions via AI"177>178<Paragraph>179CoCalc's extensive integation with various AI language models180helps you typesetting formulas.181</Paragraph>182<Paragraph>183You enter a description of your desired formula and{" "}184<strong>185a language model of your choice transforms it into a proper186LaTeX formula187</strong>188. The descriptions can come in various ways:189<Descriptions190layout="vertical"191bordered192column={1}193size={"small"}194>195<Descriptions.Item label="Natural language description">196<Text code>drake equation</Text>197</Descriptions.Item>198199<Descriptions.Item label="simple algebraic notation">200<Text code>(a+b)^2 = a^2 + 2 a b + b^2</Text>201</Descriptions.Item>202203<Descriptions.Item label="Or a combination of both">204<Text code>205integral from 0 to infinity of (1+sin(x))/x^2 dx206</Text>207</Descriptions.Item>208</Descriptions>209</Paragraph>210<Paragraph>211Once you got a result you like, click on "Insert" the formula is212in your document.213</Paragraph>214</Info>215216<Info217anchor="a-computational"218icon="laptop"219title="Full computational environment"220image={LatexEditorImage}221alt="Two browser windows editing the same LaTeX file"222wide223>224<Paragraph>225One thing that sets CoCalc apart from other online <LaTeX />{" "}226editors is <strong>full access to computational software</strong>.227This means you can seamlessly transition from <em>computing</em>{" "}228your results to <em>publishing</em> them.229</Paragraph>230<Paragraph>231CoCalc supports running <A href="/features/python">Python</A>,{" "}232<A href="http://www.sagemath.org/">SageMath</A>,{" "}233<A href="/features/r-statistical-software">234R Statistical Software235</A>236, <A href="/features/julia">Julia</A>, and more in the same237project as your <LaTeX /> document.238</Paragraph>239<Paragraph>240Consult the <A href="/software">Available Software page</A> or241look at our{" "}242<A href="/features/jupyter-notebook">Jupyter Notebook page</A> for243more information.{" "}244</Paragraph>245</Info>246247<Info248anchor="a-calculations"249textStyleExtra={{ background: "inherit" }}250title={251<>252Run SageMath, Python, or R in <LaTeX />253</>254}255alt="A LaTeX document with embedded SageMath code"256>257<Paragraph>258You can run calculations inside your <LaTeX /> documents! It's259possible to embed Sage, R, or Python code in your document to260automatically generate text, plots, formulas or tables. The code261is evaluated as part of the compilation process and the output262will be included in the generated document.263</Paragraph>264</Info>265266<Info267anchor="a-sagetex"268title="SageTex"269icon="sagemath"270image={Sagetex}271alt="Editing LaTeX with SageTex code"272>273<Paragraph>274<strong>275<A href="http://doc.sagemath.org/html/en/tutorial/sagetex.html">276SageTeX277</A>{" "}278lets you embed <A href="https://www.sagemath.org/">SageMath</A>{" "}279in your document!280</strong>281</Paragraph>282<Paragraph>283Write Sage commands like{" "}284<Code>285\sage{"{"}2 + 3{"}"}286</Code>{" "}287in <LaTeX /> and the document will contain "5",{" "}288<Code>289\sage{"{"}f.taylor(x, 0, 10){"}"}290</Code>{" "}291for the Taylor expansion of a function <em>f</em>, and drawing292graphs becomes as simple as{" "}293<Code>294\sageplot{"{"}sin(x^2){"}"}295</Code>296.297</Paragraph>298<Paragraph>299<strong>300CoCalc deals with all the underlying details for you:301</strong>302</Paragraph>303<Paragraph>304<ul>305<li>It runs the initial compilation pass,</li>306<li>307uses <A href="https://www.sagemath.org/">SageMath</A> to308compute the text output, graphs and images,309</li>310<li>311and then runs a second compilation pass to produce the final312PDF output.313</li>314</ul>315</Paragraph>316</Info>317318<Info319anchor="a-pythontex"320title="PythonTex"321icon="python"322image={Pythontex}323alt="Editing LaTeX with PythonTex code"324>325<Paragraph>326<strong>327<A href="https://ctan.org/pkg/pythontex">PythonTeX</A> allows328you to run Python from within a document and typeset the329results.330</strong>331</Paragraph>332<Paragraph>333For example,{" "}334<Code>335\py{"{"}2 + 4**2{"}"}336</Code>{" "}337produces "18". You can use all{" "}338<A href="/software/python">available python libraries</A> for339Python 3, drawing plots via <code>pylab</code>, and use340PythonTeX's SymPy support.341</Paragraph>342<Paragraph>343Again, CoCalc automatically detects that you want to run PythonTeX344and handles all the details for you.{" "}345</Paragraph>346</Info>347348<Info349anchor="a-knitr"350title="R/Knitr"351icon="r"352image={Knitr}353alt="Editing LaTeX with R/Knitr code"354>355<Paragraph>356CoCalc's <LaTeX /> editor also supports{" "}357<strong>358<A href="https://yihui.name/knitr/">Knitr</A>359</strong>{" "}360documents (with filename extension <code>.Rnw</code>). This gives361you the ability to embed arbitrary{" "}362<A href="https://www.r-project.org/">R Software</A> commands and363plots in your <LaTeX /> file.364</Paragraph>365<Paragraph>366Behind the scenes, CoCalc deals with all underlying details for367you:368</Paragraph>369<Paragraph>370<ul>371<li>372installation and management of{" "}373<A href="/software/r">all R packages</A>,374</li>375<li>376orchestrates the full compilation pipeline for <LaTeX /> and377running R, and378</li>379<li>380reconciles the line numbers of the .Rnw file with the381corresponding .tex document for correct{" "}382<A href="#a-forwardinverse">383<strong>forward and inverse search</strong>384</A>385.{" "}386</li>387</ul>388</Paragraph>389</Info>390391<Info.Heading392description={393<>394The following are some specific features of editing <LaTeX /> in395CoCalc.396<br />397There is also more{" "}398<A href="https://doc.cocalc.com/latex.html">399comprehensive documentation400</A>401.402</>403}404>405<LaTeX /> Editing Features406</Info.Heading>407408<Info409anchor="a-forwardinverse"410title="Forward and Inverse search"411icon="sync"412video={[413"features/latex-forward-inverse-02.webm",414"features/latex-forward-inverse-02.mp4",415]}416wide417alt="Video showing forward and inverse search in a LaTeX document"418>419<Paragraph>420Let CoCalc help you find your way around in large documents!421</Paragraph>422<Paragraph>423<strong>Forward Search</strong> lets you jump from the <LaTeX />{" "}424source to the corresponding part in the rendered preview. This425saves you time looking for the output.426</Paragraph>427<Paragraph>428<strong>Inverse search</strong> does the opposite: double click on429the output and your cursor jumps to the line in the source file430for that output.431</Paragraph>432<Paragraph>433Under the hood, CoCalc uses{" "}434<A href="https://github.com/jlaurens/synctex">SyncTeX</A>{" "}435seamlessly.436</Paragraph>437</Info>438439<Info440anchor="a-environments"441icon="tex-file"442title={443<>444Managed <LaTeX /> environments445</>446}447image={CustomCommand}448alt="Menu showing the different LaTeX engines in CoCalc"449>450<Paragraph>451CoCalc makes sure that your desired <LaTeX /> engine is available452and ready to use. You can choose between{" "}453<strong>454<A href="http://www.tug.org/applications/pdftex/">PDF Latex</A>455</strong>456,{" "}457<strong>458<A href="http://xetex.sourceforge.net/">XeLaTeX</A>459</strong>{" "}460or{" "}461<strong>462<A href="http://www.luatex.org/">LuaTeX</A>463</strong>464.465</Paragraph>466<Paragraph>467Many packages and utilities like{" "}468<A href="https://sourceforge.net/projects/pgf/">PGF and TikZ</A>{" "}469are pre-installed.470</Paragraph>471<Paragraph>472Behind the scenes,{" "}473<A href="http://mg.readthedocs.io/latexmk.html">LatexMK</A> is474configured to manage the compilation process.475</Paragraph>476<Paragraph>477It is also possible to{" "}478<strong>fully customize the compilation command</strong>, so you479can bring your own shell script or even use a Makefile!480</Paragraph>481</Info>482483<Info484anchor="a-timetravel"485title="TimeTravel"486icon="history"487image={LatexTimetravel}488alt={489"Using the TimeTravel slider to see what changed in a LaTeX document"490}491>492<Paragraph>493The <strong>TimeTravel feature</strong> is specific to the CoCalc494platform. It records all changes in the document in fine detail.495You can go back and forth in time using a slider across thousands496of changes to recover your previous edits.497</Paragraph>498<Paragraph>499This is especially helpful for pinpointing which of the recent500changes caused a <strong>compilation error</strong>. You can see501the recent changes and exactly where the modifications happened,502and who made them.503</Paragraph>504</Info>505506<Info507anchor="a-chat"508title="Side Chat"509icon="comment"510image={Sidechat}511alt="Chatting about a LaTeX document right next to that document"512>513<Paragraph>514A{" "}515<strong>516<A href="https://doc.cocalc.com/chat.html">side-by-side chat</A>517</strong>{" "}518for each <LaTeX /> file lets you discuss your content with519collaborators or give feedback to your students while they are520working on their assignments.521</Paragraph>522<Paragraph>523Collaborators who are offline will be notified about new messages524the next time they sign in. If you @mention them, they receive an525email notification.526</Paragraph>527<Paragraph>528Chat messages also support{" "}529<A href="https://en.wikipedia.org/wiki/Markdown">Markdown</A>{" "}530formatting with <LaTeX /> formulas.{" "}531</Paragraph>532</Info>533534<Backups />535<Publishing />536537<Comparison538name="latex"539disclaimer540title={541<h2 style={{ textAlign: "center" }}>542<Icon name="bolt" /> <LaTeX /> in CoCalc versus the competition543</h2>544}545/>546547<SignIn startup={<LaTeX />} />548</Layout.Content>549<Footer />550</Layout>551</Customize>552);553}554555export async function getServerSideProps(context) {556return await withCustomize({ context });557}558559560