Home Informatica Bit quotidiani Aggiungere jsMath a Joomla

PostHeaderIcon Aggiungere jsMath a Joomla

Come ho gia scritto su questo sito scrivere matematica sul web non è cosa semplice. La mia scelta è caduta (per ora...) su jsMath. Mi è stato chiesto di scrivere qualcosa su come ho fatto a integrare jsMath con Joomla, che il sistema che uso io.

Installazione

Scaricarsi jsMath e fare l'upload sul sito in un cartella jsMath. L'albero delle directory sul mio sito è simile al seguente (sto su JoomlaHost)

  • Root del portale
    • Administrator
    • Cache
    • Components
    • ....
    • jsMath
      • easy
      • extensions
      • fonts
        • cm-fonts
        • cmbx10
        • cmex10
        • cmmi10
        • cmr10
        • cmsy10
        • cmti10
      • plugins
      • test
      • uncrompressed
    • templates
    • ect., ect., ...

come da istruzioni sul sito di riferimento di jsMath, e come si vede dall'albero delle directory, ho anche caricato sul mio sito le fonti di carattere.

Predisporre jsMath

Fatto questo ho modificato il file load.js presente nella cartella easy. Bisogna solo aggiungere la root del proprio sito:

jsMath.Easy = {
//
// The URL of the root jsMath directory on your server
// (it must be in the same domain as the HTML page).
// It should include "http://yoursite.com/", or should
// be relative to the root of your server. It is possible
// to be a relative URL, but it will be relative to the
// HTML page loading this file.
//
// If you leave this blank, jsMath will try to look it up from
// the URL where it loaded this file, but that may not work.
//

root: http://www.tuosito.com/jsMath,
//

// The default scaling factor for mathematics compared to the
// surrounding text.
//
scale: 110,

etc,., etc., ...

Meglio fare le modifiche su un file load.js e fare l'upload tramite ftp.

Modificare il template

Indipendentemente da quali templates usiate è necessario operare una sola modifica. Bisogna aggiungere la riga rossa segnata sotto nell'header prima del tag .

/**
 * @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
 * @license  GNU/GPL, see LICENSE.php
 * Joomla! is free software. This version may have been modified pursuant
 * to the GNU General Public License, and as distributed it includes or
 * is derivative of works licensed under the GNU General Public License or
 * other free or open source software licenses.
 * See COPYRIGHT.php for copyright notices and details.
 */

// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );
?>

<script src="http://www.miosito.com/jsMath/easy/load.js" mce_src="http://www.miosito.com/jsMath/easy/load.js" type="text/javascript">

Scrivere gli articoli

A questo punto non resta che scrivere gli articoli. Io per esempio inserisco direttamente i tag di latex nell'editor di joomla come in questo esempio \(3x^2+2x-5=0\) ottenuto nel mio caso usando i tag di apertura \ ( e di chiusura \ ) (senza lo spazio intermedio ovviamente). Stessa cosa per le equaioni fuori corpo: \ [  e \ ]. Ecco l'esempio \[\frac{x^2-x+1}{x+3}=0 \]Se si vogliono usare i dollari basta guardare nel file load.js già descritto. Fatemi sapere...

 

 

Ultimo aggiornamento (Lunedì 23 Febbraio 2009 22:13)

 
Cerca nel sito
E il download?

Il download, fino a decisione diversa, l'ho messo nell'area riservata agli utenti registrati. La registrazione è gratuita.