Disable BBcode encoding within a latex tag

Disable BBcode encoding within a latex tag

Hello, I have the following bb function

function bb($string) {
  $string = trim($string);
  $search = array(
    '@\<(?i)latex\>(.*?)\</(?i)latex\>@si',
    '@\<(?i)b\>(.*?)\</(?i)b\>@si',
    '@\<(?i)i\>(.*?)\</(?i)i\>@si',
    '@\<(?i)u\>(.*?)\</(?i)u\>@si',
    '@\<(?i)blockquote\>(.*?)\</(?i)blockquote\>@si',
    '@\<(?i)pre\>(.*?)\</(?i)pre\>@si'
  );
  $replace = array(
    '<img src="cgi/mathtex.cgi?\\1">',
    '<b>\\1</b>',
    '<i>\\1</i>',
    '<u>\\1</u>',
    '<blockquote>\\1</blockquote>',
    '<pre>\\1</pre>'
  );
  $string = strtr($string, array("\n" => '<br>'));
  $string = preg_replace($search ,$replace, $string);
  return $string;
}

The problem is that if one enters newlines within latex tags (to make latex more clearly arranged), the function replaces the \n by <br>, which then becomes of course invalid latex code. How to disable the encoding of code which is within latex tags?

View Answers

October 6, 2012 at 12:01 AM

fixed!









Related Tutorials/Questions & Answers:
Disable BBcode encoding within a latex tag
Disable BBcode encoding within a latex tag  Hello, I have... invalid latex code. How to disable the encoding of code which is within latex tags... is that if one enters newlines within latex tags (to make latex more clearly
Set encoding from within SQL*Plus
Set encoding from within SQL*Plus  Hi, In Oracle server I am running sql query from sqlplus which is adding Spanish data. But data is converted wrongly due to UTF conversion. How to resolve this. Thanks   Hi, Run
Advertisements
ModuleNotFoundError: No module named 'bbcode'
ModuleNotFoundError: No module named 'bbcode'  Hi, My Python... 'bbcode' How to remove the ModuleNotFoundError: No module named 'bbcode'... to install padas library. You can install bbcode python with following command
ModuleNotFoundError: No module named 'django-bbcode'
ModuleNotFoundError: No module named 'django-bbcode'  Hi, My... 'django-bbcode' How to remove the ModuleNotFoundError: No module named 'django-bbcode' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'mde_bbcode'
ModuleNotFoundError: No module named 'mde_bbcode'  Hi, My Python... 'mde_bbcode' How to remove the ModuleNotFoundError: No module named 'mde_bbcode' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'django-bbcode'
ModuleNotFoundError: No module named 'django-bbcode'  Hi, My... 'django-bbcode' How to remove the ModuleNotFoundError: No module named 'django-bbcode' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'django-precise-bbcode'
ModuleNotFoundError: No module named 'django-precise-bbcode'  Hi...: No module named 'django-precise-bbcode' How to remove the ModuleNotFoundError: No module named 'django-precise-bbcode' error? Thanks   Hi
ModuleNotFoundError: No module named 'lektor-mathshistory-bbcode'
ModuleNotFoundError: No module named 'lektor-mathshistory-bbcode'  Hi...: No module named 'lektor-mathshistory-bbcode' How to remove the ModuleNotFoundError: No module named 'lektor-mathshistory-bbcode' error? Thanks
ModuleNotFoundError: No module named 'django-content-bbcode'
ModuleNotFoundError: No module named 'django-content-bbcode'  Hi...: No module named 'django-content-bbcode' How to remove the ModuleNotFoundError: No module named 'django-content-bbcode' error? Thanks   Hi
ModuleNotFoundError: No module named 'django-precise-bbcode'
ModuleNotFoundError: No module named 'django-precise-bbcode'  Hi...: No module named 'django-precise-bbcode' How to remove the ModuleNotFoundError: No module named 'django-precise-bbcode' error? Thanks   Hi
ModuleNotFoundError: No module named 'latex'
ModuleNotFoundError: No module named 'latex'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'latex' How to remove the ModuleNotFoundError: No module named 'latex'
ModuleNotFoundError: No module named 'latex'
ModuleNotFoundError: No module named 'latex'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'latex' How to remove the ModuleNotFoundError: No module named 'latex'
ModuleNotFoundError: No module named 'latex'
ModuleNotFoundError: No module named 'latex'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'latex' How to remove the ModuleNotFoundError: No module named 'latex'
disable function
disable function  Sir, I have called a java script function when one radio button is checked i want to disable this function when another radio button is checked ,both radio buttons are of same group Please help Thanks in advance
Version of com.nfbsoftware>latex-converter dependency
List of Version of com.nfbsoftware>latex-converter dependency
ModuleNotFoundError: No module named 'array-to-latex'
ModuleNotFoundError: No module named 'array-to-latex'  Hi, My... named 'array-to-latex' How to remove the ModuleNotFoundError: No module named 'array-to-latex' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'delphin-latex'
ModuleNotFoundError: No module named 'delphin-latex'  Hi, My... 'delphin-latex' How to remove the ModuleNotFoundError: No module named 'delphin-latex' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'latex_snippet'
ModuleNotFoundError: No module named 'latex_snippet'  Hi, My... 'latex_snippet' How to remove the ModuleNotFoundError: No module named 'latex_snippet' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'latex_snippet'
ModuleNotFoundError: No module named 'latex_snippet'  Hi, My... 'latex_snippet' How to remove the ModuleNotFoundError: No module named 'latex_snippet' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'ooxml_to_latex'
ModuleNotFoundError: No module named 'ooxml_to_latex'  Hi, My... named 'ooxml_to_latex' How to remove the ModuleNotFoundError: No module named 'ooxml_to_latex' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'simple-latex'
ModuleNotFoundError: No module named 'simple-latex'  Hi, My Python... 'simple-latex' How to remove the ModuleNotFoundError: No module named 'simple-latex' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'apyref-latex'
ModuleNotFoundError: No module named 'apyref-latex'  Hi, My Python... 'apyref-latex' How to remove the ModuleNotFoundError: No module named 'apyref-latex' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'array-to-latex'
ModuleNotFoundError: No module named 'array-to-latex'  Hi, My... named 'array-to-latex' How to remove the ModuleNotFoundError: No module named 'array-to-latex' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'based-latex'
ModuleNotFoundError: No module named 'based-latex'  Hi, My Python... 'based-latex' How to remove the ModuleNotFoundError: No module named 'based-latex' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'delphin-latex'
ModuleNotFoundError: No module named 'delphin-latex'  Hi, My... 'delphin-latex' How to remove the ModuleNotFoundError: No module named 'delphin-latex' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'django-latex'
ModuleNotFoundError: No module named 'django-latex'  Hi, My Python... 'django-latex' How to remove the ModuleNotFoundError: No module named 'django-latex' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'jirafs-latex'
ModuleNotFoundError: No module named 'jirafs-latex'  Hi, My Python... 'jirafs-latex' How to remove the ModuleNotFoundError: No module named 'jirafs-latex' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'jupyterlab-latex'
ModuleNotFoundError: No module named 'jupyterlab-latex'  Hi, My... named 'jupyterlab-latex' How to remove the ModuleNotFoundError: No module named 'jupyterlab-latex' error? Thanks   Hi, In your
How to disable an HTML object?
How to disable an HTML object?  How to disable an HTML object
enable disable checkbox in javascript
enable disable checkbox in javascript  How to enable disable checkbox in javascript
uikeyboard disable return key
uikeyboard disable return key  uikeyboard - hot to disable return key
JSF verbatim Tag
of this tag. This tag can be used to nest plain html within the JSF component tree. Any Html and jsp tags in the view tag can be nested within verbatim tag. The reason...JSF verbatim Tag      
Disable UITableView Scrolling
Disable UITableView Scrolling   How to disable the UITableView Scrolling either programmatically or in XIB
disable keyboard in java applet
disable keyboard in java applet  How to disable key board of my client in an java applet embedded in a website while the applet is running.? Plz help
Version of maven>maven-latex-plugin dependency
List of Version of maven>maven-latex-plugin dependency
enable disable table
enable disable table  hi I have table with 3 columns if i click one column the other 2 column should disable pls can anyboby help me
nsstring encoding types
nsstring encoding types   What is NSString Encoding Type in XCode
uitextfield disable keyboard
uitextfield disable keyboard  How to disable keyboard of UITextView in iPhone SDK application?   There are two ways to disable the keyboard...)]; [self.view addSubview:pv]; return NO; } //or simply disable
ModuleNotFoundError: No module named 'jupyter-greek-latex'
ModuleNotFoundError: No module named 'jupyter-greek-latex'  Hi, My... named 'jupyter-greek-latex' How to remove the ModuleNotFoundError: No module named 'jupyter-greek-latex' error? Thanks   Hi
ModuleNotFoundError: No module named 'pandoc-latex-admonition'
ModuleNotFoundError: No module named 'pandoc-latex-admonition'  Hi...: No module named 'pandoc-latex-admonition' How to remove the ModuleNotFoundError: No module named 'pandoc-latex-admonition' error? Thanks   
ModuleNotFoundError: No module named 'pandoc-latex-barcode'
ModuleNotFoundError: No module named 'pandoc-latex-barcode'  Hi...: No module named 'pandoc-latex-barcode' How to remove the ModuleNotFoundError: No module named 'pandoc-latex-barcode' error? Thanks   Hi
ModuleNotFoundError: No module named 'pandoc-latex-color'
ModuleNotFoundError: No module named 'pandoc-latex-color'  Hi, My... named 'pandoc-latex-color' How to remove the ModuleNotFoundError: No module named 'pandoc-latex-color' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'pandoc-latex-environment'
ModuleNotFoundError: No module named 'pandoc-latex-environment'  Hi...: No module named 'pandoc-latex-environment' How to remove the ModuleNotFoundError: No module named 'pandoc-latex-environment' error? Thanks  
ModuleNotFoundError: No module named 'pandoc-latex-extensions'
ModuleNotFoundError: No module named 'pandoc-latex-extensions'  Hi...: No module named 'pandoc-latex-extensions' How to remove the ModuleNotFoundError: No module named 'pandoc-latex-extensions' error? Thanks   
ModuleNotFoundError: No module named 'pandoc-latex-fontsize'
ModuleNotFoundError: No module named 'pandoc-latex-fontsize'  Hi...: No module named 'pandoc-latex-fontsize' How to remove the ModuleNotFoundError: No module named 'pandoc-latex-fontsize' error? Thanks   Hi
ModuleNotFoundError: No module named 'pandoc-latex-french-spaces'
ModuleNotFoundError: No module named 'pandoc-latex-french-spaces'  Hi...: No module named 'pandoc-latex-french-spaces' How to remove the ModuleNotFoundError: No module named 'pandoc-latex-french-spaces' error? Thanks
ModuleNotFoundError: No module named 'pandoc-latex-levelup'
ModuleNotFoundError: No module named 'pandoc-latex-levelup'  Hi...: No module named 'pandoc-latex-levelup' How to remove the ModuleNotFoundError: No module named 'pandoc-latex-levelup' error? Thanks   Hi
ModuleNotFoundError: No module named 'pandoc-latex-margin'
ModuleNotFoundError: No module named 'pandoc-latex-margin'  Hi, My... named 'pandoc-latex-margin' How to remove the ModuleNotFoundError: No module named 'pandoc-latex-margin' error? Thanks   Hi
ModuleNotFoundError: No module named 'pandoc-latex-newpage'
ModuleNotFoundError: No module named 'pandoc-latex-newpage'  Hi...: No module named 'pandoc-latex-newpage' How to remove the ModuleNotFoundError: No module named 'pandoc-latex-newpage' error? Thanks   Hi
ModuleNotFoundError: No module named 'pandoc-latex-tip'
ModuleNotFoundError: No module named 'pandoc-latex-tip'  Hi, My... named 'pandoc-latex-tip' How to remove the ModuleNotFoundError: No module named 'pandoc-latex-tip' error? Thanks   Hi, In your

Ads