Skip to content

How to add line numbers to your report #104

Description

@wlangera

This is for documentation purposes. It might be handy for review to add line numbers.
This is how:

1. Add instructions to yaml header

header-includes:
  - \usepackage[left]{lineno}
  - \linenumbers

2. Install the lineno package

If you do not have the lineno LaTeX package, you may get this or a similar error when building your report:

LaTeX Error: File `lineno.sty' not found.

This error is saved in a .log file.
You can install this package via the log file by running this code in your console:

tinytex::parse_install("`name_of_your_report_rproject`.log")

If you get an error here, you may need to install a newer version of TinyTeX first (see next point).
Then run the above code again in your console.

3. Updating TinyTeX

You may get a message that TinyTeX has a newer version.
It can also help to update TinyTeX if you are unable to install a package.
You can do this by running this code in your console:

tinytex::reinstall_tinytex()

You can also specify a repository yourself, for example tinytex::reinstall_tinytex(repository = "illinois").

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions