1

I was wondering why thee images are not showing up.

For the code From :https://www.overleaf.com/learn/latex/TikZ_package

\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\draw[gray, thick] (-1,2) -- (2,-4);
\draw[gray, thick] (-1,-1) -- (2,2);
\filldraw[black] (0,0) circle (2pt) node[anchor=west]{Intersection point};
\end{tikzpicture}
\end{document}

I receive this image enter image description here LATEX workshop in VS code is also installed.

I received an error message.

Rc files read:
  /Users/nasa_william_lu/.latexmkrc
Latexmk: Run number 1 of rule 'latex'
This is pdfTeX, Version 3.141592653-2.6-1.40.24 (TeX Live 2022) (preloaded format=latex)
 restricted \write18 enabled.
entering extended mode
Latexmk: If appropriate, the -f option can be used to get latexmk
  to try to force complete processing.
Latexmk: Getting log file 'out/LaTeX Solution Template.log'
Latexmk: Log file says no output from latex
Latexmk: For rule 'latex', no output was made
Collected error summary (may duplicate other messages):
  latex: Command for 'latex' gave return code 1
      Refer to 'out/LaTeX Solution Template.log' for details

The picture is rendered perfectly in OverLeaf. enter image description here

All the other materials are rendered just fine. All my texts, equations, tables are all correct.

This problem didn't happen a week ago. During this week, I think I updated it once using sudo tlmgr update --self && sudo tlmgr update --all. That's when it stopped working.

So I uninstalled the current 2022 version and install the latest 2022 from MacTex .pkg installer.

Thank you so much for your time reading this. Really appreciate any help!

UPDATE: THE CODE cannot produce any images in VS Code but can produce images in TexShop enter image description here

UPDATE: I added the following to the settings.json file

{
// your other settings
// ...
// ...
// ---------- Language ----------
    "[tex]": {
        // Enable intellisence/quick suggestions
        "editor.suggest.snippetsPreventQuickSuggestions": false,
        // Indentation size
        "editor.tabSize": 2
    },
    "[latex]": {
        // Enable intellisence/quick suggestions
        "editor.suggest.snippetsPreventQuickSuggestions": false,
        // Indentation size
        "editor.tabSize": 2
    },
    "[bibtex]": {
        // Indentation size
        "editor.tabSize": 2
    },
    // ---------- LaTeX Workshop ----------
    //  Enable command and environment completion for used package
    "latex-workshop.intellisense.package.enabled": true,
    // target file when deleting generated file
    // Add "* .synctex.gz" to default value
    "latex-workshop.latex.clean.fileTypes": [
        "*.aux",
        "*.bbl",
        "*.blg",
        "*.idx",
        "*.ind",
        "*.lof",
        "*.lot",
        "*.out",
        "*.toc",
        "*.acn",
        "*.acr",
        "*.alg",
        "*.glg",
        "*.glo",
        "*.gls",
        "*.ist",
        "*.fls",
        "*.log",
        "*.fdb_latexmk",
        "*.snm",
        "*.nav",
        "*.dvi",
        "*.synctex.gz"
    ],
    // dump generated files to "out" directory
    "latex-workshop.latex.outDir": "out",
    // Build recipe
    "latex-workshop.latex.recipes": [
        {
            "name": "latexmk",
            "tools": [
                "latexmk"
            ]
        },
    ],
    // Parts used in the build recipe
    "latex-workshop.latex.tools": [
        {
            "name": "latexmk",
            "command": "latexmk",
            "args": [
                "-silent",
                "-outdir=%OUTDIR%",
                "%DOC%"
            ],
        },
    ],
}

as per this site: https://towardsdatascience.com/how-to-auto-update-pdf-when-working-on-latex-ad9eeabdb7a1

4
  • What does the .log file contains when you try with VS Code? You have this output: Latexmk: Getting log file 'out/LaTeX Solution Template.log' and Refer to 'out/LaTeX Solution Template.log' for details. Try to find relevant messages in it.
    – quark67
    Mar 18, 2023 at 10:18
  • $quark67 problem solved. Thank you! Mar 18, 2023 at 23:01
  • You could write an answer to your question if you have find the error in the log file and how you have resolved it, so this can be useful for others.
    – quark67
    Mar 18, 2023 at 23:11
  • @quark67 Thanks for your suggestion! Actually this is my first answer. It feels great helping others. Mar 19, 2023 at 4:05

1 Answer 1

3

The solution to this problem: something wrong with the LaTex Workshop environment.

This applies to you if you have a:

  • mac os latest as of 2023 March
  • VSCode
  • LaTex workshop in VS code installed
  • MacTex installed

And most importantly, you have added extra settings to enable automatic pdfLaTex compile as per this site https://towardsdatascience.com/how-to-auto-update-pdf-when-working-on-latex-ad9eeabdb7a1.

The site comprises two parts:

  1. nano and modify the LaTex behavior
  2. Modify the settings.json file within VS Code

It turns out, that it's the 2. that prevents TikZ from being compiled. While the root of the cause has not been located, it is advisable that you only do the 1. according to the tutorial on that site and do Not modify the LaTeX workshop settings in VS Code via the settings.json file.

The ultimate result is that although 2. was deleted, the LaTex file can still automatically compile, albeit slightly less responsively.

You must log in to answer this question.

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