Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add extra CLI arg to specify tex file #7

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions evince_synctex.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ def get_uri(file):
return 'file://%s' % (urllib.parse.quote(path, safe="%/:=&?~#+!$,;'@()*[]"))


def startEvince(line, pdf_file, editor_command):
def startEvince(line, tex_file, pdf_file, editor_command):
logger = logging.getLogger('evince_synctex')
logger.setLevel(logging.DEBUG)
logger.addHandler(logging.StreamHandler())
Expand All @@ -157,7 +157,8 @@ def startEvince(line, pdf_file, editor_command):
pdf_uri, False, dbus_interface=EV_DAEMON_IFACE)

if (line is not None):
tex_file = os.path.splitext(pdf_file)[0] + '.tex'
if (tex_file is None):
tex_file = os.path.splitext(pdf_file)[0] + '.tex'
dbus_name = daemon.FindDocument(
pdf_uri, True, dbus_interface=EV_DAEMON_IFACE)
window = bus.get_object(dbus_name, EV_WINDOW_PATH)
Expand Down Expand Up @@ -190,6 +191,8 @@ def main():
parser = argparse.ArgumentParser(description=__doc__.lstrip())
parser.add_argument('-f', '--forward', type=int,
dest='line', metavar='LINE', help='Performs a forward search with specified line number')
parser.add_argument('-t', '--tex',
dest='tex_file', metavar='TEX_FILE', help='Specifies the TeX file for which the line number is given')
parser.add_argument('pdf_file', metavar='PDF_FILE',
help='The PDF file to display')
parser.add_argument('editor_command', metavar='EDITOR_COMMAND',
Expand Down