Stephen Gibson
2012-06-29 05:00:27 UTC
I am attempting to scale an image by prefixing the file name with the
appropriate scalefactor.
My images are stored in a directory called 'Images' and so the following
%!postproc works for a LaTeX target, with a only a single image, but
fails for multiple images on the same input line:
%!postproc(tex): '\{(.*)Images' '[width=\1\\textwidth]{Images'
No doubt my regular expression syntax/understanding is wrong.
(1) How can I make this work?
(2) Is there a more general regex? In my case all I need to match is
{# of the LaTeX \includegraphics{#filename} where #=scalefactor
number, and substitute [width=#\textwidth]{
Thanks,
Steve.
e.g.
txt2tags input file -----------------------------------------------
Title
author
%%date(%c)
%!postproc(tex): '\{(.*)Images' '[width=\1\\textwidth]{Images'
=This works=
The following image scales by 0.5\textwidth in the LaTeX target
[0.5Images/txt2tagslogo.png]
=This fails=
[0.5Images/txt2tagslogo.png] two images [0.5Images/txt2tagslogo.png]
txt2tags tex target output------------------------------------------
\documentclass[a4paper]{article}
\usepackage[margin=15mm]{geometry}
\usepackage{graphicx}
\usepackage{paralist} % needed for compact lists
\usepackage[normalem]{ulem} % needed by strike
\usepackage[urlcolor=blue,colorlinks=true]{hyperref}
\title{Title}
\author{author}
\begin{document}
\date{Fri Jun 29 14:46:50 2012}
\maketitle
\clearpage
\section*{This works}
The following image scales by 0.5$\backslash$textwidth in the LaTeX target
\includegraphics[width=0.5\textwidth]{Images/txt2tagslogo.png}
\section*{This fails}
\includegraphics[width=0.5Images/txt2tagslogo.png} two images
\includegraphics{0.5\textwidth {Images/txt2tagslogo.png}
% LaTeX2e code generated by txt2tags 2.6.967 (http://txt2tags.org)
% cmdline: txt2tags -t tex ck.t2t
\end{document}
appropriate scalefactor.
My images are stored in a directory called 'Images' and so the following
%!postproc works for a LaTeX target, with a only a single image, but
fails for multiple images on the same input line:
%!postproc(tex): '\{(.*)Images' '[width=\1\\textwidth]{Images'
No doubt my regular expression syntax/understanding is wrong.
(1) How can I make this work?
(2) Is there a more general regex? In my case all I need to match is
{# of the LaTeX \includegraphics{#filename} where #=scalefactor
number, and substitute [width=#\textwidth]{
Thanks,
Steve.
e.g.
txt2tags input file -----------------------------------------------
Title
author
%%date(%c)
%!postproc(tex): '\{(.*)Images' '[width=\1\\textwidth]{Images'
=This works=
The following image scales by 0.5\textwidth in the LaTeX target
[0.5Images/txt2tagslogo.png]
=This fails=
[0.5Images/txt2tagslogo.png] two images [0.5Images/txt2tagslogo.png]
txt2tags tex target output------------------------------------------
\documentclass[a4paper]{article}
\usepackage[margin=15mm]{geometry}
\usepackage{graphicx}
\usepackage{paralist} % needed for compact lists
\usepackage[normalem]{ulem} % needed by strike
\usepackage[urlcolor=blue,colorlinks=true]{hyperref}
\title{Title}
\author{author}
\begin{document}
\date{Fri Jun 29 14:46:50 2012}
\maketitle
\clearpage
\section*{This works}
The following image scales by 0.5$\backslash$textwidth in the LaTeX target
\includegraphics[width=0.5\textwidth]{Images/txt2tagslogo.png}
\section*{This fails}
\includegraphics[width=0.5Images/txt2tagslogo.png} two images
\includegraphics{0.5\textwidth {Images/txt2tagslogo.png}
% LaTeX2e code generated by txt2tags 2.6.967 (http://txt2tags.org)
% cmdline: txt2tags -t tex ck.t2t
\end{document}