> 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/sv/fragor-och-svar/04-can-i-add-inline-or-margin-comments-to-the-pdf.md).

# Kan jag lägga till kommentarer i löpande text eller i marginalen i PDF:en?

Ja, du kan använda [`todonotes` paketet](https://ctan.org/pkg/todonotes?lang=en) (täcks här) eller läs vår hjälpsida om [marginalanteckningar](/latex/sv/formatering/15-margin-notes.md), som behandlar [`\marginpar` kommandot](/latex/sv/formatering/15-margin-notes.md#the-5cmarginpar-command) och [`marginnote` paketet](/latex/sv/formatering/15-margin-notes.md#an-alternative-to-5cmarginpar-the-marginnote-package).

## Laddar paketet todonotes

För att använda `todonotes` paketet, lägg till följande rad i ditt dokuments preamble:

```latex
\usepackage[colorinlistoftodos]{todonotes}
```

Den `colorinlistoftodos` alternativet lägger till små färgade rutor i listan över att-göra-anteckningar (se nedan), vilket hjälper till att skilja mellan olika typer.

* **Obs**: Läsare uppmanas starkt att bläddra igenom [`todonotes` dokumentationen](http://mirrors.ctan.org/macros/latex/contrib/todonotes/todonotes.pdf) för information om paketalternativ, användbara kommandon och hjälpsamma exempel.

Använd följande kommando för att lägga till en kommentar:

```latex
\todo{Detta är en kommentar som kommer att visas i marginalen}
```

## Exempel som använder paketet todonotes

Nedan följer ett grundläggande exempel som hjälper dig att komma igång: det visar olika anteckningsstilar och skapar en lista över att-göra-anteckningar via kommandot

```latex
\listoftodos[En titel för din lista...]
```

som tar ett valfritt argument, inneslutet i `[...]`, som används för att sätta en titel för listan över anteckningar.

```latex
\documentclass[a4paper]{article}
\usepackage[colorlinks]{hyperref}
\usepackage[colorinlistoftodos]{todonotes}
\begin{document}
\listoftodos[En lista över saker jag behöver slutföra]

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Nulla
\todo{Vanliga todonotes.} urna. Maecenas interdum nunc in augue.
Mauris quis massa in ante tincidunt mollis. Proin imperdiet.
Donec porttitor pede id est. Sed in ante. Integer id arcu. Nam
lectus nisl, posuere sit amet, imperdiet ut, tristique ac, lorem.
In erat. In commodo enim. \todo[color=blue!40]{Todonote med en annan färg.}%
Phasellus libero ipsum, tempor a, pharetra consequat, pellentesque
sit amet, sem. Praesent ut augue luctus elit adipiscing ultricies.
Vestibulum suscipit cursus leo. Nullam molestie justo.

Morbi dui. Morbi convallis mi sed sem. Nulla convallis lacus vitae
risus. Phasellus adipiscing. Nullam tortor. Sed laoreet aliquam
ante. Vestibulum diam. Pellentesque nec leo. Pellentesque velit.
\todo[nolist]{Todonote som endast visas i marginalen och inte i
listan över att-göra-anteckningar.}%
Praesent congue mi eu ipsum cursus fringilla. Etiam leo erat,
tristique et, pharetra eget, mollis vitae, velit. In hac habitasse
\todo[size=\small, color=green!40]{En anteckning med litet teckensnitt.}%
platea dictumst. In quam nibh, facilisis et, laoreet non, facilisis
tempus, justo. Class aptent taciti sociosqu ad litora torquent per
conubia nostra, per inceptos himenaeos.

\todo[inline]{test test}

Donec nulla lectus, faucibus sit amet, auctor non, consectetuer
quis, pede. Nullam dictum. Nullam suscipit, ligula in scelerisque
\todo[noline]{En anteckning utan linje tillbaka till texten.}%
posuere, sapien purus rutrum magna, vitae pharetra leo quam vel
tortor. Donec eleifend condimentum sapien. Etiam sed orci. Aliquam
\todo[inline, color=red!50]{Anteckningar i löpande text.}%
tempor. Pellentesque egestas tortor id eros. Donec mauris justo,
commodo id, pellentesque id, eleifend non, mi. Duis venenatis
sagittis metus. Donec tempus metus id lacus. Praesent vel diam.
Morbi nec ante. Vestibulum varius felis ac lacus. Nulla vitae neque
\todo[inline, color=green!40]{En anteckning utan linje tillbaka till texten.}%
in nibh bibendum volutpat. Quisque accumsan diam. Aenean ultricies
nisl ac lacus. Aliquam posuere. Aenean venenatis tortor in felis.
\end{document}
```

Öppna detta exempel i Overleaf

Det här exemplet ger följande utdata:

![Demonstrerar paketet todonotes i Overleaf](/files/fa0b615d1a00c4ba39a8e7236ba5cc0ecc7c34c1)

## Vidare läsning

* Den [`todonotes` dokumentationen](http://mirrors.ctan.org/macros/latex/contrib/todonotes/todonotes.pdf) innehåller information om paketalternativ, användbara kommandon och hjälpsamma exempel.
* Overleafs hjälpsida om [marginalanteckningar](/latex/sv/formatering/15-margin-notes.md) behandlar [`\marginpar` kommandot](/latex/sv/formatering/15-margin-notes.md#the-5cmarginpar-command) och [`marginnote` paketet](/latex/sv/formatering/15-margin-notes.md#an-alternative-to-5cmarginpar-the-marginnote-package).


---

# 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/sv/fragor-och-svar/04-can-i-add-inline-or-margin-comments-to-the-pdf.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.
