### Math Environment Examples Source: https://github.com/latex2html/latex2html/blob/master/_autodocs/api-reference/translation-engine.md Demonstrates inline and display math syntax supported by the engine. ```latex This is inline math $x^2 + y^2 = r^2$ in text. Display math: $$\int_0^{\infty} e^{-x} dx = 1$$ ``` -------------------------------- ### Install LaTeX2HTML on Windows Source: https://github.com/latex2html/latex2html/blob/master/docs/support.tex Commands to run the installation test script from a DOS box after configuring the installation files. ```batch cd c:\texmf\latex2html perl install-test ``` -------------------------------- ### Hello World print statements Source: https://github.com/latex2html/latex2html/blob/master/tests/minted.tex Basic Hello World output examples in C and Perl. ```c printf ("Hello world !\n"); ``` ```perl print "Hello world !\n"; ``` -------------------------------- ### Basic Initialization File Configuration Source: https://github.com/latex2html/latex2html/blob/master/_autodocs/initialization-hooks.md Example of a standard .latex2html-init file defining output directories, image settings, and navigation depth. ```perl #!/usr/bin/perl -w # Set output options $TITLE = "My Document"; $DESTDIR = "html_output"; $PREFIX = "doc_"; # Configure images $IMAGE_TYPE = "png"; $MATH_SCALE_FACTOR = 1.8; $TRANSPARENT_FIGURES = 1; # Navigation settings $MAX_SPLIT_DEPTH = 3; $MAX_LINK_DEPTH = 1; # HTML output $LCASE_TAGS = 1; $STRICT_HTML = 1; 1; # Must return true ``` -------------------------------- ### Command Handler Examples Source: https://github.com/latex2html/latex2html/blob/master/_autodocs/api-reference/translation-engine.md Common examples of command handler implementations for standard LaTeX formatting and sectioning commands. ```perl sub do_cmd_bold { ... } # \textbf or \bf sub do_cmd_italics { ... } # \textit or \it sub do_cmd_emph { ... } # \emph{...} sub do_cmd_section { ... } # \section{...} sub do_cmd_subsection { ... } # \subsection{...} ``` -------------------------------- ### Initialize L2hos module Source: https://github.com/latex2html/latex2html/blob/master/_autodocs/api-reference/l2hos-module.md Example of loading the Unix-specific module instance using the L2hos interface. ```perl use L2hos; my $os_module = L2hos->load('unix'); ``` -------------------------------- ### Environment Handler Examples Source: https://github.com/latex2html/latex2html/blob/master/_autodocs/api-reference/translation-engine.md Common examples of environment handler implementations for block-level LaTeX structures. ```perl sub do_env_itemize { ... } # Unordered lists sub do_env_enumerate { ... } # Ordered lists sub do_env_description { ... } # Description lists sub do_env_tabular { ... } # Tables sub do_env_equation { ... } # Equations sub do_env_figure { ... } # Figures sub do_env_quote { ... } # Block quotes ``` -------------------------------- ### Fatal Installation Directory Error Source: https://github.com/latex2html/latex2html/blob/master/_autodocs/errors.md Triggered when the installation directory is missing or misconfigured. ```perl die qq{Fatal: Directory "$LATEX2HTMLDIR" does not exist.\n}; ``` -------------------------------- ### Example Configuration Error Output Source: https://github.com/latex2html/latex2html/blob/master/_autodocs/configuration.md Displays the error message format when an unsupported image type is specified in the configuration. ```text Error: No such image type 'bmp'. This installation supports (first is default): png gif jpg svg ``` -------------------------------- ### Implement Custom Box Environment Source: https://github.com/latex2html/latex2html/blob/master/_autodocs/initialization-hooks.md Example of wrapping LaTeX environment content in custom HTML tags within the .latex2html-init configuration. ```perl # .latex2html-init $environments{'highlight'} = sub { my ($before, $content, $after) = @_; my $html = $before; $html .= qq{
}; $html .= $content; $html .= qq{
}; $html .= $after; return $html; }; ``` ```latex \begin{highlight} Important highlighted content here \end{highlight} ``` ```html
Important highlighted content here
``` -------------------------------- ### Troubleshoot Missing Directory Errors Source: https://github.com/latex2html/latex2html/blob/master/_autodocs/errors.md Verify installation paths and reinstall the package if necessary when encountering fatal directory errors. ```bash # Check installation which latex2html echo $LATEX2HTMLDIR # Reinstall sudo apt-get install --reinstall latex2html ``` -------------------------------- ### Install Missing Dependencies for Image Generation Source: https://github.com/latex2html/latex2html/blob/master/_autodocs/errors.md Commands to install required image processing tools on Ubuntu/Debian and macOS systems. ```bash # Ubuntu/Debian sudo apt-get install netpbm ghostscript texlive-latex-extra # macOS brew install netpbm ghostscript ``` -------------------------------- ### Define LaTeX2HTML Directory Source: https://github.com/latex2html/latex2html/blob/master/docs/userman.tex Variable holding the base installation directory path. ```perl $LATEX2HTMLDIR ``` -------------------------------- ### Configure HTML Validator Source: https://github.com/latex2html/latex2html/blob/master/_autodocs/errors.md Example configuration for setting the HTML validator in the .latex2html-init file. ```perl $HTML_VALIDATOR = "tidy"; # or path to validator ``` -------------------------------- ### Set LATEX2HTMLDIR Environment Variable Source: https://github.com/latex2html/latex2html/blob/master/_autodocs/configuration.md Defines the root installation directory for LaTeX2HTML. ```bash export LATEX2HTMLDIR=/usr/share/latex2html latex2html document.tex ``` -------------------------------- ### Define directory path variables Source: https://github.com/latex2html/latex2html/blob/master/_autodocs/types.md Examples of scalar string variables used for directory paths. ```perl $DESTDIR = "output"; $TMP = "/tmp/latex2html"; ``` -------------------------------- ### Define file path variables Source: https://github.com/latex2html/latex2html/blob/master/_autodocs/types.md Examples of scalar string variables used for file paths. ```perl my $input_file = "document.tex"; my $output_file = "/var/www/html/document.html"; ``` -------------------------------- ### Define a Minipage with Custom Footnote Numbering Source: https://github.com/latex2html/latex2html/blob/master/docs/features.tex This example demonstrates how to use a minipage environment with custom footnote numbering using the mpfootnote counter. ```latex \begin{minipage}{.9\textwidth} \renewcommand{\thempfootnote}{\alph{mpfootnote}} \begin{tabular}{|l|l|} \hline \textbf{Variable} & \textbf{Meaning} \\ \hline none & none \\ Jacobi & $m$-step Jacobi iteration\footnote[1]{one footnote} \\ SSOR & $m$-step SSOR iteration\footnotemark[1] \\ IC & Incomplete Cholesky factorization\footnote[2]{another footnote} \\ ILU & Incomplete LU factorization\footnotemark[2] \\ \hline \end{tabular} \end{minipage} ``` -------------------------------- ### Run LaTeX2HTML with Initialization Source: https://github.com/latex2html/latex2html/blob/master/_autodocs/initialization-hooks.md Execute the conversion process by specifying the initialization file and verify the output. ```bash # Create .latex2html-init with your custom handlers # Run LaTeX2HTML latex2html -init_file .latex2html-init test.tex # Check generated HTML cat test/test.html ``` -------------------------------- ### Basic Project Configuration Source: https://github.com/latex2html/latex2html/blob/master/_autodocs/configuration.md A standard initialization file for basic project documentation settings. ```perl #!/usr/bin/perl -w # Basic settings $TITLE = "My Project Documentation"; $DESTDIR = "html"; # Navigation $MAX_SPLIT_DEPTH = 3; # Split to subsection $NO_AUTO_LINK = 0; # Images $IMAGE_TYPE = "png"; $TRANSPARENT_FIGURES = 1; # HTML output $LCASE_TAGS = 1; $STRICT_HTML = 1; $CHARSET = "utf-8"; 1; # Must return true ``` -------------------------------- ### Project File Structure Source: https://github.com/latex2html/latex2html/blob/master/_autodocs/INDEX.md Overview of the core executable, configuration modules, and directory organization. ```text /workspace/home/latex2html/ ├── latex2html.pin # Main executable (converted to latex2html) ├── prefs.pm # Preferences configuration ├── L2hos.pm # OS abstraction module ├── L2hos/ # OS-specific implementations │ ├── UNIX.pm │ ├── Win32.pm │ └── OS2.pm ├── styles/ # CSS and style files ├── icons/ # Navigation icons ├── docs/ # User manual source └── tests/ # Test suite ``` -------------------------------- ### Create a Windows Batch Wrapper Source: https://github.com/latex2html/latex2html/blob/master/docs/support.tex A sample batch file to simplify running the LaTeX2HTML translator with arguments. ```batch perl c:\texmf\latex2html\latex2html %1 %2 %3 >> l2h.log ``` -------------------------------- ### Create a Minimal Test Document Source: https://github.com/latex2html/latex2html/blob/master/_autodocs/initialization-hooks.md Use a basic LaTeX document to verify custom commands and environments defined in the initialization file. ```latex % test.tex \documentclass{article} \begin{document} \section{Testing Custom Commands} This is a test of \red{red text}. \section{Testing Custom Environments} \begin{highlight} This should be highlighted. \end{highlight} \end{document} ``` -------------------------------- ### Build the DVI manual Source: https://github.com/latex2html/latex2html/blob/master/docs/support.tex Generates the DVI version of the manual from the docs directory. ```bash make manual.dvi ``` -------------------------------- ### Glossary Data Format Source: https://github.com/latex2html/latex2html/blob/master/docs/features.tex Example structure of data lines within the l2hfiles.dat file. ```latex \item[\gn{french.perl}] adds \Perl{} code to be compatible with the ... \item[\gn{\textsl {ftp}}] `File Transfer Protocols', network ... \item[\gn{german.perl}] adds \Perl{} code to be compatible with the ... ... ``` -------------------------------- ### Build the HTML manual Source: https://github.com/latex2html/latex2html/blob/master/docs/support.tex Generates the HTML version of the manual. ```bash make manual.html ``` -------------------------------- ### Help and Version Commands Source: https://github.com/latex2html/latex2html/blob/master/_autodocs/command-line-reference.md Commands to display help information or version details. ```bash latex2html -help ``` ```bash latex2html -version ``` -------------------------------- ### Publish to Web Source: https://github.com/latex2html/latex2html/blob/master/_autodocs/INDEX.md Produces web-ready output with navigation, local icons, and custom up-link configuration. ```bash latex2html -split 2 -auto_link -local_icons \ -up_url "http://example.com/" \ -up_title "Documentation" \ -dir html_output mydoc.tex ``` -------------------------------- ### Load Custom Configuration Source: https://github.com/latex2html/latex2html/blob/master/_autodocs/command-line-reference.md Initializes the converter with settings from a Perl configuration file. ```bash latex2html -init_file config.pl -dir output document.tex ``` -------------------------------- ### Validate Image Type Support Source: https://github.com/latex2html/latex2html/blob/master/_autodocs/errors.md Verifies if the requested image type is included in the supported list for the current installation. ```perl unless(grep(/^\Q$IMAGE_TYPE\E$/o, @IMAGE_TYPES)) { die <<"EOF"; Error: No such image type '$IMAGE_TYPE'. This installation supports (first is default): @IMAGE_TYPES EOF } ``` -------------------------------- ### Identify DBM overflow error Source: https://github.com/latex2html/latex2html/blob/master/docs/problems.tex Example of a DBM-related warning message indicating an overflow of internal database keys. ```text ndbm store returned -1, errno 28, key "xyz" at latex2html line 123 ``` -------------------------------- ### Use DVIPNG Source: https://github.com/latex2html/latex2html/blob/master/_autodocs/command-line-reference.md Use the dvipng tool for faster image generation compared to the default dvips+gs+netpbm pipeline. ```bash latex2html -use_dvipng document.tex ``` -------------------------------- ### Configuration Conflict Resolution Source: https://github.com/latex2html/latex2html/blob/master/_autodocs/configuration.md Demonstrates how command-line arguments override settings defined in the .latex2html-init file. ```bash # In .latex2html-init: $NO_IMAGES = 1; # Command line overrides it: $ latex2html -noimages document.tex # NO_IMAGES stays 1 # But this overrides .latex2html-init: $ latex2html -images document.tex # NO_IMAGES becomes 0 ``` -------------------------------- ### Get Current Working Directory with Cwd() Source: https://github.com/latex2html/latex2html/blob/master/_autodocs/api-reference/l2hos-module.md Retrieves the absolute path to the current working directory in a platform-independent manner. ```perl my $cwd = $os_module->Cwd(); ``` ```perl use L2hos; my $os = L2hos->load('unix'); my $current = $os->Cwd(); print "Working in: $current\n"; ``` -------------------------------- ### Create Init File Source: https://github.com/latex2html/latex2html/blob/master/_autodocs/INDEX.md Defines project-specific configuration variables in a Perl-based initialization file. ```perl # .latex2html-init $TITLE = "My Project"; $DESTDIR = "output"; $IMAGE_TYPE = "png"; $MAX_SPLIT_DEPTH = 3; $NO_AUTO_LINK = 0; 1; ``` ```bash latex2html -init_file .latex2html-init mydoc.tex ``` -------------------------------- ### Display initialization file contents Source: https://github.com/latex2html/latex2html/blob/master/_autodocs/command-line-reference.md Print the contents of the initialization file and exit immediately. ```bash latex2html -show_init ``` -------------------------------- ### Define Metafont Glossary Entry Source: https://github.com/latex2html/latex2html/blob/master/docs/features.tex Example of using the Glossary macro to handle specific text styling for a technical term. ```latex \newcommand{\MF}{\htmlref{\textsl{Metafont}}{GGGmetafont}% \Glossary{metafont}{\textsl{Metafont}}} ``` -------------------------------- ### Use multiprocessing Source: https://github.com/latex2html/latex2html/blob/master/_autodocs/command-line-reference.md Enable multiprocessing for the conversion process if available. ```bash latex2html -fork document.tex ``` -------------------------------- ### Load custom initialization file Source: https://github.com/latex2html/latex2html/blob/master/_autodocs/command-line-reference.md Specify a custom initialization file for the conversion process. ```bash latex2html -init_file my_config.pl document.tex ``` -------------------------------- ### Demonstrate font scoping issue Source: https://github.com/latex2html/latex2html/blob/master/docs/problems.tex Example of incorrect font scoping behavior in LaTeX2HTML where the environment boundary prematurely terminates the font command. ```latex \ttfamily fixed-width font. \begin{something} nothing here \end{something} default font. ``` -------------------------------- ### Enable DJGPP handling Source: https://github.com/latex2html/latex2html/blob/master/_autodocs/command-line-reference.md Toggle specific handling for DOS/Windows Go32 environments. ```bash latex2html -djgpp document.tex ``` -------------------------------- ### Web Publication Settings Source: https://github.com/latex2html/latex2html/blob/master/_autodocs/command-line-reference.md Configures navigation and external links for web-ready output. ```bash latex2html -split 2 -navigation -auto_link \ -up_url "http://example.com/" \ -up_title "Documentation" \ document.tex ``` -------------------------------- ### Enable Short Extensions Source: https://github.com/latex2html/latex2html/blob/master/docs/userman.tex Set the short_extn configuration variable. ```bash $SHORTEXTN` = 1;` ``` -------------------------------- ### Execute Build via Makefile Source: https://github.com/latex2html/latex2html/blob/master/docs/userman.tex Use the Unix make utility to trigger a pre-configured latex2html build process. ```bash make mydocument ``` -------------------------------- ### Web Publishing Configuration Source: https://github.com/latex2html/latex2html/blob/master/_autodocs/configuration.md An initialization file optimized for web publication with external navigation and scalable fonts. ```perl #!/usr/bin/perl -w $TITLE = "Published Documentation"; $DESTDIR = "/var/www/html/docs"; # Full splitting for web $MAX_SPLIT_DEPTH = 8; $MAX_LINK_DEPTH = 2; # External navigation $EXTERNAL_UP_LINK = "http://example.com/"; $EXTERNAL_UP_TITLE = "Main Site"; $NO_NAVIGATION = 0; $AUTO_PREFIX = 1; $IMAGE_TYPE = "png"; $SCALABLE_FONTS = 1; # Use web icons $LOCAL_ICONS = 0; $DEBUG = 0; $VERBOSITY = 0; 1; ``` -------------------------------- ### Configure LaTeX2HTML via initialization file Source: https://github.com/latex2html/latex2html/blob/master/_autodocs/INDEX.md Define project-specific settings in a .latex2html-init file to control output behavior and document metadata. ```perl # .latex2html-init $TITLE = "My Document"; $DESTDIR = "output"; $IMAGE_TYPE = "png"; $MAX_SPLIT_DEPTH = 3; $NO_NAVIGATION = 0; $MATH_SCALE_FACTOR = 1.6; $LCASE_TAGS = 1; 1; ``` -------------------------------- ### Specify Custom Configuration File Source: https://github.com/latex2html/latex2html/blob/master/_autodocs/configuration.md Points to an alternate configuration file location. ```bash export L2HCONFIG=/etc/latex2html/custom.conf latex2html document.tex ``` -------------------------------- ### Development Configuration Source: https://github.com/latex2html/latex2html/blob/master/_autodocs/configuration.md A minimal configuration file for fast build times and debugging during development. ```perl #!/usr/bin/perl -w $TITLE = "Development Build"; $DESTDIR = "./build/html"; # Minimal splitting for fast builds $MAX_SPLIT_DEPTH = 0; # High verbosity for debugging $DEBUG = 1; $VERBOSITY = 2; $TIMING = 1; # Minimal processing $NO_IMAGES = 1; $NO_NAVIGATION = 1; # Local images for debugging $LOCAL_ICONS = 1; 1; ``` -------------------------------- ### Fast Development Build Source: https://github.com/latex2html/latex2html/blob/master/_autodocs/INDEX.md Performs a quick conversion by disabling image generation and navigation, using a specified temporary directory. ```bash latex2html -noimages -nonavigation -tmp /var/tmp mydoc.tex ``` -------------------------------- ### Configure Initialization File Source: https://github.com/latex2html/latex2html/blob/master/_autodocs/api-reference/latex2html-main.md Sets the path for the custom Perl initialization file. ```perl my $INIT_FILE = ""; ``` -------------------------------- ### Handle Missing Output Directories Source: https://github.com/latex2html/latex2html/blob/master/_autodocs/errors.md Create required output directories using the -mkdir flag or by manually creating the directory before execution. ```bash # Create missing directory with -mkdir latex2html -mkdir -dir output/html document.tex # Or create manually first mkdir -p output/html latex2html -dir output/html document.tex ``` -------------------------------- ### Configure Split Options Source: https://github.com/latex2html/latex2html/blob/master/_autodocs/errors.md Demonstrates valid and invalid usage of the -split command-line option. ```bash # Correct usage: latex2html -split 3 document.tex # Depth 3 latex2html -split +2 document.tex # Relative depth latex2html -split 0 document.tex # No splitting # Wrong (these fail): latex2html -split 3.5 document.tex # Float not allowed latex2html -split -1 document.tex # Negative not allowed ``` -------------------------------- ### View internal documentation Source: https://github.com/latex2html/latex2html/blob/master/docs/userman.tex Access the built-in manual for the LaTeX2HTML script using perldoc. ```bash perldoc latex2html ``` -------------------------------- ### Basic Usage Source: https://github.com/latex2html/latex2html/blob/master/_autodocs/command-line-reference.md The standard syntax for invoking the LaTeX2HTML converter. ```bash latex2html [options] file.tex [file2.tex ...] ``` -------------------------------- ### Execute LaTeX2HTML Commands Source: https://github.com/latex2html/latex2html/blob/master/_autodocs/api-reference/latex2html-main.md Common command-line patterns for converting LaTeX documents to HTML. ```bash latex2html document.tex ``` ```bash latex2html -dir output/html document.tex ``` ```bash latex2html -split 0 document.tex ``` ```bash latex2html -init_file my_config.pl document.tex ``` ```bash latex2html -ascii_mode -noimages document.tex ``` ```bash latex2html -nonavigation document.tex ``` -------------------------------- ### Label and Reference Syntax Source: https://github.com/latex2html/latex2html/blob/master/_autodocs/api-reference/translation-engine.md Shows how to define a label and reference it within the document. ```latex \section{Introduction}\label{sec:intro} See Section \ref{sec:intro} on page \pageref{sec:intro}. ``` -------------------------------- ### OS Submodule Methods Source: https://github.com/latex2html/latex2html/blob/master/_autodocs/api-reference/l2hos-module.md Methods available on the object returned by L2hos->load(). ```APIDOC ## OS Submodule Methods ### Methods - **new()** - Constructor for the OS submodule. - **Cwd()** - Returns the current working directory. - **Concat(@components)** - Concatenates path components in a platform-appropriate manner. - **File_Find($pattern, $directory)** - Searches for files matching the pattern in the specified directory. - **is_absolute_path($path)** - Returns true if the path is absolute for the current OS. - **Chdir($directory)** - Changes the current working directory. - **perldoc($module)** - Displays documentation for the specified module. - **shave($string)** - Removes whitespace from command output. ``` -------------------------------- ### Verbatim Environment Usage Source: https://github.com/latex2html/latex2html/blob/master/_autodocs/api-reference/translation-engine.md Illustrates how to include text that should be protected from command interpretation and preserve whitespace. ```latex \begin{verbatim} $ ls -la total 42 \end{verbatim} ``` -------------------------------- ### Handle Errors in Initialization Files Source: https://github.com/latex2html/latex2html/blob/master/_autodocs/initialization-hooks.md Use eval blocks to catch syntax errors and provide safe fallback values for configuration variables. ```perl # .latex2html-init # Catch syntax errors eval { # Custom code that might fail die "Something went wrong" unless $DESTDIR; }; if ($@) { warn "Warning in initialization: $@\n"; # Set safe defaults $DESTDIR = "output"; } ``` -------------------------------- ### Root Directory Configuration Source: https://github.com/latex2html/latex2html/blob/master/_autodocs/command-line-reference.md Sets a fixed root directory for navigation links. ```bash latex2html -rooted -rootdir /var/www/html document.tex ``` -------------------------------- ### Initialize DBM Database Source: https://github.com/latex2html/latex2html/blob/master/_autodocs/api-reference/file-io.md Opens or creates a DBM file for persistent caching of image generation results. ```perl sub open_dbm_database { # Opens persistent DBM database for image caching } ``` ```perl open_dbm_database(); # Initialize cache my $cached = read_mydb("hash_of_equation"); # Check cache write_mydb("new_hash", "image_filename"); # Store result close_dbm_database(); ``` -------------------------------- ### Generate Glossary with makeindex Source: https://github.com/latex2html/latex2html/blob/master/docs/features.tex Command to process the glossary file using the specified style file. ```bash makeindex -o manual.gls -s l2hglo.ist manual.glo ``` -------------------------------- ### Set External Up Navigation Source: https://github.com/latex2html/latex2html/blob/master/_autodocs/api-reference/latex2html-main.md Define the URL and title for the parent document navigation link. ```perl my $EXTERNAL_UP_LINK = ""; my $EXTERNAL_UP_TITLE = ""; ``` -------------------------------- ### Set Custom Initialization Filename Source: https://github.com/latex2html/latex2html/blob/master/_autodocs/configuration.md Defines an alternate name for the local initialization file. ```bash export L2HINIT_NAME=.l2h-custom latex2html document.tex # Searches for .l2h-custom instead of .latex2html-init ``` -------------------------------- ### Use Local Navigation Icons Source: https://github.com/latex2html/latex2html/blob/master/_autodocs/command-line-reference.md Copy navigation icons to the local directory instead of linking to a remote server. ```bash latex2html -local_icons document.tex ``` -------------------------------- ### Creating a Custom OS Extension Source: https://github.com/latex2html/latex2html/blob/master/_autodocs/api-reference/l2hos-module.md Provides a skeleton structure for implementing a new operating system support module within the L2hos framework. ```perl package L2hos::CustomOS; sub new { my $class = shift; return bless {}, $class; } sub Cwd { # Return current working directory } sub Concat { my ($self, @components) = @_; # Join with appropriate separator } # ... other methods ``` -------------------------------- ### Output Directory Management Source: https://github.com/latex2html/latex2html/blob/master/_autodocs/command-line-reference.md Options for specifying and creating output directories. ```bash latex2html -dir output/html document.tex ``` ```bash latex2html -mkdir -dir new_output document.tex ``` ```bash latex2html -no_subdir document.tex ``` -------------------------------- ### Configure LaTeX2HTML initialization Source: https://github.com/latex2html/latex2html/blob/master/docs/problems.tex Ensure the configuration file ends with the required termination line to avoid processing errors. ```perl 1; # This is the last line ``` -------------------------------- ### L2hos->load($OS) Source: https://github.com/latex2html/latex2html/blob/master/_autodocs/api-reference/l2hos-module.md Loads the appropriate OS-specific module based on the provided operating system identifier. ```APIDOC ## L2hos->load($OS) ### Description Loads the appropriate OS-specific module based on the detected operating system. This method is used to initialize the platform-specific interface for file and path operations. ### Signature `L2hos->load($OS)` ### Parameters - **$OS** (String) - Required - Operating system identifier (e.g., "os2", "unix", "win32", "msdos", "darwin") ### Returns - **Reference** (Object) - A reference to the OS-specific module instance. ### Example ```perl use L2hos; my $os_module = L2hos->load('unix'); ``` ``` -------------------------------- ### Process input files with slurp_input_and_partition_and_pre_process Source: https://github.com/latex2html/latex2html/blob/master/_autodocs/api-reference/file-io.md Performs reading, partitioning, and preprocessing in a single operation to improve efficiency. ```perl sub slurp_input_and_partition_and_pre_process { # Combined operation: read, partition, preprocess } ``` -------------------------------- ### Configure Filename Prefixes Source: https://github.com/latex2html/latex2html/blob/master/_autodocs/api-reference/latex2html-main.md Initializes variables for image filename prefixes and automatic prefixing. ```perl my $PREFIX = ""; my $AUTO_PREFIX = 0; ``` -------------------------------- ### Include Navigation Links Source: https://github.com/latex2html/latex2html/blob/master/_autodocs/command-line-reference.md Specify individual links to include in the navigation panel. ```bash latex2html -index_in_navigation document.tex ``` ```bash latex2html -contents_in_navigation document.tex ``` ```bash latex2html -next_page_in_navigation document.tex ``` ```bash latex2html -previous_page_in_navigation document.tex ``` -------------------------------- ### LaTeX manual build sequence Source: https://github.com/latex2html/latex2html/blob/master/docs/support.tex The sequence of commands executed to compile the manual, including index and glossary generation. ```bash latex manual.tex makeindex -s l2hidx.ist manual.idx makeindex -s l2hglo.ist -o manual.gls manual.glo latex manual.tex latex manual.tex ``` -------------------------------- ### L2hos->load($os_name) Source: https://github.com/latex2html/latex2html/blob/master/_autodocs/api-reference/l2hos-module.md Loads the appropriate OS-specific submodule based on the provided OS identifier. ```APIDOC ## L2hos->load($os_name) ### Description Loads the platform-specific submodule (e.g., 'unix') to enable OS-specific operations. ### Parameters - **$os_name** (String) - Required - The identifier for the target operating system. ### Returns - **Object** - An instance of the OS-specific submodule. ``` -------------------------------- ### Configure Auto-Linking Source: https://github.com/latex2html/latex2html/blob/master/_autodocs/command-line-reference.md Create or disable a hard link to index.html for the main page. ```bash latex2html -auto_link document.tex # Create index.html latex2html -noauto_link document.tex # Don't create ``` -------------------------------- ### Run LaTeX2HTML with debug options Source: https://github.com/latex2html/latex2html/blob/master/docs/problems.tex Execute LaTeX2HTML with no_reuse and no_images flags to troubleshoot image generation failures. ```bash cblipca% latex2html -no_reuse -no_images test.tex This is LaTeX2HTML Version 95 (Tue Nov 29 1994) by Nikos Drakos, Computer Based Learning Unit, University of Leeds. OPENING /tmp_mnt/home/cblelca/nikos/tmp/test.tex Cannot create directory /usr/cblelca/nikos/tmp/test: File exists (r) Reuse the images in the old directory OR (d) *** DELETE *** /usr/cblelca/nikos/tmp/test AND ITS CONTENTS OR (q) Quit ? :d Reading ... Processing macros ....+. Reading test.aux ...................... Translating ...0/1........1/1..... Writing image file ... Doing section links ..... *********** WARNINGS *********** If you are having problems displaying the correct images with Mosaic, try selecting "Flush Image Cache" from "Options" in the menu-bar and then reload the HTML file. Done. ``` -------------------------------- ### Convert Single Document Source: https://github.com/latex2html/latex2html/blob/master/_autodocs/INDEX.md Generates HTML output in a subdirectory with navigation enabled and splitting at the section level. ```bash latex2html -split 2 -navigation mydoc.tex ``` -------------------------------- ### Configure Simple Math Mode Source: https://github.com/latex2html/latex2html/blob/master/_autodocs/api-reference/latex2html-main.md Initializes the flag to toggle simple math translation. ```perl my $NO_SIMPLE_MATH = 0; ``` -------------------------------- ### Set Output Directory Source: https://github.com/latex2html/latex2html/blob/master/_autodocs/api-reference/latex2html-main.md Initializes the destination directory path for generated HTML files. ```perl my $DESTDIR = ""; ``` -------------------------------- ### Create custom list markers with htmllist Source: https://github.com/latex2html/latex2html/blob/master/docs/features.tex Use the htmllist environment to define custom item markers. The \htmlitemmark command can be used inside the environment to switch markers dynamically. ```latex \begin{htmllist}[WhiteBall] \item[Item 1:] This will have a white ball. \item[Item 2:] This will also have a white ball. \htmlitemmark{RedBall}% \item[Item 3:] This will have a red ball. \end{htmllist} ``` -------------------------------- ### Create a custom theorem environment Source: https://github.com/latex2html/latex2html/blob/master/_autodocs/initialization-hooks.md Defines a new LaTeX environment that wraps content in HTML divs with an auto-incrementing counter. ```perl # .latex2html-init my $theorem_counter = 0; $environments{'theorem'} = sub { my ($before, $content, $after) = @_; $theorem_counter++; my $html = $before; $html .= qq{
}; $html .= qq{Theorem $theorem_counter. }; $html .= $content; $html .= qq{
}; $html .= qq{
}; $html .= $after; # Proof content follows $html .= qq{
}; return $html; }; ``` -------------------------------- ### Enable PK font generation Source: https://github.com/latex2html/latex2html/blob/master/docs/userman.tex Initiates font generation instead of scaling existing resources. ```Perl $PK_GENERATION = 1; ``` -------------------------------- ### Create a Mailto Link with htmailto Source: https://github.com/latex2html/latex2html/blob/master/docs/hthtml/hthtml.tex Use \htmailto to create a mailto link in HTML or display the address in DVI. ```latex \htmailto{foo@bar} ``` -------------------------------- ### open_dbm_database() Source: https://github.com/latex2html/latex2html/blob/master/_autodocs/api-reference/file-io.md Initializes the persistent DBM database used for image caching. ```APIDOC ## open_dbm_database() ### Description Opens or creates a DBM file in the working directory and ties a Perl hash to the storage for caching image generation results. ### Example ```perl open_dbm_database(); ``` ``` -------------------------------- ### Run LaTeX2HTML on Windows Source: https://github.com/latex2html/latex2html/blob/master/docs/support.tex Command to execute the translator on a specific LaTeX file. ```batch l2h test ``` -------------------------------- ### Set NetPBM Directory Source: https://github.com/latex2html/latex2html/blob/master/_autodocs/configuration.md Specifies the location of NetPBM utilities for image processing. ```bash export NETPBM=/usr/bin ``` -------------------------------- ### Configure Temporary Directory Source: https://github.com/latex2html/latex2html/blob/master/_autodocs/configuration.md Sets the system temporary directory for LaTeX2HTML job files. ```bash export TMPDIR=/var/tmp latex2html -tmp /var/tmp/latex2html_tmp document.tex ``` -------------------------------- ### Command Handler with Arguments and Options Source: https://github.com/latex2html/latex2html/blob/master/_autodocs/initialization-hooks.md Implementation of an \alert[level]{text} command that parses optional and required arguments to generate styled HTML. ```perl # .latex2html-init # \alert[level]{text} where level=1,2,3 $commands{'alert'} = sub { my ($before, $after) = @_; # Extract optional argument my $level = 1; if ($after =~ s/^\s*\[(\d+)\]//) { $level = $1; } # Extract required argument $after =~ s/^\s*\{([^}]*)\}//; my $content = $1; my $colors = ['red', 'orange', 'yellow']; my $color = $colors->[$level - 1] || 'red'; my $html = "
"; $html .= "$content
"; return ($before . $html, $after); }; ``` ```latex \alert{Important} \alert[2]{Warning} \alert[3]{Info} ``` -------------------------------- ### Initialize temporary directory with make_tmp_dir Source: https://github.com/latex2html/latex2html/blob/master/_autodocs/api-reference/file-io.md Creates a writable directory for intermediate files and updates global variables $TMPDIR and $TMP_PREFIX. ```perl sub make_tmp_dir { # Creates temporary directory for processing } ``` ```perl make_tmp_dir(); print "Using temp dir: $TMPDIR\n"; ``` -------------------------------- ### Set External Resource URLs Source: https://github.com/latex2html/latex2html/blob/master/_autodocs/command-line-reference.md Point navigation links to external files for table of contents, index, or bibliography. ```bash latex2html -contents "toc.html" document.tex ``` ```bash latex2html -index "index.html" document.tex ``` ```bash latex2html -biblio "references.html" document.tex ``` -------------------------------- ### Create a cross-referenced index entry Source: https://github.com/latex2html/latex2html/blob/master/docs/features.tex Use the see command in conjunction with htmlref to create a hyperlink to another index entry. ```LaTeX \index{latexe@\LaTeXe |see{\htmlref{\LaTeX}{IIIlatex}}} ``` -------------------------------- ### Generate Concise Index Source: https://github.com/latex2html/latex2html/blob/master/_autodocs/command-line-reference.md Produces a shortened version of the document index. ```bash latex2html -short_index document.tex ``` -------------------------------- ### Configure Info Page Source: https://github.com/latex2html/latex2html/blob/master/_autodocs/command-line-reference.md Controls the generation and content of the document info page. ```bash latex2html -info 0 document.tex # No info page latex2html -info 1 document.tex # Simple info latex2html -info "custom" document.tex # Custom info ``` -------------------------------- ### Specify Image Format Source: https://github.com/latex2html/latex2html/blob/master/_autodocs/command-line-reference.md Set the output format for generated images. ```bash latex2html -image_type png document.tex # PNG (recommended) latex2html -image_type gif document.tex # GIF latex2html -image_type jpg document.tex # JPEG latex2html -image_type svg document.tex # SVG ``` -------------------------------- ### Check and Fix Temporary Directory Issues Source: https://github.com/latex2html/latex2html/blob/master/_autodocs/errors.md Commands to diagnose and resolve temporary directory creation failures. ```bash df -h chmod 777 mkdir -p ``` -------------------------------- ### Execute Preamble Translation Source: https://github.com/latex2html/latex2html/blob/master/_autodocs/api-reference/translation-engine.md Demonstrates extracting and translating the preamble from a source string. ```perl my $preamble = extract_preamble($source); translate_preamble($preamble); ``` -------------------------------- ### Toggle Navigation Panels Source: https://github.com/latex2html/latex2html/blob/master/_autodocs/command-line-reference.md Enable or disable the generation of navigation panels in the output. ```bash latex2html -navigation document.tex # Show navigation latex2html -nonavigation document.tex # Hide navigation ``` -------------------------------- ### Specify Output Directory Source: https://github.com/latex2html/latex2html/blob/master/_autodocs/command-line-reference.md Directs the generated HTML files to a specific folder. ```bash latex2html -dir html_output document.tex ``` -------------------------------- ### Configure File Extensions Source: https://github.com/latex2html/latex2html/blob/master/_autodocs/api-reference/latex2html-main.md Sets the default file extension and the flag for using short extensions. ```perl my $SHORTEXTN = 0; my $EXTN = ".html"; # Changed to .htm if SHORTEXTN is true ``` -------------------------------- ### Construct cross-platform paths with catfile Source: https://github.com/latex2html/latex2html/blob/master/_autodocs/api-reference/file-io.md Use this function to join path components using the appropriate OS-specific separator. ```perl sub catfile { # Concatenates path components using OS separator } ``` ```perl my $path = catfile("output", "images", "img001.png"); # Unix: "output/images/img001.png" # Windows: "output\images\img001.png" ``` -------------------------------- ### Configure External Images Source: https://github.com/latex2html/latex2html/blob/master/_autodocs/api-reference/latex2html-main.md Initializes the flag to store images in the same directory as HTML files. ```perl my $EXTERNAL_IMAGES = 0; ``` -------------------------------- ### Create a Hyperlink with htlink Source: https://github.com/latex2html/latex2html/blob/master/docs/hthtml/hthtml.tex Use \htlink to set text with a link to a URL in HTML, or a footnote in DVI. ```latex \htlink{example}{http://foo.bar/~gnus_and_gnats} ``` -------------------------------- ### Display Documentation with perldoc() Source: https://github.com/latex2html/latex2html/blob/master/_autodocs/api-reference/l2hos-module.md Invokes the platform-appropriate viewer to display Perl documentation for a script. ```perl $os_module->perldoc($script); ``` -------------------------------- ### Define Custom Environment Handlers Source: https://github.com/latex2html/latex2html/blob/master/_autodocs/api-reference/translation-engine.md Use the %environments hash in .latex2html-init to define custom subroutines for processing specific LaTeX environments. ```perl # In .latex2html-init $environments{'myenv'} = sub { my ($before, $content, $after) = @_; return ($before . "
$content
", $after); }; ``` -------------------------------- ### Configure Auto-Linking Source: https://github.com/latex2html/latex2html/blob/master/_autodocs/api-reference/latex2html-main.md Toggle automatic creation of an index.html link to the main document. ```perl my $NO_AUTO_LINK = 0; ``` -------------------------------- ### Create a URL Link with hturl Source: https://github.com/latex2html/latex2html/blob/master/docs/hthtml/hthtml.tex Use \hturl to display a URL as a link in HTML or in typewriter-style in DVI. ```latex \hturl{http://foo.bar/~gnus_and_gnats} ``` -------------------------------- ### Configure Advanced Rendering Options Source: https://github.com/latex2html/latex2html/blob/master/_autodocs/configuration.md Settings for font handling, icon management, and external tool options. ```perl $LOCAL_ICONS = 1; ``` ```perl $SCALABLE_FONTS = 1; ``` ```perl $DVIPSOPT = "-Ppdf"; # Use PDF-optimized fonts ``` ```perl $METAFONT_DPI = 600; # Higher resolution ``` ```perl $PK_GENERATION = 1; ``` -------------------------------- ### Configure Transparent Figures Source: https://github.com/latex2html/latex2html/blob/master/_autodocs/api-reference/latex2html-main.md Initializes the flag for generating transparent images. ```perl my $TRANSPARENT_FIGURES = 1; ``` -------------------------------- ### Configure Navigation Panel Settings Source: https://github.com/latex2html/latex2html/blob/master/docs/userman.tex Controls the number of words used in navigation titles and the minimum page length for bottom navigation panels. ```perl $WORDS_IN_NAVIGATION_PANEL_TITLES = 4; ``` ```perl $WORDS_IN_PAGE = 450; ``` -------------------------------- ### Main Driver Subroutine Source: https://github.com/latex2html/latex2html/blob/master/_autodocs/api-reference/latex2html-main.md The primary entry point for processing LaTeX files. ```perl sub driver { local($FILE, $orig_cwd, %unknown_commands, %dependent, %depends_on, %styleID, %env_style, $bbl_cnt, $dbg, %numbered_section); # ... main processing loop } ``` -------------------------------- ### Store Images Locally Source: https://github.com/latex2html/latex2html/blob/master/_autodocs/command-line-reference.md Store images in the same directory as the HTML output instead of a separate subdirectory. ```bash latex2html -external_images document.tex ``` -------------------------------- ### Configure Math Parsing Source: https://github.com/latex2html/latex2html/blob/master/_autodocs/api-reference/latex2html-main.md Initializes the flag to toggle sophisticated math equation parsing. ```perl my $NO_MATH_PARSING = 0; ``` -------------------------------- ### Enable Scalable Fonts Source: https://github.com/latex2html/latex2html/blob/master/_autodocs/command-line-reference.md Use scalable fonts (SVG) instead of bitmap images. ```bash latex2html -scalable_fonts document.tex ``` -------------------------------- ### slurp_input_and_partition_and_pre_process() Source: https://github.com/latex2html/latex2html/blob/master/_autodocs/api-reference/file-io.md Performs a combined operation of reading, partitioning, and pre-processing a document in a single pass. ```APIDOC ## slurp_input_and_partition_and_pre_process() ### Description Executes a multi-step file processing operation that reads the input, partitions it into sections, and pre-processes those sections. ### Returns - **Document Structure**: Returns the partitioned and preprocessed document structure. ``` -------------------------------- ### Execute common LaTeX2HTML command-line operations Source: https://github.com/latex2html/latex2html/blob/master/_autodocs/INDEX.md Use these commands for standard document conversion, directory management, and debugging. ```bash # Basic conversion latex2html document.tex # Specify output directory latex2html -dir output document.tex # No splitting (single file) latex2html -split 0 document.tex # With initialization file latex2html -init_file config.pl document.tex # ASCII only (no images) latex2html -noimages -ascii_mode document.tex # Debug mode latex2html -debug -verbosity 2 document.tex ``` -------------------------------- ### Set Filename Prefix Source: https://github.com/latex2html/latex2html/blob/master/_autodocs/configuration.md Sets a prefix for image and resource filenames. ```perl $PREFIX = "doc_"; # Images: doc_img001.png, doc_img002.png ``` -------------------------------- ### Generate PostScript images Source: https://github.com/latex2html/latex2html/blob/master/_autodocs/command-line-reference.md Configure the converter to produce PostScript images instead of bitmaps. ```bash latex2html -ps_images document.tex ``` -------------------------------- ### Define Glossary Macros Source: https://github.com/latex2html/latex2html/blob/master/docs/features.tex Macros for inserting file names and application names while simultaneously creating glossary entries. ```latex \newcommand{\fn}[1]{\htmlref{\texttt{#1}}{GGG#1}\glossary{#1}} \newcommand{\appl}[1]{\htmlref{\textsl{#1}}{GGG#1}% \Glossary{#1}{\textsl{#1}}} ``` -------------------------------- ### Raw HTML Inclusion Source: https://github.com/latex2html/latex2html/blob/master/_autodocs/api-reference/translation-engine.md Demonstrates the use of the \html command to inject raw HTML into the document. ```latex \html{} ``` -------------------------------- ### Execute Full Document Translation Source: https://github.com/latex2html/latex2html/blob/master/_autodocs/api-reference/translation-engine.md Demonstrates the workflow for reading, pre-processing, and translating a LaTeX file. ```perl my $latex = slurp_input("document.tex"); pre_process($latex); translate($latex); # Now $latex contains HTML ``` -------------------------------- ### Set Top Page Title Source: https://github.com/latex2html/latex2html/blob/master/docs/userman.tex Assign a title to the generated document using the -t command-line option. ```bash $TITLE` = 34`top-page-title`34;` ``` -------------------------------- ### Input Generated Glossary File Source: https://github.com/latex2html/latex2html/blob/master/docs/features.tex LaTeX command to conditionally input the generated glossary file or log a warning if missing. ```latex \InputIfFileExists{manual.gls}{\clearpage\typeout{^^Jcreating Glossary...}} {\typeout{^^JNo Glossary, since manual.gls could not be found.^^J}} ``` -------------------------------- ### Integrating L2hos in latex2html.pin Source: https://github.com/latex2html/latex2html/blob/master/_autodocs/api-reference/l2hos-module.md Demonstrates basic usage of L2hos for path manipulation, directory retrieval, and help documentation display. ```perl use L2hos; # Get current working directory my $cwd = L2hos->Cwd(); # Build paths my $tmpdir = L2hos->Concat($output, "tmp"); # Check path type if (L2hos->is_absolute_path($path)) { ... } # Display help documentation L2hos->perldoc($SCRIPT); ``` -------------------------------- ### Filename Extension Configuration Source: https://github.com/latex2html/latex2html/blob/master/_autodocs/command-line-reference.md Sets the file extension for generated HTML files. ```bash latex2html -short_extn document.tex ``` -------------------------------- ### Define Versions Directory Path Source: https://github.com/latex2html/latex2html/blob/master/docs/userman.tex Specifies the directory path for version and extension files. ```perl $LATEX2HTMLVERSIONS = $LATEX2HTMLDIR/versions; ```