My question is very simple: can I setup Textadept and Okular in order to get forward and backward search?

Textadept jumps to Okular with Ctrl+R and compiles my ConTeXt file with Ctrl+Shift+R. That is nice, but it is not enough to me.

I have this line in my init.lua yet:

textadept.run.compile_commands.tex = 'mtxrun --autogenerate --script context --autopdf --purge --synctex "%f"'

But seems to me, after Internet searching, that is difficult to achieve my goal.

Just below I have quoted an Aditya's advice about this request, but I have no clue how to handle it yet.

You need to know two commands to setup forward and inverse search: (i) Call textadept to open a specific file at a specific line-number and (ii) Call okular to jump to a specific synctex location. The first is needed for inverse search and the second is needed for forward search.

In relation to my code above, it is worth to note that "synctex=1", "synctex=-1", or simply "synctex", are interchangeable in ConTeXt.

Hans Hagen's statement here says that we have relative small SyncTEX files in ConTeXt because it doesn't use SyncTEX's internal code. Instead, it uses its own logic. However, I have tested SyncTEX in the past with TexWorks and had no problem running forward and inverse search.

Textadept's help page omites SincTEX at all.

My first update:

First things first. I work in a Plasma desktop with context-minimals in /opt/context-minimals/setuptex path.

I use ConTeXt because many reasons. Among other things I can make use of my otf fonts within my /home/username/.font folder.

In order to do that, I added this line into my ~/.bashrc file: source /opt/context-minimals/setuptex. If not, ConTeXt compile my pdf with a fallout font like Latin Modern.

Then, in my home there is a texadept.sh file with this lines inside:

#!/bin/bash source /opt/context-minimals/setuptex


The second line is due to I only could download the portable version.

Well. Therefore, behind my icon for launching Textadept we have the comand "bash /home/username/textadept.sh". That does the trick in order to compile with Textadept using my personal fonts in ~/.fonts, and not with Latin Modern or whatever.

The unsuccessful command I have written in Okular is "/home/username/Software/textadept_10.0_beta_2.x86_64/textadept" "%f" -e textadept.editing.goto_line(%l-1)

Neither when I switch to "bash /home/edu/textadept.sh" "%f" -e textadept.editing.goto_line(%l-1)

For the moment that is my update.

  • Does wiki.contextgarden.net/Textadept help? I can't judge because I have never used Textadept. Commented Jul 19, 2018 at 8:59
  • Actually some days ago this wiki helped me with two advices for my init. lua: textadept.file_types.extensions.tex = 'context' _ and _ui.set_theme('dark', {font = 'Monospace', fontsize = "some number}), but not with my current concern.
    – ebohoyod
    Commented Jul 19, 2018 at 9:20
  • 1
    You need to know two commands to setup forward and inverse search: (i) Call textadept to open a specific file at a specific line-number and (ii) Call okular to jump to a specific synctex location. The first is needed for inverse search and the second is needed for forward search. (I don't know either textadept or okular but I cannot help further, but if you or someone else can add the above information to the question, that will be useful)
    – Aditya
    Commented Jul 19, 2018 at 12:29
  • Uff... This information goes far away from my abilities. But it is very important by itself, because, like you have said, maybe someone else could leverage it. Thanks, Aditya. Nevertheless, I will try to learn something from your hints.
    – ebohoyod
    Commented Jul 19, 2018 at 14:20
  • So forward search works, but not backwards? Does textadept have a command line interface or manual page? If it has the former, what does textadept --help or textadept -h give?
    – cfr
    Commented Jul 21, 2018 at 1:04

1 Answer 1


As you identify, Okular should not be the problem. See an example for kile. What is needed is passing to a single instance of the editor at least the line number you wish to go back to. The recent documentation at first glance seems confusing on the first point (-F is NOT needed, see below) Single Instance:

"Textadept is a single-instance application. This means that after starting Textadept, running textadept file.ext on Linux or BSD (ta file.ext on Mac OSX) from the command line or opening a file with Textadept from a file manager (e.g. Windows) opens file.ext in the original Textadept instance. Passing a -f or --force switch to Textadept overrides this behavior and opens the file in a new instance:... Without the force switch, the original Textadept instance opens files, regardless of the number of instances open. The terminal versions of Textadept do not support single instance."

My answer based on further testing is that I can inverse-search a given line in Textadept from SumatraPDF OR Okular

My simple windows command was using latest available build however it should work with any recent version, just make sure your path to textadept is correctly qualified. NOTE for my builds there was a need to add the -1 at the end since SumatraPDF and Okular count from base 1 but the unmodified textadept seems to count base 0, so you need to subtract with -1

Various builds and add-ins may change that up or down so you may get different results between ConTeX and pdfLaTeX (if I find them I will come back to edit) SumatraPDF and Okular use the same following placeholders: •%f - the file name •%l - (lowercase L) the line of the file to be reached

If your textadept is on your environment path you can simply enter

textadept "%f" -e textadept.editing.goto_line(%l-1)

Depending on the environment your running in, the quotes around %f may not be needed. Equally if you use a portable version or textadept is not on your main path you may need a "quoted path" for either of the two common windows program files locations.

"drive:\path to file\textadept.exe" "%f" -e textadept.editing.goto_line(%l-1)

OR on Linux

/home/YourName/Software/textadept_version/textadept "%f" -e textadept.editing.goto_line(%l-1)

The quotes around %f may not be needed if your filenames do not have spaces so try with and without. Your drive or path will differ and it will not work (no error message is shown) unless you get it exact here is a pictorial to help with all else

enter image description here

  • As I had said to Aditya, your effort and accurate explanations are "high tech" to my poor knowledge. But I can improve my post the next days. Maybe that could clear up my actual status. Thanks.
    – ebohoyod
    Commented Sep 28, 2018 at 12:31
  • I see. Your gráphical explanation is crystal clear. But it is not working for me. My bad, because my all configuration is kind of cumbersome. That is the reason I need to upgrade my post this afternoon or tomorrow morning (Spanish time). Your hint about the single instance of Textadept perhaps was the key. I do not know yet.
    – ebohoyod
    Commented Sep 28, 2018 at 15:18
  • 1
    I don't know your path to textadept so can only hint at how you call it. The first thing to check is that the --synctex=1 or whatever is correctly making a something.synctex or .synctex.gz file at the same time as the .pdf otherwise there is no index for forward-reverse search. Once you have a .pdf with a .synctex file with the same name in the same folder you can test the above (only opening the pdf) until Okular in turn opens textadept then the two way process should be available.
    – user170109
    Commented Sep 28, 2018 at 16:32
  • 1
    if the synctex file and associated pdf have the same date/time its enough for testing that okular can call textadept, even if textadept complains it cant find the correct .tex file to open. It proves the call back is functional, then the only issue that should be left is does the %f need " or ' or \" or none (it can vary depending on system configuration.)
    – user170109
    Commented Sep 28, 2018 at 19:00
  • 1
    one thing that may have a bearing is that --synctex= can be any value between 15 and -15 but for Latex (and probably contex sequence through any other package) it is historically either 1 or -1 since 0 means no file
    – user170109
    Commented Sep 29, 2018 at 0:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .