   (use-package tex
     ;; AUCTeX
     :ensure auctex
-    :init
-    (setq TeX-source-correlate-method 'synctex) ;; use SyncTeX for forward/backward search between source/PDF output
+    :demand
     :config
     ;;(add-hook 'LaTeX-mode-hook 'flyspell-mode)
     ;;(add-hook 'LaTeX-mode-hook 'flyspell-buffer)

      '(define-key company-active-map (kbd "M-h") #'company-quickhelp-manual-begin))
    )

  ;; (use-package helm-company
  ;;   ;; Helm interface for company-mode
  ;;   :ensure t
  ;;   :bind
  ;;   (("C-;" . helm-company))
  ;;   :demand
  ;;   :config
  ;;   (eval-after-load 'company
  ;;     '(progn
  ;; 	 (defun indent-or-complete ()
  ;; 	   (interactive)
  ;; 	   (if (looking-at "\\_>")
  ;; 	       (helm-company)
  ;; 	     (indent-according-to-mode)))
  ;; 	 ))
  ;;   )

  (use-package company-shell
    ;; company mode completion backends for your shell functions:

  (use-package company
    ;; complete anything
    :ensure t
    ;; :bind
    ;; (("<S-SPC>" . company-complete) ;; recommended to use TAB instead (which uses helm-company, see below)
    ;;  ("M-n" . company-select-next)
    ;;  ("M-p" . company-select-previous))
    :init
    ;;(add-hook 'after-init-hook 'global-company-mode)
    (add-hook 'c-mode-common-hook 'company-mode)
    (add-hook 'emacs-lisp-mode-hook 'company-mode)
    (add-hook 'comint-mode-hook 'company-mode)
    (add-hook 'LaTeX-mode-hook 'company-mode)
    ;;(add-hook 'sh-mode-hook 'company-mode)
    ;;(add-hook 'python-mode-hook 'company-mode)
    :config
    (setq company-dabbrev-downcase 0)
    ;; set timeout to 10 seconds
    (setq company-async-timeout 10)
    ;; Cancel selections by typing non-mathcing characters
    (setq company-require-match 'never)
    ;; Minimum length of word to start completion
    (setq company-minimum-prefix-length 2)
    ;; Autocomplete only when I explicitly mean to
    (setq company-auto-complete nil)
    (set 'company-idle-delay 1)
