> For the complete documentation index, see [llms.txt](https://overleaf-pro.ayaka.space/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://overleaf-pro.ayaka.space/latex/overleaf-learn-latex-pt/perguntas-e-respostas/05-can-i-run-plain-tex-on-overleaf.md).

# Posso executar TeX puro no Overleaf?

Sim—pode configurar o seu projeto para ser compilado usando plain TeX seguindo o procedimento de configuração descrito abaixo.

1. No editor do Overleaf, clique no **Menu** botão e defina a **Compilador** opção para `LaTeX`—selecione `LaTeX` na lista pendente, como mostrado no seguinte vídeo:

{% embed url="<https://www.filepicker.io/api/file/Iw9UYRbxRBy3Bk61YKqj>" %}

3. Adicione um ficheiro em branco ao seu projeto e guarde-o como `latexmkrc`—não deve ter nenhuma extensão de ficheiro (pode não ser necessário adicionar isto se o seu projeto já tiver um ficheiro `latexmkrc` ).
4. Adicione a seguinte linha ao seu `latexmkrc` ficheiro:

```
$latex = 'tex %O %S';
```

#### O que é que este ficheiro latexmkrc realmente faz?

Sem entrar em detalhes, os servidores do Overleaf usam um programa chamado [`latexmk`](https://mg.readthedocs.io/latexmk.html) para executar e controlar a composição tipográfica baseada em TeX/LaTeX. O `latexmk` programa permite aos utilizadores do Overleaf influenciar a composição tipográfica dos seus projetos adicionando um ficheiro de configuração chamado `latexmkrc`. Os leitores que quiserem explorar isto mais a fundo podem ler sobre o `latexmkrc` ficheiro de configuração no [o `latexmk` sítio Web](https://mg.readthedocs.io/latexmk.html#configuration-files).

#### Exemplos

O `latexmk` programa está escrito na [linguagem de programação Perl](https://www.perl.org/) que usa o caráter sustenido (#) como caráter de comentário (tal como o TeX/LaTeX normalmente usa o caráter %). Se quiser experimentar plain TeX usando diferentes motores TeX, pode criar um `latexmkrc` ficheiro e copiar/colar o seguinte texto nele:

```
# $latex = 'tex %O %S'; # para usar o motor TeX original de Knuth
# $latex = 'pdftex %O %S'; # para usar o motor pdfTeX
# $latex = 'luatex %O %S'; # para usar o motor LuaTeX
# $latex = 'xetex %O %S';  # para usar o motor XeTeX
```

Para usar um determinado motor TeX, descomente a linha (apague o caráter '#' inicial) correspondente ao motor TeX que pretende usar. Por exemplo, para executar o XeTeX, descomente a última linha para que o seu `latexmkrc` ficheiro fique como o seguinte—note que a última linha não começa com um caráter '#', pelo que é executada/corrida para compor o seu documento plain TeX usando XeTeX:

```
# $latex = 'tex %O %S'; # para usar o motor TeX original de Knuth
# $latex = 'pdftex %O %S'; # para usar o motor pdfTeX
# $latex = 'luatex %O %S'; # para usar o motor LuaTeX
$latex = 'xetex %O %S';  # para usar o motor XeTeX
```

O seguinte vídeo curto mostra o acima `latexmkrc` ficheiro a ser editado seletivamente para executar, por sua vez, cada motor TeX—começando com o XeTeX. O código-fonte plain TeX usado neste exemplo foi retirado de [um artigo de D. R. Wilkins](https://www.ntg.nl/doc/wilkins/pllong.pdf).

{% embed url="<https://www.filepicker.io/api/file/9PVmkgTSSny7gjNliTdt>" %}

### Leitura adicional

Temos dois itens de ajuda relacionados que podem ser do interesse de qualquer leitor que queira compreender melhor a utilização do Overleaf de `latexmk` e `latexmkrc`:

* [Como é que o Overleaf compila o meu projeto?](/latex/overleaf-learn-latex-pt/base-de-conhecimento/064-how-does-overleaf-compile-my-project.md)
* [Como usar latexmkrc com o Overleaf: exemplos e técnicas](/latex/overleaf-learn-latex-pt/artigos-aprofundados/28-how-to-use-latexmkrc-with-overleaf.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://overleaf-pro.ayaka.space/latex/overleaf-learn-latex-pt/perguntas-e-respostas/05-can-i-run-plain-tex-on-overleaf.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
