Thursday, July 29, 2010

Designing Graphics in LaTeX through Web

Today I started another topic of my project. Although the training is over now but the task regarding project is still pending. To design Graphics in LaTeX i need a script that run latex compiling commands from web browser and a php code that calls the script and last a .tex file to be compiled containing graphics code.

For the script that run latex commands do following:
Got to terminal
$cd /var/www/
$sudo mkdir demo
$cat > script.bat
cd /var/www/demo
latex slide.tex
dvips slide -o
ps2pdf slide.ps
^z
Now to design the php code that runs the script:
Go to terminal again
$cd /var/www/demo
$sudo -s
#vi index.php
$command = "sh script.bat";
exec($command, $output=array());
?>
:wq!
#exit
Now give the permissions to whole demo folder so that script can create some other files during latex file compilation without any difficulty.

Sunday, July 11, 2010

Feng Office

As according to my project i need to work and to do analysis of following:
1)Using LaTeX to design a report and presentation.
That i have done using pdfscreen package and also i have used endfloat package to make figures.
2)Automation of selection of template in OpenOffice using Some python script
3)Using css@media to have print and screen view
4)To have an online office suite.
I need to do all these 4 tasks and need to compare all these means their pros and cons.
My second and third task are still pending but curently i am working on 4th task.
Regarding this I earlier used O3Spaces which is online suite that provides workspace for managing the documents online , uploading document from your localsystem maintaing it online and also downloading document from your o3 workspace. But It was having limitation that i have already discussed.
So, Now i am going to try some another office suite that i can provide online.
First amongest them is fengoffice
feng office provides you to have your own online office suite and it's quite easy to install it.
  • Manage your projects and business services
  • Collaborate with your team and your customers
  • Organize and share documents and files
for more just follow here

Saturday, July 10, 2010

LaTeX endfloat package

Hello Everyone , I want to discuss about you regarding a special package available in LaTeX called endfloat package by including this package in preamble all the figures and tables present in your middle or starting of package just float towards end of document and they all get placed at end of document.

I am hereby discussing with you people because sometimes when we have to submit journals,conference papers it is mandatory to include all table and figures at last of your document. In that case endfloat package in LaTeX works wonder. If you don't want to place your pictures and tables to end of document just comment out the line
\usepackage{endfloat}

Thursday, July 8, 2010

Installing O3space on your linux system

I am making here documentation for how to install o3workspace so that any visitor on this site can have full fledge process of installation, otherwise one has to wander from one site to another as i did.

1) first of all you need to have O3spaces.deb package . For that just go to www.o3spaces.org. There you find Register section Register under Communtiy edition (it is completely free).After Go to your mail activate your account on o3space. as soon as account is activated you will get another mail having username and password.With this username and password log on to o3spaces and after that download .deb package.
2) For O3space to work you need sun-java-6-jdk and sun-java-6-jre.
To install it Got to terminal and type:
$sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"
$sudo apt-get update
$sudo apt-get install sun-java6-jdk
3) After that follow step and when installed. Go to Application Menu then System and open java console and enable a server either localhostor remote one.
4)After that run o3space.deb package to install your o3space on ubuntu.
after completion. Go to browser type http://localhost:8095/Spaces or type
http://localhost:8095/Studio (Command line is here for o3spaces).You will something see like this when use Spaces.

You can also change your ip from localhost to your own ip. Means you can also have http://myip:8095/Studio or http://myip:8095/Spaces. So, For that you first need to shutdown your tomcat server. With o3spaces.deb tomcat get installed simultaneously.
For shutdown Go to terminal and type:
$sudo -s
#cd /opt/O3Spaces/tomcat/bin
#./shutdown.sh
But remember before executing script ./shutdown.sh you need to do some changes in shutdown.sh
#gedit /opt/O3Spaces/tomcat/bin/shutdown.sh
Caution!!find somewhat written like sun-java-1.6.3. and replace it by sun-java6-jdk Save it same changes you need to make it in startup.sh also.
This will stop your tomcat. After that go to terminal again and type.
#gedit /opt/O3Spaces/tomcat/conf/server.xml
Here find localhost and replace it with your server domain and then restart tomacat server. And then you can access o3spaces from your desired ip.

Tuesday, July 6, 2010

Making Online LaTeX Compiler

Today was a good rainy day and quite motivating one. One idea struck to my mind today that what about if latex code will compiled online means no need to install latex code on our system we can access latex compiler through online.
Various Online Latex Compiler are working today. You can go for following link for online latex compiler.
www.scribtex.com
http://webtex.scoditti.com/
And many more just search in google. so it's great means no need of latex installation, no worry about compilation , you just put code and output is yours.
I am user of latexusergroup at googlegroups.com and there i asked for help regarding some logicto made script that can help me to do this task.
But one the user Peter Flynn provide me script and html form to which i made some necessary changes according to me.
You can have it just click below:
form
script

Monday, July 5, 2010

How to insert Python Script in OOwriter as macro

Python being an object oriented language has great benefit in designing the API but in case you want to automate the oowriter you need to compromise in terms of ease of coding as is provided with openoffice.org basic.But Good news is that this problem occur only if you want to write Macros in Python but if you want to design API to OpenOffice using UNO (Universal Network Object) than python programming is great.But as i already said that the major disadvantage of doing python scripting in oowriter is that you cann't write script directly into your openoffice.

Instead we need to use a separate text editor you may use any and write down your code within file with extension .py.
After that if you wish to add this script in oowriter as macro just do the following:

Script Location

Scripts to be excuted in OpenOffice.org can be stored within the following locations:

OpenOffice.org's user directory

This is the standard place for self written python scripts. The script files are simply stored within the file system.
On windows, the directory can typically be found in:
windows - C:\Documents and Settings\Application Data\OpenOffice.org 2.0\user\Scripts\python
unix - ~/.openoffice.org.2.0/user/Scripts/python
Note, that the last python subdirectory may need to be created initially. Make sure, the python is completely written lowercase. You can add arbitrary deeply nested subdirectories, the names of these directories are reflected in the UI.
Example: The dynamicDialog.py file can simply be placed in the above directory. Afterwards, open the
->Tools->Macros->Run macro dialog and navigate to the position shown in the above picture.
Click on Run to execute the python script, which opens another dialog with a push button and a label field. Clicking the button will increase the number within the label field. The dialog can be closed by pressing ESC.

OpenOffice.org's share directory


Scripts that shall be shared throughout all users of a concrete OpenOffice.org installation can be stored with the share directory. All default scripts coming with OpenOffice.org are located here. In general, this directory should not be used for script deployment (see later uno-packages).
The script files are simply stored within the file system. The directory can typically be found in
windows C:\Program Files\OpenOffice.org 2.0\share\Scripts\python
unix /usr/lib/openoffice/share/Scripts/python

Sunday, July 4, 2010

CUSTOMIZING TOOLBAR IN OOWRITER

Open Office Being open source provides you the functionality with which you can customize any tool bar, can assign new tools with some script working over there. That's What i am going to do in my projects. I need to design some sort of script (preferably in python) that let me choose my style of presentation and report with total ease.

Making Tools in OOwriter.

Making new tools is easy in Open Office Writer.

1) Open your OOwriter. Go to Tools->Customize. You will see a window like here:



2) Click On New to make a new toolbar in your open office. And Click on Add to add a new macro, script as a new tool in your tooolbar as shown.After selecting your macro click on add. See below:


3) After that you can assign an icon to newly designed tool and can be modified again & again.

In OOwriter For writing macros there are provided 4 languages:
a) OpenOffice.org Basic
b) Bean Shell
c) Python
d) Javascript as shown:

We can use any of them but preferably i am going to use Python for designing macros so as to customize the selection of styles and formatting in oowriter. But before going in details let me introduce you to python:

Python is a general-purpose high-level programming language whose design philosophy emphasizes code readability. Python aims to combine "remarkable power with very clear syntax", and its standard library is large and comprehensive.

Python supports multiple programming paradigms, primarily but not limited to object oriented, imperative and, to a lesser extent, functional programming styles. It features a fully dynamic type system and automatic memory management, similar to that of Scheme, Ruby, Perl, and Tcl. Like other dynamic languages, Python is often used as a scripting language, but is also used in a wide range of non-scripting contexts.

If you want to go into details of python regarding its syntax and all that click here.

Using the OpenOffice UNO Bridge

OpenOffice has language bindings for C++, Java, JavaScript and Python. On Windows, OpenOffice can also be manipulated in Pascal via COM Automation (see below), but there is currently no easy way of using OpenOffice's UNO (Universal Network Objects) from Pascal on OS X and Linux but from Python we can easily use it. If you're interested in developing an OO "bridge" for Pascal, please refer to these links for more information (caution: these links are quite techie in true Sun fashion):

>api.openoffice.org

About_Bridges

Attempting to use Python to manipulate OpenOffice

Since OpenOffice includes support for Python, it would seem possible to run Python scripts so as to manipulate OO. Here are the steps for one possible approach to doing this:

1. Test UNO via Python macro run within OO
2. Test UNO via Python standalone script

Step 1. Test UNO via Python macro run within OO

OO has tools for creating JavaScript macros, but not Python macros, so use a text editor to save the following script to file test_macro.py and place it in OO's user macro folder. On Windows, this folder is:

C:\Document and Setting\\Application Data\OpenOffice.org2\user\Scripts\python\Library1

On Mac OS X, this folder is:

~/Library/Preferences/NeoOffice-2.2/user/Scripts/python/Library1

On Linux this folder is:

$ cd \usr\share\openoffice\programs\...

On both platforms, you'll need to create the python/Library1 folder

But no need to create folder in Linux/Unix based system just place script in program folder as mentioned above.

Here is the code for test_macro.py, adapted from the OO Pascal example above:

# Python macro that tests UNO by creating new document and inserting some text.

import uno

def TestNewDoc():
ctx = uno.getComponentContext()
smgr = ctx.ServiceManager
desktop = smgr.createInstance('com.sun.star.frame.Desktop')
doc = desktop.loadComponentFromURL('private:factory/swriter', '_blank', 0, ())
textCursor = doc.Text.createTextCursor()
doc.Text.insertString(textCursor, 'Hello World', 0)

In OO, choose Tools | Macros | Organize Macros | Python and run the macro to make sure it works.

Step 2. Test UNO via Python standalone script

Here is the same code as a standalone script:

# Python script that tests UNO by creating new document and inserting some text.

import sys

if sys.platform == 'darwin':
sys.path.append('/Applications/NeoOffice.app/Contents/MacOS')

import officehelper

ctx = officehelper.bootstrap()
smgr = ctx.ServiceManager
desktop = smgr.createInstance('com.sun.star.frame.Desktop')
doc = desktop.loadComponentFromURL('private:factory/swriter', '_blank', 0, ())
textCursor = doc.Text.createTextCursor()
doc.Text.insertString(textCursor, 'Hello World', 0)

Save this to file test.py and run it like this on Windows from a command line. Note: On Windows and Linux, use the version of Python included with OO; on Mac OS X, use the system's Python 2.3.

"\program files\openoffice.org 2.3\program\python" test.py

On Mac OS X, run the script like this from a Terminal window:

#!/bin/sh
export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH":/Applications/NeoOffice.app/Contents/MacOS"
python2.3 test.py

On Linux

$ python test.py