MacroTeX Usage Guide
MacroTeX is a VSCode extension that helps with inserting macros in LaTeX documents.
Table of contents
Features
- Macro completion for image paths
- Image preview on hover
- Bulk image insertion from explorer
- Configurable LaTeX macros
Getting Started
- Install the MacroTeX extension from the VSCode marketplace
- Open your LaTeX project in VSCode
- The extension will automatically detect your main LaTeX file
Using MacroTeX
Auto-completion
- Start typing a LaTeX macro (e.g.
\fg ) in your .tex file
- The extension will show available paths that match the macro's file typrs requirements
- Select a path to automatically insert the complete macro with proper paths
Extension creates snippets from user defined macros.
Image Preview
- Hover over an image path in your LaTeX document
- A preview of the image will be displayed in a hover tooltip
Bulk Image Insertion
- In the VSCode explorer, select one or multiple images/folders
- Right-click and select "Insert in active document"
- Choose the macro you want to use
- The extension will:
- Insert the selected images using the chosen macro
- Create proper relative paths
- Generate identifiers based on folder/file names
- Optionally insert
\clearpage after every 2 images
Example usage:

Configuration
Configure macros in VSCode settings. Example minimal setup:
"latexMacros.macrosList": [
{
"signature": "\\fg{PATH}{}{}",
"extensions": ["png", "jpg"]
}
]
Path Management
- Automatic relative path generation to main LaTeX file
- Smart path completion based on workspace
- Support for nested directory structures
Custom Macros
When creating custom macros, understand these placeholders:
{PATH} : Required for path autocompletion
{Caption} : Optional, for image captions
{Identifier} : Optional, for reference labels
Example configuration:
{
"signature": "\\fg[width]{PATH}{Caption}{Identifier}",
"extensions": ["png", "jpg"]
}
Corresponding LaTeX macro:
\newcommand*{\fg}[4][\textwidth]{
\begin{figure}[!htb]
\begin{center}
\includegraphics[width=#1]{#2}
\caption{#3}
\label{rys:#4}
\end{center}
\end{figure}
}
Troubleshooting
Common Issues
- Macro not appearing in suggestions
- Check if file extension is supported
- Verify macro configuration in settings
- Image preview not working
- Ensure image path is correct
- Check if image format is supported
Support
- Report issues on GitHub repository
- Check documentation for updates
- Join community discussions
| |